UML and SysML to C - Assembly Code Generator Specification

This section describes the UML and SysML to C assembly code generation.

This page discusses:

Glossary

Acronym Definition
SPO Software Production Operation
TAL Target Abstraction Layer

Referenced Documents

Document Internal Reference
Targeted Application Concept [1]
C Code Architecture Specification [2]
UML and SysML to C - Software Production Operation Specification [3]
UML and SysML To Code Concepts [4]
UML and SysML to C - Interface Code Generation Specifications [5]
UML and SysML to C - Class Code Generator Specification [6]

General Concepts

Depending on the standard, UML or SysML, an assembly can be identified:

  • As a SysML entity identified and described through an Internal Block Diagram,
  • As a UML entity identified as a Composite Structure described through a Composite Structure Diagram.

Assembly generation is part of the components layer generation as presented in [1]. It is invoked during execution of UML to C operation as presented in [3] and [4].

This document focuses on the C code generation for the assembly corresponding to the Communication and Scheduling Component.

The generated code of the Communication and Scheduling Component is composed of 2 parts.

The first is managing the scheduling of the behaviors and the communication between the components.

The second part is related to the hooks mechanism. Hooks are a mechanism to enable user-specific implementation on any kind of communication points. When a data or an operation is invoked from a component to another one, it is possible to customize the behavior to read or a write a data. This mechanism is also used in the context of the FMU to exchange data between the executed model and the FMU interfaces.

The hooks mechanism relies on one start function and one return function for each communication point.

The start function is called at the beginning of the communication function and the return function is implemented at the end of the function. Functions are enabled through a declaration mechanism that relies on a system of declaration.

Supported Elements

Here is an exhaustive list of elements used by the code generator to produce the code with a summary of the purpose and impact.

Element Description
UML Class / SysML Block The root elements of the generation. It contains classes which compute behavior and exchange data. An Instance is automatically generated for each root element and aggregated / associated elements.
UML Instance Specification Instance Specification can be used as root elements of generation. Purpose is to create predefined instances of objects.
UML link In case of Instance Specification, links are used to define relations between instances.
UML Port / SysML Flow Port / SysML Proxy Port A port is used to declare communication elements exchange by a class.
UML Interface SysML Interface Block Object containing elements transmitted through a port.
UML Connector A connector is used to connect 2 ports.
Property A property is used in the context of 2 objects: - In an UML interface to define data transmitted through a UML port - In a class to instantiate another class
SysML Flow Property A flow property is used in the context of an Interface Block to define data transmitted through a port
UML Operation Client-server operation declared in an Interface.
Classifier Behavior Behavior that is automatically scheduled depending on the schedule information configured for it. The behavior can be a statemachine, an activity, or an opaque behavior.
UML Signal Type of communication to trigger an Event.
UML Component When applicable, this element is considered as an UML class

Code Generator Specification

This section is divided in 2 parts:

  • The generated files specification
  • The behavior specification

Files Specifications

The generated code is composed of 2 files for the scheduling of behaviors and the communication between components and a dedicated section in a third file:

  • Cse_cfg.h
  • Cse.c
  • Dedicated section in <ClassName>.h

The generated code is also composed of 3 files implementing the hooks mechanism:

  • Cse_hook.h
  • Cse_hook_cfg.h
  • Cse_hook_usr.c

The general requirements related to file content are described in [2].

Cse_cfg.h

Cse_cfg.h header file has a fixed name. This file is indeed included from the Target Abstraction Layer.

This header file includes files defining types used at communication interface, declares the predefined tasks IDs, the behaviors IDs.

A macro is generated to read the content of the file as a C declaration if it is included directly or indirectly from a C++ file.

Rationale: During compilation, information of this file must be treated as C information.

