Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > C++ code > Generating C++ code > Generating C++ code > Mapping Information > Mapping information for state diagrams > Type Definition mapping for C++ (C++ code)
  
Type Definition mapping for C++ (C++ code)
The Construction property of a Type Definition determines whether a Type Definition is an Array, Enumeration, Sequence or Alias:
For an Alias Type Definition, ACS generates an alias of its data type. Example code
·For an Array Type Definition, ACS generates an array of its data type. The upper and lower bounds properties determine the size of a one dimensional array. Example code
Reverser Notes: When reverse engineering one dimensional arrays, the Lower and Upper Bounds properties record the size of the array. When reverse engineering multi dimensional arrays the size of the array is recorded through the C++ Array Spec tag definition.
For an Enumeration Type Definition, ACS generates an enumeration. The enumeration literals are used as the contents of the generated enumeration. Example code
* 
When a Type Definition is of Enumeration construction, you can apply the «C++ Enumeration» stereotype and mark the Type Definition as anonymous through the C++ Anonymous Item tag definition.
For each Sequence, ACS generates an array of <data type>. The minimum and maximum size properties determine the size of the array. Example code
Reverser Notes: When reverse engineering an array, the Reverser creates a Type Definition of Array construction, even if the array was generated from a Type Definition of Sequence construction.
ACS generates a Type Definition globally, within a namespace or within a class definition:
Globally if the Model or a Package (Folder mapping) owns the Type Definition.
Within a namespace if a Package (Namespace mapping) owns the Type Definition.
Within a class definition if a Class, Interface or Signal owns the Type Definition.
The typedef declaration is derived from the properties of the Type Definition and the tagged values set for Tag Definitions that are applied by the «C++ Typedef» and «C++ Enumeration» stereotypes. Except for the C++ Anonymous Item tag definition, the listed tag definitions are applied by the «C++ Typedef» stereotype.
Child items:
If the Type Definition owns Enumeration Literals (Type Definitions of Enumeration construction only), each Enumeration Literal is generated inside the enumeration declaration. By default, the name of each generated enumeration literal is prefixed with the name of its typedef followed by an underscore. For Enumeration Literal mapping information, see Cpprev enumeration literal mapping for cpp. Example code
Properties:
For information about the Construction property, see the opening text of this topic.
If the Data Type property is set, ACS generates the value as the typedef's data type, unless there is a value set for the C++ Function Pointer Return tag definition, in which case that value is used for the typedef's data type. Example code
If no data type is specified, ACS generates int by default. If you want ACS to generate a different default in the absence of a data type for an Attribute, Parameter or Type Definition, change the default value that is specified in the Cppgen.ini file. Tell me more...
Reverser Notes: When reverse engineering a typedef's data type:
If the data type is modeled in the Model or is going to be reverse engineered to the Model, the Type Definition's Data Type references the appropriate item.
If the data type is not modeled in the Model and is not going to be reverse engineered to the Model, the Type Definition's Data Type is set to the name of the data type (as text).
If the data type is a function pointer, the Type Definition's Data Type is not set and instead the C++ Function Pointer Return and C++ Function Pointer Parameter tag definitions are used to record the data type.
If the Description property has a value, ACS generates the description as a comment on the line before the typedef declaration. Example code
Reverser Notes: When reverse engineering comments, both preceding and inline comments are reverse engineered to the Description property. Tell me more...
The Lower Bound and Upper Bound properties (Type Definitions of Array construction only) are used to calculate the array dimension, unless a value is set for the C++ Array Spec tag definition. If the tagged value of the C++ Array Spec tag definition has been set, the value is used to generate the array dimension and the Lower Bound and Upper Bound properties are ignored. Example code
Array dimension = Upper Bound value - Lower Bound value + 1
Reverser Notes: When reverse engineering one dimensional arrays, the Reverser records the array dimension through the Lower Bound and Upper Bound properties. When reverse engineering multi dimensional arrays, the Reverser records the array dimension through the C++ Array Spec tag definition.
The Minimum Size property (Type Definitions of Sequence construction only) is ignored.
The Maximum Size property (Type Definitions of Sequence construction only) is used to calculate the array dimension, unless a value is set for the C++ Array Spec tag definition. If the tagged value of the C++ Array Spec tag definition has been set, the value is used to generate the array dimension and the Maximum Size property is ignored. Example code
Reverser Notes: When reverse engineering arrays, the Reverser reverse engineers a Type Definition of Array construction, rather than a Type Definition of Sequence construction.
The Name property is generated as the name of the typedef in the code. Example code
* 
ACS may modify the typedef name that is added to the code to make it valid for C++. You can specify the exact typedef name to add to the code through the CODE_GENERATION_NAME property of a Parameter. Tell me more...
If the Pointer property is set to TRUE (Pointer check box selected on Property Pages), an asterisk is generated after the data type. If a value is set for the C++ Indirection tag definition, the Pointer property is ignored. Example code
Reverser Notes: When reverse engineering a typedef that has any indirection, the Pointer property is set to TRUE and the indirection information is recorded through the C++ Indirection tag definition.
If the Visibility property of a Type Definition is set to Public:
For a Type Definition owned by a Class, Data Type or Signal, the typedef is declared as Public in the header file generated for the owning item.
For a Type Definition owned by the Model or a Package, the typedef is declared in the header file generated for the owning Model or Package.
If the Visibility property of a Type Definition is set to Protected or Private:
For a Type Definition owned by a Class, Data Type or Signal, the typedef is declared as Protected or Private in the header file generated for the owning item.
For a Type Definition owned by the Model or a Package, the typedef is declared in the implementation file generated for the owning Model or Package.
Tag Definitions:
If the tagged value of the C++ Actual Template Parameters tag definition has been set, the value is used to generate the text between the angle brackets when the Type Definition's underlying type is a template class. Example code
Reverser Notes: When reverse engineering an alias typedef whose data type is a template class, this tag definition records any actual template parameters.
The C++ Anonymous Item tag definition is applied by the «C++ Enumeration» stereotype and applies only to Type Definitions of Enumeration construction. If the tagged value of the C++ Anonymous Item tag definition is set to TRUE, it means that the enumeration is used as an anonymous type and is generated inline. ACS generates the anonymous enumeration inline. Example code
Reverser Notes: When reverse engineering an enumeration that is used as an anonymous type, the Reverser creates a Type Definition in Modeler and sets its C++ Anonymous Item tag definition to TRUE. The name of the Type Definition is as follows:
unnamed<integer to make unique>
If the tagged value for the C++ Array Spec tag definition has been set, the set value is used as the array. When the C++ Array Spec tag definition has been set, Lower Bound, Upper Bound and Maximum Size property values are ignored. Note that the value must include any brackets. Example code
Reverser Notes: When reverse engineering multi-dimensional arrays, this tag definition records the array (including the square brackets).
If the tagged value of the C++ CV Qualifier tag definition is set to const, volatile or const volatile, the selected keyword is generated before the data type. Example code
If the tagged values of the C++ Function Pointer Parameters and C++ Function Pointer Return tag definitions have been set, other Type Definition properties are ignored. The Type Definition declaration is generated as follows: Example code
typedef <C++ Function Pointer Return> (<C++ Indirection><C++ Name>)(<C++ Function Pointer Parameters>);
If the tagged value of the C++ Indirection tag definition has been set, the value is used as the indirection, that is, the value is generated after the data type and before the type definition name. Example code
If the tagged value of the C++ Linkage tag definition has been set, the value is generated as the linkage. For example, extern "C".
If the tagged value of the C++ Non Membertag definition (applied by «C++ Enumeration» stereotype) is set to TRUE and the Type Definition is scoped to a Class, Interface or Signal, the Type Definition is declared in the owning item's header file but is not a member of the class declaration. This applies only when the Type Definition is scoped by a Class, Interface or Signal. This Tag Definition is ignored when the Type Definition is scoped to a Package. Example code