The Art Language - State Machine - Transition - Frequent Transition
Sometimes you may have a state where one or a few outgoing transitions can be expected to execute much more frequently than others. You can then set a frequent
property on the transition trigger that you expect will trigger the transition frequently. The Art compiler uses this information to optimize generated C++ code so that such transition triggers are evaluated before other triggers that are expected to trigger the transition less frequently.
interrupted: Working -> Stopped on [[rt::properties(
frequent=true
)]] external.interrupt
`
// Interrupted while working...
`;
!!! note The frequent property relies on optimization features in the C++ compiler that may or may not be available depending on which target compiler that is used. Only use frequent transitions if profiling has shown that you have a need to do this optimization.
======================================================== The Art Language - Property
Triggers for which this property is true
will lead to generated code that handles these triggers faster than other triggers. This is done by placing their if-statements early in the rtsBehavior
function to ensure that as little code as possible needs to execute when dispatching a message for a frequent trigger.
| Capsule, Class | generate_file_header | Boolean | true | Capsule, Class | generate_file_impl | Boolean | true | Capsule, Class, Protocol, Port,
| Class, Protocol | version | Integer | 0 | Class | generate_descriptor | Enumeration (true, false, manual) | true | Class | kind | Enumeration (_class, struct, union) | _class | Class | generate_class | Boolean | true | Class | generate_statemachine | Boolean | true | Class | const_target_param_for_decode | Boolean | false | Class | default_constructor_generate | Boolean | true | Class | default_constructor_explicit | Boolean | false | Class | default_constructor_inline | Boolean | false | Class | default_constructor_default | Boolean | false | Class | default_constructor_delete | Boolean | false | Class | default_constructor_visibility |
By default a capsule or class is translated to one header file (.h
) and one implementation file (.cpp
). Set this property to false
to prevent generation of the header file, for example if you prefer to write it manually.
By default a capsule or class is translated to one header file (.h
) and one implementation file (.cpp
). Set this property to false
to prevent generation of the implementation file, for example if you prefer to write it manually.
By default a type descriptor will be generated for each class. The TargetRTS uses the type descriptor to know how to initialize, copy, move, destroy, encode or decode an instance of that class. Set this property to false
for classes that don't need a type descriptor. Set it to manual
if the class needs a type descriptor but you want to implement it manually rather than using the implementation that is generated by default. Note that even if you set this property to true
so that a default type descriptor is generated, you can still override individual type descriptor functions for the class.
By default a class is translated to a C++ class. You can use this property to instead translate it to a struct
or union
.
If set to false
no C++ code will be generated for the class.
If set to false
code generation for the class' state machine will be suppressed. You can use this if the state machine is informal, and you prefer to implement it manually in another way.
By default a decode function uses a non-const target
parameter. This is because usually a decode implementation must call non-const functions on the decoded object to populate it with data from the decoding. However, if it doesn't need to call such functions you can set this property so that the target
parameter is declared as const.
If set to false
a default (i.e. parameterless) constructor will not be generated for the class.
If set to true
the default (i.e. parameterless) constructor will be declared as explicit.
If set to true
the default (i.e. parameterless) constructor will be declared as inline. It's implementation will then be generated into the header file.
If set to true
the default (i.e. parameterless) constructor will be declared as defaulted. This tells the compiler to synthesize a default constructor even if one normally would not be synthesized (for example because there is a user-defined constructor with parameters).
If set to true
the default (i.e. parameterless) constructor will be declared as deleted. This will cause the compiler to generate an error if it is invoked. This can be used for preventing objects of the class to be created.
This property can be used for setting the visibility of the default (i.e. parameterless) constructor. By default it will be public
but you can change it either to protected
or private
.