EASL Code Generation Macros
Enterprise Architect provides a number of Enterprise Architect Simulation Library (EASL) code generation macros to generate code from behavioral models. These are:
- EASL_INIT
- EASL_GET
- EASLList and
- EASL_END
EASL_INIT
The EASL_INIT macro is used to initialize an EASL behavior model. The behavior model code generation is dependent on this model.
|
|
|
|
%EASL_INIT(<<GUID>>)%
where:
- <<GUID>> is the GUID of the Object (usually a Class element) that is the owner of the behavior model
|
EASL_GET
The EASL_GET macro is used to retrieve a property or a collection of an EASL object. The EASL objects and the properties and collections for each object are identified in the EASL Collections and EASL Properties topics.
|
|
|
|
$result = %EASL_GET(<<Property>>, <<Owner ID>>, <<Name>>)%
where:
- <<Property>> is one of "Property", "Collection", "At", "Count", or "IndexOf"
- <<OwnerID>> is the ID of the owner object for which the property/collection is to be retrieved
- <<Name>> is the name of the property or Collection being accessed
- $result is the returned value; this is “” if not a valid property
If <<Property>> is:
- "At", then <<OwnerID>> is the ID of a collection and <<Name>> is the index into the collection for which the item is to be retrieved
- "Count", then <<Owner ID>> is the ID of a collection and <<Name>> is not used; it will retrieve the item number in the collection
- "IndexOf", then <<Owner ID>> is the ID of a collection and <<Name>> is the ID of the item in the collection; it will retrieve the index (string format) of the item within the collection
|
|
|
$sPropName = %EASL_GET("Property", $context, "Name")%
|
EASLList
The EASLList macro is used to render each object in an EASL collection using the appropriate template.
|
|
|
|
$result = %EASLList=<<TemplateName>> @separator=<<Separator>>
@indent=<<indent>> @owner=<<OwnedID>>
@collection=<<CollectionName>> @option1=<<OPTION1>>
@option2=<<OPTION2>>......... @optionN=<<OPTIONN>>%
where:
- <<TemplateName>> is the name of any behavioral model template or custom template
- <<Separator>> is a list separator (such as “\n”)
- <<indent>> is any indentation to be applied to the result
- <<OwnedID>> is the ID of the object that contains the required collection
- <<CollectionName>> is the name of the required collection
- <<OPTION1>...<<OPTION99>> are miscellaneous options that might be passed on the template; each option is given as an additional input parameter to the template
- $result is the resultant value; this is “” if not a valid collection
|
|
|
$sStates = %EASLList="State" @separator="\n" @indent="\t"
@owner=$StateMachineGUID @collection="States" @option=$sOption%
|
EASL_END
The EASL_END macro is used to release the EASL behavior model.
Behavioral Model Templates
- Action
- Action Assignment
- Action Break
- Action Call
- Action Create
- Action Destroy
- Action If
- Action Loop
- Action Opaque
- Action Parallel
- Action RaiseEvent
- Action RaiseException
- Action Switch
- Behavior
- Behavior Body
- Behavior Declaration
- Behavior Parameter
- Call Argument
- Decision Action
- Decision Condition
- Decision Logic
- Decision Table
- Guard
- Property Declaration
- Property Notes
- Property Object
- State
- State CallBack
- State Enumerate
- State EnumeratedName
- StateMachine
- StateMachine HistoryVar
- Transition
- Transition Effect
- Trigger
Learn more