UML to Real-Time C++ Transformation Reference Guide

This document describes the elements and the structure of the UML to Real-Time C++ Transformation. It will be particularly valuable for developers looking to use the transformation extension mechanisms to create a transformation based on the UML to Real-Time C++ Transformation.

The following sections describe the various transforms that comprise the UML to Real-Time C++ Transformation. Where a transform appears in square brackets it signifies that the transform is not directly contained in the current transform, but rather the target of a content extractor element within the current transform.

UML2CppTransform

UML2CppTransform is the top-level transform.

UML2CppTransform
InitializeRule
[NodeTransform]
TypeResolutionRule
UpdateMarkersRule
UpdateSourceTransform
Identifier com.ibm.xtools.umldt.rt.transform.cpp.UML2CppTransform
Source java.util.List (containing org.eclipse.uml2.uml model, package, class, datatype, and enumeration)
Target Container org.eclipse.core.resources.IContainer (within a project with the C++ nature)
Target com.ibm.xtools.cpp2.model.CPPWorkspace

InitializeRule creates a directed graph from the main transformation configuration and the closure of its prerequisite transformation configurations. The graph is stored in the transform context for use by other elements of the transform.

NodeTransform processes each node of the graph produced by the InitializeRule. A model of the C++ source code is created in memory.

UpdateMarkersRule creates problem markers for issues identified by the NodeTransform and removes markers that no longer apply. The main transformation will terminate if any errors are still present.

UpdateSourceTransform uses the in-memory model of the required C++ source code to create, update or remove files as necessary.

NodeTransform

NodeTransform iterates over the nodes in the graph of transformation configurations. The nodes define groupings of the UML elements: the groupings correspond to components in RoseRT.

NodeTransform
NodeRule
[MainTransform]
Identifier com.ibm.xtools.umldt.rt.transform.cpp.NodeTransform
Source com.ibm.xtools.umldt.rt.transform.internal.model.TransformGraph.Node
Target Container com.ibm.xtools.cpp2.model.CPPWorkspace
Target com.ibm.xtools.cpp2.model.CPPContainer

NodeRule creates the CPPContainer which will receive all the source files for the source node. It also creates the source files that relate to the grouping defined by the transformation configuration. They contain common elements used by all other source files produced for the group and define the necessary elements for use with the TargetRTS framework. For example, a "C++ Executable" node will include code to create the logical to physical thread mapping and provide the RTMain::entryPoint() method.

MainTransform

MainTransform iterates over the UML source elements, building the in-memory C++ model. Of note is the absence of transforms for models or packages; this is because elements of those containers have already been extracted during the production of the transformation configuration graph.

MainTransform
SourceFileRule
CapsuleTransform
ProtocolTransform
PassiveClassifierTransform
SourceFileFinalizationRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.MainTransform
Source org.eclipse.uml2.uml Class, Datatype, or Enumeration
Target Container com.ibm.xtools.cpp2.model.CPPContainer
Target com.ibm.xtools.cpp2.model.CPPSourceFile

SourceFileRule creates the CPPSourceFile that will be populated by one of the following transforms.

At most one of the component transforms will apply.

CapsuleTransform

CapsuleTransform processes classes with the UMLRealTime::Capsule stereotype.

CapsuleTransform
CapsuleRule
CapsuleDescriptorRule
[DependencyTransform]
[GeneralizationTransform]
[PassiveClassifierTransform]
[PartTransform]
[PortTransform]
[PropertyTransform]
[OperationTransform]
[CapsuleStatemachineTransform]
CapsuleStructureTransform
Identifier com.ibm.xtools.umldt.rt.transform.cpp.CapsuleTransform
Source org.eclipse.uml2.uml.Class (with the UMLRealTime::Capsule stereotype)
Target Container com.ibm.xtools.cpp2.model.CPPContainer
Target com.ibm.xtools.cpp2.model.CPPCompositeType

CapsuleRule creates a C++ class.

CapsuleDescriptorRule creates the corresponding descriptor.

The presence of the class, datatype and enumeration transforms here marks an improvement over RoseRT which does not support classifiers nested with capsule classes.

ProtocolTransform

ProtocolTransform processes packages with the UMLRealTime::Protocol stereotype.

ProtocolTransform
ProtocolRule
[DependencyTransform]
[GeneralizationTransform]
Identifier com.ibm.xtools.umldt.rt.transform.cpp.ProtocolTransform
Source org.eclipse.uml2.uml.Package (with the UMLRealTime::Protocol stereotype)
Target Container com.ibm.xtools.cpp2.model.CPPContainer
Target com.ibm.xtools.cpp2.model.CPPCompositeType

