The transformation transforms UML attributes into C++ attributes, and uses the following UML properties:
Property |
C++ |
Name |
Creates a new member variable with the specified name (removes illegal characters) |
Visibility |
Determines the visibility of the generated attribute |
Type |
Generates the member with the specified type |
IsStatic |
Generates the attribute with class instead of instance scope |
defaultValue |
Becomes the initial value of the attribute. The transformation uses the default value you supplied without alterations. If default value has be in quotes in C++ code, be sure to include quotes in the UML default value. |
Optionally, you can apply the cpp_type stereotype to a UML attribute. The transformation processes the stereotype's "qualifier" property in the same way as the UML property.
If you set the InitializerKind attribute of cpp_type to "assignment", or do not specify it, the attribute uses an assignment operator (for example, "MyAttribute = 3") in static definitions. If you set the attribute to "constructor", the transformation invokes the attribute's constructor to create the attribute's value (for example, "MyAttribute(3)") in static definitions.
The transformation adds data types that are used by class attributes to the class inclusion list.