Operations and parameters that UML-to-C++ transformations transform

The UML-to-C++ transformation transforms UML operations into C++ methods. The transformation transforms the parameters of the UML operation into arguments of C++ operations.

The following table lists the UML properties of a source model and the corresponding C++ element that the transformation generates.

UML property C++ element
Name Name of the method
Visibility Visibility of the method
IsAbstract Method as a pure virtual method
IsQuery Method as a const. The transformation adds const to the suffix of the operation
IsStatic Method as a static method. The transformation adds the static keyword to the prefix of the operation

The transformation assigns the type of the return parameter to the generated C++ method. If there is no return parameter specified in the model, the transformation assigns a return parameter of type int.

UML parameters

The transformation transforms parameters of UML operations into arguments of C++ operations, in the same order that the parameters appear in the model. The transformation assigns the parameter return type and default value to the generated argument.

To specify multi-dimensional array parameters, you can set the arrayDimensions property in the «cpp_type» stereotype.

You can also specify a string as a qualifier for a parameter. For example, you can specify a pointer operator (*) to specify a pointer type, or you can specify a reference operator (&).

The transformation transforms out or inout direction indicators of parameters into references and adds a reference operator to the type specification in the generated code.

The transformation adds the UML classes that are used by parameters to the forward reference list or inclusion list, depending on whether the parameter has a pointer datatype.


Feedback