/* Macro to prevent error if file is included from a C file */
#ifdef __cplusplus
extern "C" {
#endif

Example: Cpp macro

When scheduling is enabled, no legacy task_descriptor.h include is generated. Task descriptors are expressed with the TAL types Tal_Static_Task and Tal_Static_Task_const (see Tal_Task.h), which are included from Cse.c when the assembly is built.

#include to all classes type files on instantiated directly or indirectly by the root class are generated.

/**********************************************************************
 * Includes declaration
 **********************************************************************/
#include "Class1_type.h"
#include "Class2_type.h"

Example: Includes

Macro is defined to identify the number of predefined tasks depending on the configuration of the model.

A predefined task is a task pre-calculated by the code generator to execute behaviors.

Collection of macros is defined to identify a unique ID for each task.

If not Realtime configuration is provided to generator, collection of macros is defined to identify the position of each behavior in tasks.

/**********************************************************************
 * Macros declaration
 **********************************************************************/
/*
 * Number of predefined tasks
 */
#define NUMBER_OF_TASKS 1

/*
 * Tasks ids definition
 */
#define TASK_0 0
#define TASK_1 1

/*
 * Behaviors in tasks position index definition
 */
#define TASK_0_UC1_p1_beh 0
#define TASK_1_UC1_p2_beh 0

Example: Task and behaviors definition

if Realtime Configuration has been provided to generator, collection of macro is created according to it: ![[Pasted image 20260703155500.png|697]]

/**
 * Tasks ids definition &
 * Behaviors in tasks position index definition
 */
#define TASK_Periodic_Task1 0
#define TASK_Evt_Task1 1

Example Task and behaviors definition according to realtime configuration

4 functions are declared with the purpose of being invoked by the TAL layer.

/**********************************************************************
 * Functions declaration
 **********************************************************************/
/*
 * Build the component instances: allocation, construction and default values.
 * Relations between instances and mapping of the communication APIs are configured apart,
 * by Cse_component_relations_init.
 * First function to call before Cse_component_relations_init, Cse_task_descriptors_init & Cse_components_init
 */
void Cse_component_instances_init(void);

/*
 * Function configuring the relations between the component instances, then mapping the
 * communication APIs to them.
 * Function to call just after Cse_component_instances_init and before Cse_task_descriptors_init & Cse_components_init
 */
void Cse_component_relations_init(void);

/*
 * Function configuring each task.
 * Function to call just after Cse_component_instances_init & Cse_component_relations_init
 */
void Cse_task_descriptors_init(void);

/*
 * Function calling all the init functions as configured in the model.
 * To be called after Cse_component_instances_init, Cse_component_relations_init & Cse_task_descriptors_init
 */
void Cse_components_init(void);

Example: Functions declaration

Cse.c

Cse.c contains the mapping of behaviors on tasks and the implementation of the communication between the components.

When scheduling is enabled, #include to Tal_Task.h and Tal_Activation.h are generated. #include to Tal.h is generated when dynamic allocation is selected (for tal_allocate()). Otherwise Tal.h is still included when the TAL memory service is required.

#include to the file Cse_cfg.h is generated to access to macros related to system configuration.

#include to the file Cse_hook.h is generated to configure hooks.

An <INCLUDES> section is generated containing includes to the required class definitions.

To get more information on <INCLUDES>, see the dedicated section in chapter 9.2.

#include to the file string.h is generated for memset() function declaration.

/**********************************************************************
 * Includes declaration
 **********************************************************************/
#include "Tal.h" /* tal_allocate when objects_allocation:Dynamic */
#define CSE_C /* Macro to include only some specific parts of include files */

#include "Tal_Task.h" /* Tal_Static_Task declaration */
#include "Tal_Activation.h" /* Tal_Static_Task_runInitialActivation */
#include "Cse_cfg.h"
#include "Cse_objects.h"
#include "Cse_hook.h"

<INCLUDES – See chapter 9.2>
#include <string.h> /* memset */

Example: Includes

An INSTANCES DECLARATION SECTION section is generated for variables declaration.

For more information about INSTANCES DECLARATION SECTION, see the dedicated section in chapter 9.2.

An INSTANCES STATIC ALLOCATION SECTION section is generated for variables declaration if the Objects Allocation parameter is defined as Static.

To get more information on INSTANCES STATIC ALLOCATION SECTION, see the dedicated section in chapter 9.2.

When scheduling is enabled, the task deployment is declared in a Tasks Configuration section:

  • one const Tal_Static_Task_Function task<id>_functions[] table per task, listing the behavior entry points in activation order;
  • one const Tal_Static_Task_const staticTasks_const[NUMBER_OF_TASKS] table holding the ROM part of each task (period, priority, stack size, function table, optional dividers and static instance table);
  • one Tal_Static_Task staticTasks[NUMBER_OF_TASKS] table holding the variable part wired by Cse_task_descriptors_init().

The TAL scheduler retrieves these tables through getTasks(), getTasksConstPart() and getNbTasks().

A task is event driven when period == 0 in its const part. It is cyclic when period > 0 (period is expressed in TAL ticks; see the operation specification for tick rate configuration).

/**********************************************************************************
 * Tasks Configuration
 **********************************************************************************/
/* Behaviors to task mapping */
const Tal_Static_Task_Function task0_functions[3] = {
    (Tal_Static_Task_Function)&Timer_Timer_main,
    (Tal_Static_Task_Function)&Light_Light_main,
    (Tal_Static_Task_Function)&Tempo_TempoManager_main,
};

/* Tasks const part declaration */
const Tal_Static_Task_const staticTasks_const[NUMBER_OF_TASKS] = {
    {
        .functions = task0_functions,
        .period = 0,
        .nfunctions = 3,
        .priority = 2,
        .stackSize = 1024,
    },
    {
        .functions = task1_functions,
        .period = 50,
        .nfunctions = 4,
        .priority = 2,
        .stackSize = 1024,
    },
};

/* Tasks variable part declaration */
Tal_Static_Task staticTasks[NUMBER_OF_TASKS];

Example: Task descriptor tables

When at least one behavior of a task uses a frequency divider, a const Tal_Static_Task_Divider task<id>_dividers[] table and a dividersCycle field are generated in the const part of that task.

An Event pools declaration section is generated before the communication functions when at least one deployed behavior reads events from a pool. A block comment introduces the section and states that pools live in the deployment (Cse.c), not inside classifiers, and that Cse_task_descriptors_init() assigns each behavior the pool it reads and its rank in that pool.

For each event driven task (period == 0) that has at least one behavior reading events, one shared pool is generated:

  • static uint8_t task<id>_eventBuffer[<size>];
  • static Tal_EventPool task<id>_eventPool;

A generated comment identifies the task as event driven, explains that a single FIFO preserves the arrival order of events across behaviors of that task, and documents sizing: the buffer must cover the sum of the configured pool sizes of every behavior served by that pool, capped to what Tal_Events_Handler_PoolSize can address on the target (typically a uint8_t, so 255 bytes maximum).

/* Event pool of task 0, shared by every behavior of that task. A single FIFO per task
   is what makes the arrival order of the events observable: the order of the pool is the
   order its behaviors are activated in.
   Sizing: a merged pool must hold the worst case of the whole task, not of one behavior,
   and it has to fit Tal_Events_Handler_PoolSize (a uint8_t on this target). */
static uint8_t task0_eventBuffer[240];
static Tal_EventPool task0_eventPool;

Example: Shared task pool (event driven task)

For each behavior of a cyclic task (period > 0) that reads events, one private pool is generated:

  • static uint8_t <instance>_<behavior>_eventBuffer[<size>];
  • static Tal_EventPool <instance>_<behavior>_eventPool;

The buffer symbol is qualified by the deployed instance and behavior name so that two deployments of the same classifier in the same task still get distinct pools. A generated comment states that the task is cyclic, that behaviors own their pools individually, and that an event addressed to a behavior that is not due in the current cycle waits in that behavior’s pool instead of blocking events targeted at other behaviors.

/* Pool of behavior Button_Button, which lives in task 1 -- a CYCLIC task, so its
   behaviors own their pools individually rather than sharing one. What waits here is only
   ever read by Button_Button, when the cycle reaches it: nothing else can peek at it, and
   an event arriving while the behavior is not due simply waits.
   Sizing: the worst case of this one behavior over its own period, and it has to fit
   Tal_Events_Handler_PoolSize (a uint8_t on this target). */
static uint8_t button_eventBuffer[128];
static Tal_EventPool button_eventPool;

Example: Per-behavior pool (cyclic task)

When the Objects Access option is Index and Objects Allocation is Static, an eventBuffers[] table listing every event-pool backing store is generated, together with getEventBuffer() and getEventBufferId() helpers, so that tal_initPool() can designate buffers by index.

A central pool backing store talEventsCentralPool[] and the accessors getTalEventsCentralPool() / getTalEventsCentralPoolSize() are generated. Time events and change events that are not yet due are queued in this central pool until the TAL tick thread dispatches them. The size comes from the Central Pool Size generation parameter.

getTalTickRateHz() and the macro TAL_TICK_RATE_HZ are generated at the end of Cse.c so that the TAL timer service and task periods share the same tick rate.

The legacy task_descriptor task_descriptors[] table is not generated.

In case no realtime configuration is provided for task mapping, a generic one is generated from model: A unique task contains all handles to functions which call classifier behaviors per instance. ![[Pasted image 20260706151712.png]]

/* Behaviors to task mapping */

const Tal_Static_Task_Function task0_functions[2] = {
    (Tal_Static_Task_Function)&ClassA_sm_main,
};

Example: task definition in default mode

In case a realtime configuration is provided for task mapping, tasks contents are set according to it.

![[Pasted image 20260706152956.png]]

/* Behaviors to task mapping */
const Tal_Static_Task_Function taskPeriodic_Task1_functions[2] = {
    (Tal_Static_Task_Function)&ClassA_sm_main,
    (Tal_Static_Task_Function)&ClassA_op,
};

const Tal_Static_Task_Function taskEvt_Task1_functions[2] = {
    (Tal_Static_Task_Function)&ClassA_op,
    (Tal_Static_Task_Function)&ClassA_sm_main,
};

Example of task declaration

In case a realtime configuration is provided, functions called by tasks are ordered accordingly

In case a realtime configuration is provided, instances are set accordingly

Realtime configuration accepts classifier behaviors (state machine/activity/opaque), and operation with this signature: void <functionName>();

Implementation of communication API is generated in the following order:

  • Cse_Trigger functions,
  • Cse_Write functions,
  • Cse_Read functions,
  • Cse_Call functions.

To get more information on the implementation of these functions, see the dedicated section in chapter 9.2.

Each communication function is described through a specific header containing a brief and the uuid of the port and the data/operation associated.

/**********************************************************************
 * Function to read <?DATA_NAME?> value on <?PORT_NAME?> port
 * @generated_from <?PORT_ID?>
 * @generated_from <?DATA_ID?>
 **********************************************************************/
<COMMUNCATION FUNCTIONS IMPLEMENTATION – See chapter 9.2>

Example: Communication functions implementation

Function Cse_component_instances_init() is generated.

This function builds the instances: memory allocation, memory initialization, constructor invocation and default values.

To get more information, see the dedicated section in chapter 9.2.

/**********************************************************************
 * Function building the component instances: allocation, construction and default values.
 * Relations between instances and mapping of the communication APIs are configured apart,
 * by Cse_component_relations_init.
 * First function to call before Cse_component_relations_init, Cse_task_descriptors_init & Cse_components_init
 **********************************************************************/
void Cse_component_instances_init(void){

    <INSTANCES DYNAMIC ALLOCATION SECTION – See chapter 9.2>

}

Example: Cse_component_instances_init function with dynamic objects allocation

Function Cse_component_relations_init() is generated.

This function configures the relations between the component instances, then the communication APIs. Isolating it from Cse_component_instances_init() allows the instances to be built without being connected to each other.

Function Cse_component_relations_init() initializes the interface of the component instances with the pointers of the communication functions generated above in INSTANCES DYNAMIC ALLOCATION SECTION.

The access path to the interface of an instance walks the relations of the assembly, so this mapping is generated after the relations assignment.

To get more information, see the dedicated section in chapter 9.2.

/**********************************************************************
 * Function configuring the relations between the component instances, then mapping the
 * communication APIs to them.
 * Instances are expected to be already built by Cse_component_instances_init.
 * Function to call just after Cse_component_instances_init and before Cse_task_descriptors_init & Cse_components_init
 **********************************************************************/
void Cse_component_relations_init(void){

    <INSTANCES RELATIONS ASSIGNMENT – See chapter 9.2>

    /* BEG: Add Communication Interface Configuration */
    /* Write functions */
    /* Trigger functions */
    pModel->inst1.cse_itf.Trigger_output_Signal = &Cse_Trigger_Model_inst1_output_Signal;
    /* Read functions */
    pModel->inst1.cse_itf.Read_input_Signal = &Cse_Read_Model_inst1_input_Signal;
    /* Server call functions */
    /* END: Add Cmmunication Interface Configuration */

    /* BEG: Add Communication Interface Configuration */
    /* Write functions */
    /* Trigger functions */
    pModel->inst2.cse_itf.Trigger_output_Signal = &Cse_Trigger_Model_inst2_output_Signal;
    /* Read functions */
    pModel->inst2.cse_itf.Read_input_Signal = &Cse_Read_Model_inst2_input_Signal;
    /* Server call functions */
    /* END: Add Cmmunication Interface Configuration */

}

Example: Cse_component_relations_init function

Function Cse_task_descriptors_init() is generated.

This function wires the variable part of each Tal_Static_Task to its ROM const part, creates and initializes event pools, binds pools to tasks, and assigns each behavior the pool pointer and behavior rank it reads.

For each task, Cse_task_descriptors_init() binds the const part (staticTasks[i].constPart or constPartIdx depending on the Objects Access option).

For each event driven task with a shared pool, Cse_task_descriptors_init() calls tal_initPool() (or tal_initInstrumentedPool() when instrumented code is generated), then tal_bindPoolToTask() on the task pool. Generated comments state that one pool serves the whole task and that pool order matches behavior activation order.

For each behavior of a cyclic task that owns a pool, Cse_task_descriptors_init() initializes that behavior’s private pool, binds it to the task, and assigns <behavior>_eventPool and <behavior>_id on the component instance. Generated comments explain that cyclic tasks use one pool per behavior.

For each task, a static variable task<task_index>_functions containing the function pointer for each behavior is created. This variable is an array with the size corresponding to the number of functions allocated to the current task.

For each task, a static variable task<task_index>_cseInstances containing the cse instance associated with each behavior is created. This variable is an array with the size corresponding to the number of functions allocated to the current task.

The cse instance is the component instance to be transmitted as a parameter during behavior invoke.

void Cse_task_descriptors_init(void) {
    static Tal_Static_Task_Instance task1_cseInstances[4];

    /* The ROM part of task 0 is wired first: tal_bindPoolToTask reads the period of the
       task to tell an event driven task from a cyclic one, so it must already be reachable. */
    staticTasks[0].constPart = &staticTasks_const[0];

    /* Task 0 is event driven: one pool for the whole task, and the order of that pool
       is the order its behaviors are activated in. */
    tal_initPool(&task0_eventPool, task0_eventBuffer, sizeof(task0_eventBuffer));
    tal_bindPoolToTask(&task0_eventPool, 0);

    /* Pool and behavior rank configuration */
    pflashlight->timer->Timer_Timer_eventPool = &task0_eventPool;
    pflashlight->timer->Timer_Timer_id = 0;
    /* ... other behaviors of task 0 ... */

    /* Task 1 is cyclic: one pool per behavior, not one per task. */
    tal_initPool(&button_eventPool, button_eventBuffer, sizeof(button_eventBuffer));
    tal_bindPoolToTask(&button_eventPool, 1);
    pbutton->Button_Button_eventPool = &button_eventPool;
    pbutton->Button_Button_id = 0;

    staticTasks[1].instances = task1_cseInstances;
}

Example: Cse_task_descriptors_init function

Function Cse_components_init() invokes every behavior _init function, then calls Tal_Static_Task_runInitialActivation() on each task while the scheduler is still stopped. A generated comment explains that initial activation must run before the scheduler starts and while pools are still empty, and that activation order follows the task kind (cyclic vs event driven).

Function Cse_components_init() is generated.

This function executes the init functions of behaviors.

Each init function of behaviors is invoked with the interface of each component instance.

/**********************************************************************
 * Function calling all the init functions as configured in the model.
 * To be called after Cse_component_instances_init, Cse_component_relations_init & Cse_task_descriptors_init
 **********************************************************************/
void Cse_components_init(void) {
    Add_Add_init(&pModel->inst1.cse_itf);
    Add_Add_init(&pModel->inst2.cse_itf);
}

Example: Cse_components_init function

Dedicated section in <ClassName>.h

A dedicated section in <ClassName>.h is generated to generate the variable used as communication buffers.

In the context of the structure generated in<ClassName>.h (see [5]) a specific section is generated for the root assembly of the model. This section contains all the variables used as communication buffers between the components. These buffers are generated represent:

Buffer variables are generated in the BUFFERS DECLARATION SECTION section. To get more information on the declaration, see the dedicated section in chapter 9.2.

    /**********************************************************************
     * Communication & Scheduling Environment - Shared variables declaration
     **********************************************************************/
    <BUFFERS DECLARATION SECTION - see chapter 9.2>

Example: Buffer variables section

Cse_hook.h

Cse_hook.h contains the declaration of the possible hooks for every communication point.

This file relies on the Cse_hook_cfg.h to enable or not each hook.

#include to the file Cse_hook_cfg.h is generated.

A start hook function is declared with the suffix _Start.

A return hook function is declared with a suffix _Return.

Start and return hook functions are enabled through a macro declaration mechanism. If a macro is declared in Cse_hook_cfg.h.

Hook functions are declared in HOOKS DECLARATION SECTION section. To get more information on the declaration, see the dedicated section in chapter 9.2.

/**********************************************************************
 * Includes declaration
 **********************************************************************/
#include "Cse_UC1_hook_cfg.h"

<HOOKS DECLARATION SECTION – See chapter 9.2>

Example: Hook file content

Start and return hook functions are enabled with the following detailed mechanism:

/**********************************************************************
 * Functions declaration
 **********************************************************************/
#if defined(Cse_<Read/Write/Trigger>Hook_<Component_inst>_<port>_<data>)
extern void Cse_<Read/Write/Trigger>Hook_<Component_inst>_<port>_<data>_Start(<data_type>* pData);
extern void Cse_<Read/Write/Trigger>Hook_<Component_inst>_<port>_<data>_Return(<data_type>* pData);
#else
#define Cse_<Read/Write/Trigger>Hook_<Component_inst>_<port>_<data>_Start(value)  ((void) (0))
#define Cse_<Read/Write/Trigger>Hook_<Component_inst>_<port>_<data>_Return(value)  ((void) (0))
#endif /* Cse_<Read/Write/Trigger>Hook__<Component_inst>_<port>_<data> */

Example: Hooks declaration

Cse_hook_cfg.h

Cse_hook_cfg.h contains a collection of macros declaring the hooks to enable. This file is only included by Cse_hook.h.

First element is the definition of condition ENABLE_HOOKS macro to control enablement all hook functions.

Hook functions are enabled when the corresponding macro is declared.

Macros used to enable hooks are declared in HOOKS ACTIVATION SECTION section. To get more information on the declaration, see the dedicated section in chapter 9.2.

/* 
 * Define symbol ENABLE_HOOKS to enable the mechanism of hooks 
 * Enabled by default
 */
#define ENABLE_HOOKS
#ifdef ENABLE_HOOKS

<HOOKS ACTIVATION SECTION – See chapter 9.2>

#endif /* ENABLE_HOOKS */

Example: File content

Cse_hook_usr.c

Cse_hook_usr.c contains the skeleton of hook functions to let you implement your own behavior.

First element is the definition of USER_HOOKS macro to control enablement of implementation contained in that file.

The purpose of the USER_HOOKS macro is to disable the implementation of hooks in the current file with the intention of delegating the implementation of these functions outside: for example, the FMU generator.

Macro USER_HOOKS can be defined in the file or with compilation arguments and can be used with macro ENABLE_HOOKS.

#include to the file Cse_cfg.h is generated.

A user-specific section is generated to enable the insertion of additional includes or code.

Hook function skeletons are generated in HOOKS SKELETON SECTION section. To get more information on the declaration, see the dedicated section in chapter 9.2.

/* define symbol USER_HOOKS to enable this file content on compiler 
 * command or uncomment following line
 */
/* #define USER_HOOKS */
#ifdef USER_HOOKS

#include "Cse_cfg.h"

/* BEG_USER_CODE(HEADER) do not remove */
/* Add your includes here */
/* END_USER_CODE(HEADER) do not remove */

<HOOKS SKELETON SECTION – See chapter 9.2>

#endif /* #ifdef USER_HOOKS */

Example: File content

Semantic Code Specifications

This section describes the behavior of the code generator depending on the UML/SysML element.

Before the detailed support of each UML and SysML entities, the concept of component instance needs to be clarified.

A component instance represents a unique representation of a component. A component instance exists each time the component appears in a model based on the multiple properties that reference it or its parents recursively.

A component instance is uniquely represented by a name composed with the name of the parent’s instances.

For example, if the component A is referenced by a property a in a parent IBD B itself referenced by a property b in a root IBD C, the corresponding name for the instance of A will be C_b_a.

Flow Port

A flow port is a SysML object used to consume a data or provide a data. This is an element contributing to the interface definition of a SysML block. A communication API is expected to be generated for each flow port in the context of each component instance.

BUFFERS DECLARATION SECTION

For each flow port with a OUT direction, a buffer variable is generated with the type referenced by the flow port as following: from_<instance_name>_<port>_data;

For each flow port with a IN direction that is not connected to any flow port with a OUT direction, a buffer variable is generated with the type referenced by the flow port as following: from_UNCONNECTED_<port>_data;

    /* @generated_from _19_0_3_16600ad_1651051212713_567116_42036 */
    /* @generated_from _2022x_16600ad_1671186992420_842512_17171 */
    /* @generated_from _19_0_3_16600ad_1651051504899_846935_42372 */
    myBoolean from_i2_OUT_data;

Example: Buffer variable declaration

COMMUNICATION FUNCTIONS IMPLEMENTATION

For each flow port with an IN direction of a component instance, a communication API is generated with the prefix Cse_Read_.

For each flow port with a OUT direction of a component instance, a communication API is generated with the prefix Cse_Write_.

Communication function is declared as a static function with the following naming convention: <prefix><component_inst_name>_<port_name>_data

Communication function parameter is a pointer to the type of the flow property.

Read function

Read function body starts with calling the Start hook function.

Read function copies the data contained in the buffer variable to the data variable provided as a parameter.

Read function finishes with calling the Return hook function. (NOT SUPPORTED YET)

/**********************************************************************
 * Function to read data value on IN port
 * @generated_from _19_0_3_16600ad_1651049381870_524563_41980
 * @generated_from _19_0_3_16600ad_1651047151880_632775_41875
 **********************************************************************/
static void Cse_Read_c1_IN_data(myInt* data){
    unsigned int byteIdx;

    Cse_ReadHook_c1_IN_data_Start(data);
    for(byteIdx=0; byteIdx < sizeof(myInt); byteIdx++){
        ((char*) data)[byteIdx] = ((char*) &pc1->from_UNCONNECTED_IN_data)[byteIdx];
    }
    Cse_ReadHook_c1_IN_data_Return(&pc1->from_UNCONNECTED_IN_data);
}

Example: Read communication function

Write function

Write function body starts with calling the Start hook function.

Write function copies the data contained in the data variable provided as a parameter to the buffer variable.

Write function finishes with calling the Return hook function.

/**********************************************************************
 * Function to send data value on OUT port
 * @generated_from _19_0_3_16600ad_1651047431103_271450_41909
 * @generated_from _19_0_3_16600ad_1651047151880_632775_41875
 **********************************************************************/
static void Cse_Write_c1_OUT_data(myInt* data){
    Cse_WriteHook_c1_OUT_data_Start(data);

    for(unsigned int byteIdx=0; byteIdx < sizeof(myInt); byteIdx++){
        ((char*) &pc1->from_UNCONNECTED_OUT_data)[byteIdx] = ((char*) data)[byteIdx];
    }

    Cse_WriteHook_c1_OUT_data_Return(data);
}

Example: Write communication function

HOOKS DECLARATION SECTION

Prefix of hook functions is Cse_ReadHook_ for flow port with an IN direction.

Prefix of hook functions is Cse_WriteHook_ for flow port with a OUT direction.

A hook function with the suffix Start is generated.

A hook function with the suffix Return is generated.

Hook function is declared as follows: <prefix><component_inst_name>_<port_name>_data_<suffix>

Hook function parameter is a pointer to the type of the flow property.

void Cse_ReadHook_UC1_p2_p4_data_Start(Integer* pData)

Example: Hook declaration

Start and Return hook functions are declared for each flow port. These functions are generated for each instance of the component.

#if defined(Cse_ReadHook_UC1_p2_p4_data)
#undef ReadHook_UC1_p2_p4_prop3
extern void Cse_ReadHook_UC1_p2_p4_data_Start(Integer* pData);
extern void Cse_ReadHook_UC1_p2_p4_data_Return(Integer* pData);
#else
#define Cse_ReadHook_UC1_p2_p4_data_Start(value)  ((void) (0))
#define Cse_ReadHook_UC1_p2_p4_data_Return(value)  ((void) (0))
#endif /* ReadHook_UC1_p2_p4_data */

Example: Start and Return hooks declaration

HOOKS ACTIVATION SECTION

Hooks are activated by a macro declared as follows: <prefix><component_inst_name>_<port_name>_data

HOOKS SKELETON SECTION

Start and Return hook function skeletons are generated for each property part of an interface and referenced by a port. These functions are generated for each instance of the component.

/**
 * Function Cse_ReadHook_UC1_p2_p4_data_Start
 * Start Hook to be overwritten to read prop3 value on p4 port
 * @generated_from <UUID>
 * @generated_from <UUID>
*/
void Cse_ReadHook_UC1_p2_p4_data_Start(Integer* pData){
    /* BEG_USER_CODE(<UUID>) do not remove */
    /* Add your includes here */
    /* END_USER_CODE(<UUID>) do not remove */
}

/**
 * Function Cse_ReadHook_UC1_p2_p4_data_Return
 * Return Hook to be overwritten to read prop3 value on p4 port
 * @generated_from <UUID>
 * @generated_from <UUID>
*/
void Cse_ReadHook_UC1_p2_p4_data_Return(Integer* pData){
    /* BEG_USER_CODE(<UUID>) do not remove */
    /* Add your includes here */
    /* END_USER_CODE(<UUID>) do not remove */
}

Example: Start and Return Hooks skeleton

Proxy Port/Interface Block/Flow Property and Port/Interface/Property

Proxy Port/Interface Block/Flow Property and Port/Interface/Property are grouped into one section because they are supported in the same way.

Proxy Port, Interface Block, Flow Property are SysML objects.

Port, Interface, Property are UML objects.

SysML: A proxy port is a SysML object used to consume a data or provide a data. This is an element contributing to the interface definition of a SysML block. A proxy port references an interface block that contains elements transmitted through the proxy port referencing this interface.

UML: A port is a UML object used to exchange data. This is an element contributing to the interface definition of an UML class. A port references an interface that contains elements transmitted through the port referencing this interface.

A communication API is expected to be generated for each flow property / property contained in an interface block / interface referenced by a proxy port / port in the context of each component instance.

BUFFERS DECLARATION SECTION

For each flow property / property with a direction OUT in an Interface block / interface referenced (NOT conjugated) by a proxy port / port in the context of each component instance, a buffer variable is generated with the type referenced by the flow property / property: from_<instance_name>_<port>_<property_name>;

For each flow property / property with a direction IN in an Interface block / interface referenced (conjugated) by a proxy port / port in the context of each component instance, a buffer variable is generated with the type referenced by the flow property / property: from_<instance_name>_<port>_<property_name>;

For each flow property / property with a direction IN in an Interface block / interface referenced (NOT conjugated) by a proxy port / port in the context of each component instance that is not connected to any data provider, a buffer variable is generated with the type referenced by the flow property / property: from_UNCONNECTED_<port>_<property_name>;

For each flow property / property with a direction OUT in an Interface block / interface referenced (conjugated) by a proxy port / port in the context of each component instance that is not connected to any data provider, a buffer variable is generated with the type referenced by the flow property / property: from_UNCONNECTED_<port>_<property_name>;

    /* @generated_from _19_0_3_16600ad_1651051212713_567116_42036 */
    /* @generated_from _2022x_16600ad_1671186992420_842512_17171 */
    /* @generated_from _19_0_3_16600ad_1651051504899_846935_42372 */
    myBoolean from_i2_OUT_data2;

Example: Buffer variable declaration

COMMUNICATION FUNCTIONS IMPLEMENTATION

For each flow property contained in an interface block referenced by a proxy port of a component instance, a communication API (static function) is generated with the prefix Cse_Read_ for flow property with a direction IN as following: Cse_Read_<component_inst_name>_<port_name>_<flow_property_name>

For each flow property contained in an interface block referenced by a proxy port of a component instance, a communication API (static function) is generated with the prefix Cse_Write_ for flow property with a direction OUT as following: Cse_Write_<component_inst_name>_<port_name>_<flow_property_name>

Communication function parameter is a pointer to the type of the flow property.

Read function

Read function body starts with calling the Start hook function.

Read function copies the data contained in the buffer variable to the data variable provided as a parameter.

Read function finishes with calling the Return hook function. (NOT SUPPORTED YET)

/**********************************************************************
 * Function to read data value on IN port
 * @generated_from _19_0_3_16600ad_1651049381870_524563_41980
 * @generated_from _19_0_3_16600ad_1651047151880_632775_41875
 **********************************************************************/
static void Cse_Read_c1_IN_flow(myInt* data){
    unsigned int byteIdx;

    Cse_ReadHook_c1_IN_flow_Start(data);
    for(byteIdx=0; byteIdx < sizeof(myInt); byteIdx++){
        ((char*) data)[byteIdx] = ((char*) &pc1->from_UNCONNECTED_IN_data)[byteIdx];
    }
    Cse_ReadHook_c1_IN_flow_Return(&pc1->from_UNCONNECTED_IN_data);
}

Example: Read communication function

Write function

Write function body starts with calling the Start hook function.

Write function copies the data contained in the data variable provided as a parameter to the buffer variable.

Write function finishes with calling the Return hook function.

/**********************************************************************
 * Function to send data value on OUT port
 * @generated_from _19_0_3_16600ad_1651047431103_271450_41909
 * @generated_from _19_0_3_16600ad_1651047151880_632775_41875
 **********************************************************************/
static void Cse_Write_c1_OUT_flow(myInt* data){
    Cse_WriteHook_c1_OUT_flow_Start(data);

    for(unsigned int byteIdx=0; byteIdx < sizeof(myInt); byteIdx++){
        ((char*) &pc1->from_UNCONNECTED_OUT_data)[byteIdx] = ((char*) data)[byteIdx];
    }

    Cse_WriteHook_c1_OUT_flow_Return(data);
}

Example: Write communication function

HOOKS DECLARATION SECTION

Prefix of hook functions is Cse_ReadHook_ for flow properties with a direction IN and Interface Block is directly referenced or direction is OUT and Interface is conjugated when referenced.

Prefix of hook functions is Cse_WriteHook_ for flow properties with a direction OUT and Interface Block is directly referenced or direction is IN and Interface is conjugated when referenced.

A hook function with the suffix Start is generated.

A hook function with the suffix Return is generated.

Hook function is declared as follows: <prefix><component_inst_name>_<port_name>_<flow_property_name><suffix>

Hook function parameter is a pointer to the type of the flow property.

void Cse_ReadHook_UC1_p2_p4_prop3_Start(Integer* pData)

Example: Hook declaration

Start and Return hook functions are declared for each flow property contained in an interface block referenced by a proxy port. These functions are generated for each instance of the component.

#if defined(Cse_ReadHook_UC1_p2_p4_prop3)
#undef ReadHook_UC1_p2_p4_prop3
extern void Cse_ReadHook_UC1_p2_p4_prop3_Start(Integer* pData);
extern void Cse_ReadHook_UC1_p2_p4_prop3_Return(Integer* pData);
#else
#define Cse_ReadHook_UC1_p2_p4_prop3_Start(value)  ((void) (0))
#define Cse_ReadHook_UC1_p2_p4_prop3_Return(value)  ((void) (0))
#endif /* ReadHook_UC1_p2_p4_prop3 */

Example: Start and Return hooks declaration

HOOKS ACTIVATION SECTION

Hooks are activated by macro declared as follows: <prefix><component_inst_name>_<port_name>_<flow_property_name>

HOOKS SKELETON SECTION

Start and Return hook function skeletons are generated for each property part of an interface and referenced by a port. These functions are generated for each instance of the component.

/**
 * Function Cse_ReadHook_UC1_p2_p4_prop3_Start
 * Start Hook to be overwritten to read prop3 value on p4 port
 * @generated_from <UUID>
 * @generated_from <UUID>
*/
void Cse_ReadHook_UC1_p2_p4_prop3_Start(Integer* pData){
    /* BEG_USER_CODE(<UUID>) do not remove */
    /* Add your includes here */
    /* END_USER_CODE(<UUID>) do not remove */
}

/**
 * Function Cse_ReadHook_UC1_p2_p4_prop3_Return
 * Return Hook to be overwritten to read prop3 value on p4 port
 * @generated_from <UUID>
 * @generated_from <UUID>
*/
void Cse_ReadHook_UC1_p2_p4_prop3_Return(Integer* pData){
    /* BEG_USER_CODE(<UUID>) do not remove */
    /* Add your includes here */
    /* END_USER_CODE(<UUID>) do not remove */
}

Example: Start and Return Hooks skeleton

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:

  • Statemachine: The signal is referenced by a SignalEvent in a Trigger in a Transition,
  • Activity: The signal is referenced by a SignalEvent in a Trigger of an AcceptEventAction.

A signal is considered as an output Signal according to the following rule:

  • Activity: The signal is referenced by a SendSignalAction.

A signal is considered as an output external Signal when it satisfies both rules:

  • This signal satisfies the criteria for an output signal
  • This signal does not satisfy the criteria for an input signal.

A signal is considered as an input external Signal when it satisfies both rules:

  • This signal satisfies the criteria for an input signal.
  • This signal does not satisfy the criteria of an output signal. It is fired by a behavior belonging to another class.

A signal is transmitted through a UML Port or a SysML Port as soon as it is an external signal. In the following section, port can be replaced by UML Port or SysML Proxy Port.

BUFFERS DECLARATION SECTION

For each input external signal transmitted through a Port in the context of each component instance, a buffer variable is generated with the type referenced by the flow property / property: SignalEvent_<signal_name>_type to_<instance_name>_<port>_<signal_name>;

For each output external signal transmitted through a Port in the context of each component instance that is not connected to any signal consumer, a buffer variable is generated with a specific type generated: SignalEvent_<signal_name>_type to_UNCONNECTED_<port>_<signal_name>;

    /* @generated_from _19_0_3_16600ad_1651051212713_567116_42036 */
    /* @generated_from _2022x_16600ad_1671186992420_842512_17171 */
    /* @generated_from _19_0_3_16600ad_1651051504899_846935_42372 */
    SignalEvent_Signal_type to_i2_OUT_Signal;

Example: Buffer variable declaration

COMMUNICATION FUNCTIONS IMPLEMENTATION

A Cse_Read static function is declared for each input external Signals transmitted through a Port in the context of each component instance as following: Cse_Read_<component_inst_name>_<port_name>_<signal_name>

A Cse_Trigger static function is declared for each output external Signal transmitted through a Port in the context of each component instance as following: Cse_Trigger_<component_inst_name>_<port_name>_<signal_name>

Communication function as a parameter if the signal contains properties. This parameter is a pointer to a structure containing a variable for each property.

Read function

Read function body starts with calling the Start hook function.

Read function copies the data contained in the buffer variable to the data variable provided as a parameter.

Read function resets the trigger of buffer variable, which means that the signal as been consumed.

Read function finishes with calling the Return hook function.

/**********************************************************************
 * Function to read Signal value on input port
 * @generated_from _19_0_3_16600ad_1654593351733_128986_42726
 * @generated_from _2021x_2_16600ad_1654616863603_741017_18059
 **********************************************************************/
static void Cse_Read_Model_inst1_input_Signal(SignalEvent_Signal_type* data){
    unsigned int byteIdx;

    Cse_ReadHook_Model_inst1_input_Signal_Start(data);
    for(byteIdx=0; byteIdx < sizeof(SignalEvent_Signal_type); byteIdx++){
        ((char*) data)[byteIdx] = ((char*) &pModel->to_inst1_input_Signal)[byteIdx];
    }
    pModel->to_inst1_input_Signal.trigger = false;
    Cse_ReadHook_Model_inst1_input_Signal_Return(data);
}

Example: Read communication function

Trigger function

Trigger function body starts with declaring a trigger variable.

If signal contains a property, data transmitted as parameter is copied in the trigger variable.

Trigger function body calls the Start hook function.

For each port reading this signal, the trigger function copies the trigger variable to a dedicated buffer variable.

Write function finishes with calling the Return hook function.

/**********************************************************************
 * Function to Trigger Signal on output port
 * @generated_from _19_0_3_16600ad_1654593483063_231459_42802
 * @generated_from _2021x_2_16600ad_1654616863603_741017_18059
 **********************************************************************/
static void Cse_Trigger_Model_inst1_output_Signal(Signal* data){
    SignalEvent_Signal_type trigger;
    trigger.trigger = 1;
    for(unsigned int byteIdx=0; byteIdx < sizeof(*data); byteIdx++){
        ((char*) &trigger.data)[byteIdx] = ((char*) data)[byteIdx];
    }

    Cse_TriggerHook_Model_inst1_output_Signal_Start(&trigger);
    for(unsigned int byteIdx=0; byteIdx < sizeof(SignalEvent_Signal_type); byteIdx++){
        ((char*) &pModel->to_inst2_input_Signal)[byteIdx] = ((char*) &trigger)[byteIdx];
    }
    Cse_TriggerHook_Model_inst1_output_Signal_Return(&trigger);
}

Example: Trigger communication function

HOOKS DECLARATION SECTION

Prefix of hook functions is Cse_ReadHook_ for required ports receiving a signal.

Prefix of hook functions is Cse_TriggerHook_ for provided ports transmitting a signal.

A hook function with the suffix Start is generated.

A hook function with the suffix Return is generated.

Hook function is declared as follows: <prefix><component_inst_name>_<port_name>_<signal_name><suffix>

Hook function parameter is a pointer to the type used to describe the signal named SignalEvent_<signal_name>_type.

void Cse_ReadHook_Model_inst1_input_Signal_Start(SignalEvent_Signal_type* pData)

Example: Hook declaration

See [5] for more information on signal datatype.

Start and Return hook functions are declared for each signal, which are transmitted or received by a port. These functions are generated for each instance of the component.

#if defined(Cse_ReadHook_Model_inst1_input_Signal)
#undef ReadHook_Model_inst1_input_Signal
extern void Cse_ReadHook_Model_inst1_input_Signal_Start(SignalEvent_Signal_type* pData);
extern void Cse_ReadHook_Model_inst1_input_Signal_Return(SignalEvent_Signal_type* pData);
#else
#define Cse_ReadHook_Model_inst1_input_Signal_Start(value)  ((void) (0))
#define Cse_ReadHook_Model_inst1_input_Signal_Return(value)  ((void) (0))
#endif /* ReadHook_Model_inst1_input_Signal */

Example: Start and Return hooks declaration

HOOKS ACTIVATION SECTION

Hooks are activated by macro declared as follows: <prefix><component_inst_name>_<port_name>_<signal_name>

HOOKS SKELETON SECTION

Start and Return hook function skeletons are generated for each signal that are transmitted or received by a port. These functions are generated for each instance of the component.

/**
 * Function Cse_ReadHook_Model_inst1_input_Signal_Start
 * Start Hook to be overwritten to read Signal value on input port
 * @generated_from <UUID>
 * @generated_from <UUID>
*/
void Cse_ReadHook_Model_inst1_input_Signal_Start(SignalEvent_Signal_type* to_Model_inst1_input_Signal){
    /* BEG_USER_CODE(<UUID>) do not remove */
    /* Add your includes here */
    /* END_USER_CODE(<UUID>) do not remove */
}

/**
 * Function Cse_ReadHook_Model_inst1_input_Signal_Return
 * Return Hook to be overwritten to read Signal value on input port
 * @generated_from <UUID>
 * @generated_from <UUID>
*/
void Cse_ReadHook_Model_inst1_input_Signal_Return(SignalEvent_Signal_type* to_Model_inst1_input_Signal){
    /* BEG_USER_CODE(<UUID>) do not remove */
    /* Add your includes here */
    /* END_USER_CODE(<UUID>) do not remove */
}

Example: Start and Return Hooks skeleton

Proxy Port/Interface Block/Operation and Port/Interface/Operation

Proxy Port/Interface Block/Operation and Port/Interface/Operation are grouped into one section because they are supported in the same way.

Proxy Port, Interface Block, Operation are used in a context of a model designed in SysML.

Port, Interface, Operation are UML objects used in a context of a model designed in UML.

SysML: A proxy port is a SysML object used to consume a data or provide a data. This is an element contributing to the interface definition of a SysML block. A proxy port references an interface block that contains which can contain operations. These operations can be called by a client or implemented by a server depending.

UML: A port is a UML object used to exchange data. This is an element contributing to the interface definition of an UML class. A port references an interface that can contain operations. These operations can be called by a client or implemented by a server depending.

In SysML, a client is a block containing a proxy port referencing an interface block with an output direction (it contains at least a flow property with the IN direction or it contains at least a flow property with the OUT direction and interface is conjugated).

In UML, a client is a class containing a port referencing a required interface containing operations and with a required role.

Provided and required interfaces

A communication API is expected to be for each client operation in the context of each component instance.

COMMUNCATION FUNCTIONS IMPLEMENTATION

For each operation defined on the client side of a component instance, a communication API is generated with the prefix Cse_Call_.

Communication function is declared as a static function with the following naming convention: Cse_Call_<component_inst_name>_<port_name>_<operation_name>

Communication function parameters are the parameter of the UML operation.

Function body starts with calling the Start hook function. (NOT SUPPORTED YET)

Function calls the server operation implemented on the server side.

Read function finishes with calling the Return hook function. (NOT SUPPORTED YET)

/**********************************************************************
 * Function to call server myOp operation on IN port
 * @generated_from _19_0_3_16600ad_1651051325597_240913_42076
 * @generated_from _2022x_16600ad_1671186267445_105670_17070
 **********************************************************************/
static void Cse_Call_Controller_i2_IN_myOp(myInt* data, myReal* data1, myBoolean* data2){
    Cse_CallHook_Controller_i2_IN_myOp_Start(data, data1, data2);
    server_myOp(&pController->i1, data, data1, data2);
    Cse_CallHook_Controller_i2_IN_myOp_Return(data, data1, data2);
}

Example: Client operation implementation

HOOKS DECLARATION SECTION

NOT SUPPORTED YET

HOOKS ACTIVATION SECTION

NOT SUPPORTED YET

HOOKS SKELETON SECTION

NOT SUPPORTED YET

Class

If the root objects selected by the user contain Classes (or SysML block), instances must be automatically computed from relations between classes.

Class Diagram

Instances are computed based on the following mechanism:

Instances are computed based on the following rules:

No instance is created for an interface, an abstract class or a global class.

An instance is created for each root class with the name “<class name>_inst".

If a class contains an aggregation relation to another class, an instance is created for the target class with the name of the aggregation end point.

If a class contains an association relation to another class, an instance is created for the target class with the name of the association end point.

INCLUDES

An #include to file <ClassName>.h is generated for computed instance to access to the definition of the associated class.

INSTANCES DECLARATION SECTION

See INSTANCES DECLARATION SECTION of chapter Instance Specification.

INSTANCES STATIC ALLOCATION SECTION

See INSTANCES STATIC ALLOCATION SECTION of chapter Instance Specification.

INSTANCES DYNAMIC ALLOCATION SECTION

See INSTANCES DYNAMIC ALLOCATION SECTION of chapter Instance Specification.

Instance Specification

If the root objects selected by the user contain Instance Specifications, these elements are used for variables declaration.

Instance specification

Instance specifications can be connected through links that represent an instantiation of a relation. A relation can be an aggregation or an association.

Depending on relation cardinalities, instances can be declared as a single variable or an array of instances.

INCLUDES

An #include to file <ClassName>.h is generated for each instance to access to the definition of the associated class.

INSTANCES DECLARATION SECTION

If the objects_allocation parameter is defined as Static, and if no relation targeting this instance has a cardinality higher than 1, a static variable is generated with the name of the instance specification element.

If the objects_allocation parameter is defined as Static and if a relation targeting this instance has a cardinality higher than 1, a static variable is generated as an array of instances with the name of the instance specification element.

If no relation targeting this instance has a cardinality higher than 1, a pointer to variable representing the instance is generated with the name of the instance specification element prefix with p.

If a relation targeting this instance has a cardinality higher than 1, an array of pointers to variable representing the instance is generated with the name of the instance specification element prefix with p.

If the objects_allocation parameter is defined as Static, the pointer must point to the address of the static variable.

Add AddUserInstance; /* Allocate variable (option: objects_allocation:Static) */
Add* pAddUserInstance = &AddUserInstance;
Model ModelUserInstance; /* Allocate variable (option: objects_allocation:Static) */
Model* pModelUserInstance = &ModelUserInstance;

Example: Unique instance pointer with statically allocated variable

INSTANCE STATIC ALLOCATION SECTION

If the Objects Allocation option is defined as Static and if Memory Optimization is defined as Prefer ROM, const part of structures are statically allocated and initialized.

Each class member defined with the isReadOnly attribute set to true is configured statically.

Default value redefined at instance level of class member defined with the isReadOnly attribute set to true is configured statically.

extern A_vtable A_vt;
const A_const A_inst_const = {
    .vtable = &A_vt,
    .varPart = &A_inst,
    .dtor = &A_dtor,
    .b = &b,
};

Example: Static allocation of the const structure

INSTANCE DYNAMIC ALLOCATION SECTION

If the objects_allocation parameter is defined as Dynamic, for each instance, function Cse_component_instances_init() allocates the memory to the pointer of the instance using tal_allocate() function.

For each instance, function Cse_component_instances_init() initializes the memory through the memset function.

For each instance, function Cse_component_instances_init() calls the constructor implemented by the corresponding class <ClassName>.

    pModel = tal_allocate(sizeof(Model)); /* Allocate variable (option: objects_allocation:Dynamic) */


    /* Erase memory section for Behaviors proper implementation */
    memset(pModel, 0, sizeof(Model));

    /* Call the constructor to initialize relations */
    Model_ctor(pModel);

Example: Instance initialization with dynamic allocation for unique instance

For each instance, if the cardinality of the relation end is higher than 1, the initialization mechanism is encapsulated into a for loop.

   for(int i = 0; i<5; i++){
      pModel[i] = tal_allocate(sizeof(Model)); /* Allocate variable (option: objects_allocation:Dynamic) */
      memset(pModel[i], 0, sizeof(Model)); /* Erase memory section for Behaviors proper implementation */
      Model_ctor(pModel[i]); /*Call the constructor to initialize relations*/
   }

Example: Instance initialization with dynamic allocation for instance with a size above 1

For each association relation connecting classes, depending on the cardinality of the association end roles, instance of the classes must be assigned. This assignment is generated in function Cse_component_relations_init().

    pmyButton->myBL = pmyController;

Example: Association configuration for unique instance

For each association relation connecting classes, if the cardinality of the relation end is higher than 1, the initialization mechanism is encapsulated into a for loop.

   for(int i = 0; i < 5; i++){
      pmyButton->myBL[i] = pmyController[i];
   }

Example: Instance initialization with dynamic allocation for instance with a size above 1