Enumerations

As a database/workspace item, an enumeration type (symbol ) defines a sequence of text strings and values in a specific order. One pair of value and text string is called enumerator.

The values are integer numbers. By default, the values are non-negative, consecutive integer numbers, but you can edit the values and insert negative and/or non-consecutive values. In the Enumeration view of the component manager, the enumerators are sorted by increasing values.

Note

Enumerations and enumeration types with non-consecutive and/or negative values in AMD/AXL format can only be exported with AMD format V6.2.* or higher. AMD format version V6.1.4 or lower will produce an error.

In an AUTOSAR context, enumerations are used to specify texttables.

As elements in components, enumerations use the type symbol. In the block diagram, enumeration variables have one argument pin for setting a new value (if their value can be set), and one return pin for reading the current value. Enumeration parameters have no argument pin. The icon inside the block represents the kind of the enumeration element:

Since ASCET V6.4.5, you can use the same enumerator name in several enumeration types. However, the combination of enumeration name and enumerator name must be unique. Ambiguous enumerators need the enumeration name as a qualifier; they are addressed via <enumeration_name>.<enumerator_name>. This is also true for enumeration types that use AUTOSAR error codes as enumerator names.

If you specify an unqualified enumerator, i.e. you use only <enumerator_name>, ASCET checks if <enumerator_name> is unique in your project. If it is not, a warning WMdl942 is issued during code generation if a plausible disambiguation can be found. If there is no plausible disambiguation, an error MMdl192 is issued.

The way enumerations appear in generated C code is determined by the Generation of Enums project option. See the option description in Code Generation Node for details.

Enumerations based on different enumeration types are not compatible with each other, even if they contain the same enumerators. They cannot be assigned, Closedcompared, etc. If you try, an error MMdl6 is issued during code generation.

Enumeration values are implicitly converted to a limitInt type, if necessary, e.g., when assigned to an arithmetic element, compared to an arithmetic value, calculated together with an arithmetic value, etc. The exception to this rule is the Std_ReturnType, which is never implicitly converted to an arithmetic value.

An enumeration value may be explicitly converted to an arithmetic value. This is also allowed for the Std_ReturnType.

conversion method

block diagrams

ESDL components

implementation casts

yes

yes

(see Implementation Casts)

conversion operators

yes

(see Conversion Operator)

yes

(see Conversion Operations)

function convertToNumerical

no

yes

See also

Creating an Enumeration

Adding an Enumerator

Editing an Enumerator

Selecting an Enumerator, Error Code, or Mode

Inserting an Enumeration (Block diagrams)

Inserting an Enumeration (AUTOSAR SWC)

Kind of Elements

AMD/AXL Export

Special Features of the ARXML Import

Code Generation Node