ProtocolRule creates a struct with nested "Base" and "Conjugate" classes.

PassiveClassifierTransform

PassiveClassifierTransform processes passive classifiers without the UMLRealTime::Capsule stereotype.

ClassTransform
ClassTransform
DataTypeTransform
EnumerationTransform
Identifier com.ibm.xtools.umldt.rt.transform.cpp.ClassTransform
Source org.eclipse.uml2.uml.Class (without the UMLRealTime::Capsule stereotype)
Target Container com.ibm.xtools.cpp2.model.CPPContainer
Target com.ibm.xtools.cpp2.model.CPPCompositeType

ClassRule creates a C++ class, struct, union or typedef.

ClassDescriptorRule creates the corresponding type descriptor for classes when selected in the UMLRealTime::TargetRTSClassInfo stereotype application.

ClassTransform

ClassTransform processes classes without the UMLRealTime::Capsule stereotype.

ClassTransform
ClassRule
ClassDescriptorRule
[DependencyTransform]
[GeneralizationTransform]
[PassiveClassifierTransform]
[PropertyTransform]
SpecialOperationsRule
[OperationTransform]
[PassiveStatemachineTransform]
Identifier com.ibm.xtools.umldt.rt.transform.cpp.ClassTransform
Source org.eclipse.uml2.uml.Class (without the UMLRealTime::Capsule stereotype)
Target Container com.ibm.xtools.cpp2.model.CPPContainer
Target com.ibm.xtools.cpp2.model.CPPCompositeType

ClassRule creates a C++ class, struct, union or typedef.

ClassDescriptorRule creates the corresponding type descriptor for classes when selected in the UMLRealTime::TargetRTSClassInfo stereotype application.

DataTypeTransform

DataTypeTransform processes datatypes (excluding enumerations).

DataTypeTransform
DataTypeRule
DataTypeDescriptorRule
[DependencyTransform]
[GeneralizationTransform]
[PropertyTransform]
[OperationTransform]
Identifier com.ibm.xtools.umldt.rt.transform.cpp.DataTypeTransform
Source org.eclipse.uml2.uml.DataType
Target Container com.ibm.xtools.cpp2.model.CPPContainer
Target com.ibm.xtools.cpp2.model.CPPCompositeType

DataTypeRule will initially do nothing. Primitive types already have representations in C++.

DataTypeDescriptorRule will initially do nothing. Descriptors for primitive types are provided by the TargetRTS.

EnumerationTransform

EnumerationTransform processes enumerations.

EnumerationTransform
EnumerationRule
EnumerationDescriptorRule
[DependencyTransform]
[GeneralizationTransform]
[EnumerationLiteralTransform]
[PropertyTransform]
[OperationTransform]
Identifier com.ibm.xtools.umldt.rt.transform.cpp.EnumerationTransform
Source org.eclipse.uml2.uml.Enumeration
Target Container com.ibm.xtools.cpp2.model.CPPContainer
Target com.ibm.xtools.cpp2.model.CPPEnum

EnumerationRule creates a C++ enum declaration.

EnumerationDescriptionRule creates a type descriptor for the enum type.

DependencyTransform

DependencyTransform processes dependencies between classifiers or protocols.

DependencyTransform
DependencyRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.DependencyTransform
Source org.eclipse.uml2.uml.Dependency
Target Container com.ibm.xtools.cpp2.model.CPPCompositeType
Target null

DependencyRule creates an #include directive or a forward declaration for the supplier of the dependency in each of the header and source file of the client classifier as dictated by the GeneralDependencyInfo stereotype application.

EnumerationLiteralTransform

EnumerationLiteralTransform processes enumeration literals.

EnumerationLiteralTransform
EnumerationLiteralRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.EnumerationLiteralTransform
Source org.eclipse.uml2.uml.EnumerationLiteral
Target Container com.ibm.xtools.cpp2.model.CPPEnum
Target com.ibm.xtools.cpp2.model.CPPEnumLiteral

EnumerationLiteralRule creates an enum literal.

GeneralizationTransform

GeneralizationTransform processes generalizations between UML classifiers.

GeneralizationTransform
GeneralizationRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.GeneralizationTransform
Source org.eclipse.uml2.uml.Generalization
Target Container com.ibm.xtools.cpp2.model.CPPCompositeType
Target com.ibm.xtools.cpp2.model.CPPInheritance

