Glossary
| Acronym | Definition |
|---|---|
| SPO | Software Production Operation |
| BL | Behavior Layer |
| ML | Middleware Layer |
| BSM | Behavior Specific Middleware |
| TSM | Target Specific Middleware |
Glossary
Referenced Documents
General ConceptsInterface code generation is part of the components generation as presented in [1] is invoked during execution of UML to C operation as presented in [[3]. Supported ElementsHere is an exhaustive list of elements used by the code generator to produce the Code with a summary of the purpose and impact.
Validation Constraints- Code Generator Specification
This section is divided in 2 parts:
Files Architecture SpecificationsInterface code is composed of 3 files:
General requirements related to file content are described in [2]. <ClassName>_itf.c
<ClassName>_itf.c interface file implements the top-level functions initializing the code sections of the class and calling the ClassifierBehavior functions. File <ClassName>_itf.c is generated for the input element, which is a class and has a ClassifierBehavior. General requirements related to file content and structure are described in [2]. #include to the file <ClassName>.h is generated. <ClassName>.h contains the structure definition of the root class element. #include to the file <ClassName>_itf.h is generated. <ClassName>_itf.h file contains the contract functions definition. #include to the file <ClassName>_<ClassifierBehaviorName>.h is generated. <ClassName>_<ClassifierBehaviorName>.h file contains the classifier behavior structure definition. #include "Add.h" #include "Add_itf.h" #include "Add_Add.h" Example: Includes The classifier behavior of a Class/Block is implemented with 3 functions init, step, end. Init function An init function is generated for the classifier behavior. See [4] for more information about the init function prototype. Init function has one argument Rte_Instance. Init function creates an instance of the Class/Block structure and assigns it to the user_section attribute of the Rte_Instance. Init function gets a pointer to the Classifier Behavior and calls its internal init function. Init process is performed only if user_section is not yet initialized.
/**********************************************************************
* Init function invoked for component initialization purpose.
**********************************************************************/
void AddOne_init(Rte_Instance instance){
/* Condition to prevent multiple init if the component contains multiple behaviors */
if(inst->user_section == 0) {
/* Create a Add */
Add *pAdd = (Add*)new_Add();
/* We store the Add in "user_section" area */
inst->user_section = pAdd;
/* Get behavior add from the Add */
Add_struct *add = (Add_struct*) getAdd(pAdd);
/* Initialization job which can be done in a separated function or inlined. */
_basic_Add_init(add);
}}
Example: Init function example Step function A step function is generated for the classifier behavior. This function initializes pointers and calls the _basic_ function. See [4] for more information on step function prototype. Step function has one argument Rte_Instance. Check this requirement in case of Client-Server communication. Step process is performed only if user_section is yet initialized. Step function gets a pointer to the Class/Block structure from the user_section attribute of the Rte_Instance. Step function gets a pointer to the Classifier Behavior and calls its internal end function. Step function collects input data. See chapter 9.2 for more details depending on the elements. Following input data collect, the function updates the internal clock WALL_CLOCK of all behaviors: ClassifierBehavior and invoked behaviors by calling the RTE_GetTime() API and assigning the result to the WALL variable of each structure of each behavior. Following clock update, the function calls the step function of the ClassifierBehavior. Following ClassifierBehavior step function call, the step function transmits output data. See chapter 9.2 for more details depending on the elements.
/**********************************************************************
* Main function Body of behavior "Add"
**********************************************************************/
void AddOne(Rte_Instance inst) {
/* Condition to prevent execution if the component is not initialized */
if(inst->user_section != NULL) {
/* Get component Add from "user_section" */
Add *pAdd = (Add*)inst->user_section;
/* Get behavior addOne from the Add */
AddOne_struct *addOne = getAddOne(pAdd);
<INPUT DATA COLLECT – See chapter 9.2>
/* update WALL_CLOCK */
addOne->WALL_CLOCK = RTE_GetTime(inst);
(void)_basic_AddOne(addOne);
<OUTPUT DATA TRANSMISSION – See chapter 9.2>
}
}
Example: Step Function End function A end function is generated for the classifier behavior. See [4] for more information on end function prototype. End function has one argument Rte_Instance. End function gets a pointer to the Class/Block structure from the user_section attribute of the Rte_Instance. End function gets a pointer to the Classifier Behavior and calls its internal end function. End process is performed only if user_section is initialized.
/**********************************************************************
* Exit function invoked at execution ending
**********************************************************************/
void Add_end(Rte_Instance inst) {
/* Condition to prevent execution if the component is not initialized */
if(inst->user_section != 0) {
/* Get component Add from "user_section" */
Add *pAdd = (Add*)inst->user_section;
/* Get behavior add from the Add */
Add_struct *add = (Add_struct*) getAdd(pAdd);
_basic_Add_end(add);
}
}
Example: End function <ClassName>_itf.hThe interface file describes the APIs that a Block / Class can access (Communication APIs) and API that a Block / Class delivers (Behavior APIs). File <ClassName>_itf.h is generated for the input element, which is a class and has a ClassifierBehavior. General requirements related to file content and structure are described in [2]. To be completed {#to-be-completed .3DS-Title-3} This file contains a section declaring the list of communication APIs accessible buy the component. Section is COMMUNICATION API DECLARATION and used in chapter 9.2. <ClassName>_type.hThe <ClassName>_type.h file describes the data types used by the properties and the operations in the ports. File <ClassName>_type.h is generated for the input element, which is a class. General requirements related to file content and structure are described in [2]. #include to the file stddef.h is generated. stddef.h file defines NULL. #include to the file stdbool_itf.h is generated. stdbool.h file defines bool. Each type used by at interface level class is generated. See chapter 9.2 for more details depending on the elements. #include <stddef.h> /* stdbool.h define standard bool (true/false) starting from C99 standard */ #include <stdbool.h> <DATA TYPES DECLARATION – See chapter 9.2 Example: Types definition Based on the dependency between types, each type referencing another type is defined after this type. Each type is definition is protected by a #ifdef, #define, #endif mechanism. Each type is defined by the C typedef mechanism. /********************************************************************** * Data Type <type> definition * @generated_from <uuid> **********************************************************************/ #ifndef <type>_DEFINITION #define <type>_DEFINITION typedef <base_type> <type>; #endif Example: Type declaration Semantic Code Specifications
This section describes the code generator behavior for specific code sections depending on the input object. Proxy Port and Interface Block
A Proxy Port can reference an Interface Block. If a Proxy Port references an Interface Block, it can transmit FlowProperty values and operations declared in this Interface Block. COMMUNICATION API DECLARATIONA RTE_Read function is declared for each FlowProperty declared in an Interface Block seen as an input for the block. See [4] for more information about RTE_Read API. <Port_Name> of RTE_Read API is the name of the proxy port. <Data_Name> of RTE_Read is the name of the flow property. void RTE_Read_input1_flow(Rte_Instance instance, Integer* msg); Example: RTE_Read function declaration A RTE_Write function is declared for each FlowProperty declared in an Interface Block seen as an output for the block. See [4] for more information about RTE_Write API. <Port_Name> of RTE_Write API is the name of the proxy port. <Data_Name> of RTE_Write is the name of the flow property. void RTE_Write_output1_flow(Rte_Instance instance, Integer* msg); Example: RTE_Write function declaration STEP FUNCTION - INPUT DATA COLLECTStep function collects input data associated with each FlowProperty declared in an Interface Block seen as an input for the block using RTE_Read API. See [4] for more information about RTE_Read API. A value associated with a FlowProperty declared in an Interface Block value is stored in the data structure associated with the Class/Block structure with its type. This req is not yet implemented. See [3] for more information about the data structure. /* read input(s) */ RTE_Read_input_flow1(inst, &addOne->input_flow1); Example: Reading an input FlowProperty STEP FUNCTION - OUTPUT DATA TRANSMISSIONStep function writes output data associated with each output FlowProperty contained in a BlockInterface associated with a Proxy Port using RTE_Write API. See [4] for more information about RTE_Write API. FlowProperty value is written from the stored in the data structure associated with the Class/Block structure. This req is not yet implemented. See [3] for more information about the data structure. /* write output(s) */ RTE_Write_output_flow1(inst, &addOne->output_flow1); Example: Writing an output FlowProperty Flow PortCOMMUNICATION API DECLARATIONA RTE_Read function is declared for each input flow port. See [4] for more information about RTE_Read API. <Port_Name> of RTE_Read API is the name of the flow port. <Data_Name> of RTE_Read is data. void RTE_Read_input1_data(Rte_Instance instance, Integer* msg); Example: RTE_Read function declaration A RTE_Write function is declared for each output FlowPort. See [4] for more information about RTE_Write API. <Port_Name> of RTE_Write API is the name of the flow port. <Data_Name> of RTE_Write is data. void RTE_Write_output1_data(Rte_Instance instance, Integer* msg); Example: RTE_Write function declaration STEP FUNCTION - INPUT DATA COLLECTStep function collects input data associated with each input FlowPort using RTE_Read API. See [4] for more information about RTE_Read API. FlowPort value is stored in the data structure associated with the Class/Block structure. This req is not yet implemented. See [3] for more information about the data structure. STEP FUNCTION - OUTPUT DATA TRANSMISSIONStep function writes output data associated with each output FlowPort using RTE_Write API. See [4] for more information about RTE_Write API. FlowPort value is written from the data structure associated with the Class/Block structure. This req is not yet implemented. Signal
In the following rules, Statemachine and Activity are considered as behaviors of the class. They can be the Classifier Behavior of the class or a behavior called directly or indirectly by the Classifier Behavior. A signal is considered as an input Signal according to the following rules:
A signal is considered as an output Signal according to the following rule:
A signal is considered as an internal Signal when it satisfies both rules:
A signal is considered as an input external Signal when it satisfies both rules:
COMMUNICATION API DECLARATIONA RTE_Read function is declared for each input external signals. See [4] for more information about RTE_Read API. <Port_Name> of RTE_Read API is the name of the proxy port. <Event_Name> of RTE_Read is the name of the signal. void RTE_Read_port_signal(Rte_Instance instance, Integer* msg); Example: RTE_Read function declaration A RTE_Trigger function is declared for each output external signal transmitted through a Proxy Port. See [4] for more information about RTE_Write API. <Port_Name> of RTE_Write API is the name of the proxy port. <Event_Name> of RTE_Write is the name of the flow property. void RTE_Trigger_port_signal(Rte_Instance instance, Integer* msg); Example: RTE_Trigger function declaration with transmitted data STEP FUNCTION - INPUT DATA COLLECTStep function collects input external signals. Each input Signal is collected using Rte_Read API. See [4] for more information about RTE_Read API. Data associated with an input external signal are collected with the signal. Signal and associated data are stored in the data structure associated with the Class/Block structure. This req is not yet implemented.
/* handle external event(s) */
add->EVENT = ADD_EVENT_T_NO_EVENT;
if(add->EVENT == ADD_EVENT_T_NO_EVENT) {
SignalEvent_Signal_type signalEvent_Signal;
RTE_Read_input_Signal(inst, &signalEvent_Signal);
if(signalEvent_Signal.trigger == TRUE) {
add->EVENT = ADD_EVENT_T_Signal;
add->input_Signal_s1 = signalEvent_Signal.data.s1;
}
}
Example: Reading an input external Signal status and associated data Step function collects internal signals. Data associated with an internal signal are collected with the signal. Internal signal and associated data are stored in the data structure associated with the Class/Block structure. This req is not yet implemented. } Example STEP FUNCTION - OUTPUT DATA TRANSMISSIONThe function triggers the external events which need to be transmitted to other blocks with the API RTE_Trigger. See [4] for more information about RTE_Trigger API. Data associated with output external event are collected with the event before transmitting it.
/* write output(s) */
RTE_Write_output_flow1(inst, &addOne->output_flow1);
/* trigger event(s) */
if (add->EVENT == ADD_EVENT_T_Signal) {
add->EVENT = ADD_EVENT_T_NO_EVENT;
Signal_record Signal;
Signal.s1 = add->output_Signal_s1;
RTE_Trigger_output_Signal(inst, &Signal);
}
Example: Writing an output Signal containing data DATA TYPES DECLARATIONEach signal which is received or produced by any behavior and transmitted or received through a port is expected to be defined in <ClassName>_type.h. If a component contains one or multiple signals, a trigger_type is generated. /********************************************************************** * Data Type trigger_type definition **********************************************************************/ #ifndef trigger_type_DEFINITION #define trigger_type_DEFINITION typedef bool trigger_type; #endif /* trigger_type */ Example: Trigger_type declaration If a signal references one or multiple properties, a dedicated structure is generated for the data transmitted with the signal.
/**********************************************************************
* Data Type Signal definition
**********************************************************************/
#ifndef Signal_DEFINITION
#define Signal_DEFINITION
typedef struct {
Integer s1;
Integer s2;
} Signal;
#endif /* Signal */
Example: Signal content declaration A signal type is declared by a structure named SignalEvent_<signal_name>l_type. This structure contains at least one trigger field with type trigger_type to store the event activation. If a signal references one or multiple properties, an addition field named <signal_name> is added to the structure.
/**********************************************************************
* Data Type SignalEvent_Signal_type definition
**********************************************************************/
#ifndef SignalEvent_Signal_type_DEFINITION
#define SignalEvent_Signal_type_DEFINITION
typedef struct {
trigger_type trigger;
Signal data;
} SignalEvent_Signal_type;
#endif /* SignalEvent_Signal_type */
DataType and Value Type and Enumeration
A type can be a redefinition of an existing type by using a generalization relation. ![]() Data Types and Value Types are used to enter the data. Enumeration is used to defined an enum. Data can be used in many places but in the context of the interface definition, a Data Type or Value Type can be used at the interface level by:
DATA TYPES DECLARATION
Each Data Type or Value Type, which are referenced by a Flow Port, a Flow Property in a Block Interface, is expected to be defined in <ClassName>_type.h. Primitive TypeA Data Type or a Value Type having one of the following names are not defined:
Data types defined in C++ ANSI profile are supported. No typedef needs to be generated. ![]() If an Integer type of the following profiles if is referenced directly or indirectly in the design, an Integer type is generated:
Integer is defined as an int. #ifndef Integer_DEFINITION #define Integer_DEFINITION typedef int Integer; #endif Example – Integer type declaration If a Boolean type of the following profiles is referenced directly or indirectly in the design, a Boolean type is generated:
Boolean is defined as a bool. #ifndef Boolean_DEFINITION #define Boolean_DEFINITION typedef bool Boolean; #endif Example – Boolean type declaration If a Real type of the following profiles is referenced directly or indirectly in the design, a Real type is generated:
Real is defined as a double. #ifndef Real_DEFINITION #define Real_DEFINITION typedef double Real; #endif Example – Real type declaration If a String type of the following profiles is referenced directly or indirectly in the design, a String type is generated: (Not supported)
String is defined as a XXXX. (Not supported) Array Type![]() An array is generated when a property, a parameter, or a type references another type with a multiplicity greater than 1. An array is defined with a naming convention as the following: Array_<size>_<referencedType>. /********************************************************************** * Data Type Array_3_Integer definition **********************************************************************/ #ifndef Array_3_Integer_DEFINITION #define Array_3_Integer_DEFINITION typedef Integer Array_3_Integer[3]; #endif /* Array_3_Integer */ Example: Array definition in model Structure Type![]() A struct is defined for a value type or a data type containing one or multiple properties.
/**********************************************************************
* Data Type Struct definition
**********************************************************************/
#ifndef Struct_DEFINITION
#define Struct_DEFINITION
typedef struct {
unsigned int data1;
double data2;
bool data3;
} Struct;
#endif /* Struct */
Example: structure definition Enumeration TypeAn enum is identified as an enumeration in the design. ![]() An enum is defined for an enumeration.
/**********************************************************************
* Data Type ControlEnum definition
* @generated_from _2022x_16600ad_1673975868491_889391_20271
**********************************************************************/
#ifndef ControlEnum_DEFINITION
#define ControlEnum_DEFINITION
typedef enum {
Idle,
Open,
Close
} ControlEnum;
#endif /* ControlEnum */
Union Type- | |||||||||||||||||||||||||||||||||||||||||||||||||||||