Skip to content

Instantiation

Embedded Engineer, when using AnsiC, will generate for each Class a Class struct containing all private Attributes and the StateMachine structs to pose as a type for "instantiation".

This Class and StateMachine struct can be used to generate multiple "instances". Either by creating a variable/pointer to the struct or by modelling it.

To access this Class struct Embedded Engineer will generate a "statically allocated instance" field and a function giving access to this field returning the so called: me-pointer.

This me-pointer needs to be consequently passed to all Operations and Operation calls modelled in the Class to allow access of the Classes Attributes stored in the generated Class struct.

For each StateMachine generated we also need access to its "instance". Therefore each StateMachine Operation not only contains a me-pointer but also a stm-pointer.

To allow for more flexibility for the developer we added new Model Settings to manipulate the generation of the:

  • "statically allocated instance"
  • function giving access to the me-pointer
  • Class Operations parameters
    • me-pointer
    • stm-pointer

AnsiC class instantiation strategy

Gives the developer the power to influence the generation of the "statically allocated instance" and the me-pointer access function.

Possible settings are:

  • CreateInstanceAndFunction The statically allocated instance and accessing function for the current class will be generated
  • CreateStaticInstance The statically allocated instance for the current class will be generated. The me-pointer access function will be skipped.
  • CreateNothing Will skip the generation for the statically allocated instance and the me-pointer access function

Info

Default value: CreateInstanceAndFunction

Single Class instance mode

If set will omit the generation of the me-pointer parameter and will instead access the "statically allocated instance" directly in each function in need of a me-pointer.

Warning

Possible conflicting Model Settings

Possible conflicting model settings might occur if Single Class instance mode is enabled and AnciC class instantiation strategy is set to Create Nothing

Behavior either needs a fixed class instance or a class instance parameter for execution.

The Model Settings dialog when saving as well as the Code Generation itself will check these settings.

Single State Machine instance mode

If set will omit the generation of the stm-pointer parameter and will instead access the StateMachine struct directly stored in the me-pointer.

Consider

If set, this setting will hinder you of using Multiple State Machines