To specify an enumeration using the facilities provided by MC-3020, use the steps described in the following sections.
Use BridgePoint Builder create your enumeration data types.
MC-3020 supports the specification of a discrete value for each of the enumerators for an enumeration. There are two ways in which the value can be assigned: 1) through the use of a keyword in the description of the enumerator, and 2) through marking. In the absence of any value specified by the user, MC-3020 assigns a default. MC-3020 gives priority to those values specified via marking.
MC-3020 recognizes a special keyword that the analyst places in the description of the enumerator. The keyword can be any one of the following three: Value, value, or VALUE. Note that the keyword is case sensitive so using vaLuE will not work properly. The keyword should be used on a single line as in:
Value: 3
with a colon immediately after the keyword followed by the desired value.
Other examples of usage include:
value: 0x4 Value: 23 VALUE: 0xFFF
The marking function
TagEnumeratorDiscreteValue
can also be used
to specify the value for an enumerator. The marking function
overrides any value specified in the analysis model. See the section called “Specifying Values for Enumerators” for complete
details on this marking option.
Enumerations that are defined within a modeled component can also be used by manually written code.
The name of the header file containing the enumerations for
a component is of the following form: (registered component
name)_enums.h
. For example, the name of the header
file containing the enumerations defined in the microwave component
with registered name M is M_enums.h
. The file
is placed in the system-level include directory
system/gen/include
.
In MC-3020, enumerations translate into simple #defines. Each member (enumerator) of the enumeration is defined to a value. Each enumerator member uses the name of the enumeration as the part of it own name to prevent name collisions between enumerators in different enumerations.
To use the enumerators in a hand-coded C module,
simply include the (component)_enums.h
and use the desired constants defined within.