It may make sense to split/divide this transform into three - for capsules, protocols and classes.

PassiveStatemachineTransform

PassiveStatemachineTransform processes state machines in passive classes.

PassiveStatemachineTransform
PassiveStatemachineRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.PassiveStatemachineTransform
Source org.eclipse.uml2.uml.Statemachine
Target Container com.ibm.xtools.cpp2.model.CPPCompositeType
Target n/a

PassiveStatemachineRule creates the C++ representation of a UML state machine owned by a passive class.

OperationTransform

OperationTransform processes operations.

OperationTransform
OperationRule
[ParameterTransform]
Identifier com.ibm.xtools.umldt.rt.transform.cpp.OperationTransform
Source org.eclipse.uml2.uml.Operation
Target Container com.ibm.xtools.cpp2.model.CPPCompositeType
Target com.ibm.xtools.cpp2.model.CPPFunction

OperationRule creates an operation - either a global function or a method in a C++ type.

ParameterTransform

ParameterTransform processes operation parameters.

ParameterTransform
ParameterRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.ParameterTransform
Source org.eclipse.uml2.uml.Parameter
Target Container com.ibm.xtools.cpp2.model.CPPFunction
Target com.ibm.xtools.cpp2.model.CPPFunctionParameter

ParameterRule produces a function parameter or sets the return type of the function.

PropertyTransform

PropertyTransform processes properties.

PropertyTransform
PropertyRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.PropertyTransform
Source org.eclipse.uml2.uml.Property
Target Container com.ibm.xtools.cpp2.model.CPPCompositeType
Target com.ibm.xtools.cpp2.model.CPPVariable

PropertyRule creates a global variable or a field of a C++ type.

CapsuleStructureTransform

CapsuleStructureTransform processes the structure of a capsule.

CapsuleStructureTransform
CapsuleStructureRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.CapsuleStructureTransform
Source org.eclipse.uml2.uml.Class (with the UMLRealTime::Capsule stereotype)
Target Container com.ibm.xtools.cpp2.model.CPPCompositeType
Target n/a

CapsuleStructureRule creates the fields and methods in the C++ image of a capsule necessary to capture its parts, ports and connections.

CapsuleStatemachineTransform

CapsuleStatemachineTransform processes capsule state machines.

CapsuleStatemachineTransform
CapsuleStatemachineRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.CapsuleStatemachineTransform
Source org.eclipse.uml2.uml.Statemachine
Target Container com.ibm.xtools.cpp2.model.CPPCompositeType
Target n/a

CapsuleStatemachineRule creates the C++ representation of a UML state machine owned by a capsule.

PartTransform

PartTransform processes parts of capsules.

PartTransform
PortRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.PartTransform
Source org.eclipse.uml2.uml.Property (with capsule type)
Target Container com.ibm.xtools.cpp2.model.CPPCompositeType
Target com.ibm.xtools.cpp2.model.CPPVariable

PartRule creates a field to represent the capsule part.

PortTransform

PortTransform processes ports of capsules.

PortTransform
PortRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.PortTransform
Source org.eclipse.uml2.uml.Port
Target Container com.ibm.xtools.cpp2.model.CPPCompositeType
Target com.ibm.xtools.cpp2.model.CPPVariable

PortRule creates a field to represent the protocol access point.

UpdateSourceTransform

UpdateSourceTransform uses the in-memory model of the required C++ source code to create, update or remove files as necessary.

UpdateSourceTransform
TeamInitRule
TeamTransform
WriteSourceRule
RemoveOldFilesRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.UpdateSourceTransform
Source java.util.List (containing org.eclipse.uml2.uml model, package, class, datatype, and enumeration)
Target Container org.eclipse.core.resources.IContainer (within a project with the C++ nature)
Target com.ibm.xtools.cpp2.model.CPPWorkspace

TeamInitRule currently does nothing.

WriteSourceRule uses the JET transform com.ibm.xtools.cpp2.jet2 to create or update source files.

RemoveOldFilesRule removes files that are no longer required because of changes to the sources of the transformation configuration.

TeamTransform

TeamTransform is a container for interactions with source code repositories.

TeamTransform
TeamRule
Identifier com.ibm.xtools.umldt.rt.transform.cpp.TeamTransform
Source org.eclipse.uml2.uml.Port
Target Container com.ibm.xtools.cpp2.model.CPPCompositeType
Target com.ibm.xtools.cpp2.model.CPPVariable

TeamRule currently does nothing.