All C++ stereotypes are derived from «C++Element». Constraints described in this chapter are for information only; syntax of these constraints must be checked with the Object Constraint Language interpreter. Invisible stereotypes «C++Class», «C++Operation», «C++Parameter», «C++Attribute», «C++LiteralValue», «C++Include», «C++Generalization», and «C++TemplateParameter» are used only to store C++ language properties. These stereotypes and their tag definitions are used by the Domain Specific Language Customization framework. 
C++ StereotypesC++Operation«C++Operation» is an invisible stereotype used to include language properties for any C++ operation. Name | Meta Class | Constraints |
---|
C++Operation | Operation | Function Const void f() const; Constraint: Only valid for member function (member functions are operators that are declared as members of a class) if isQuery then stereotype- >select(name=’C++Global’)->isEmpty() | Tag definition | Type and default value | Descriptions |
---|
inline | boolean[1]=false | Function Inline inline a(); | throw exception | C++ThrowType[1]=any | Exception specification: If operation.raisedExpression is not empty, the expression throw is generated. void f() throw(int); If operation.raisedExpression is empty and expression throw value is none, then a expression throw without argument is generated. void f() throw () If operation.raisedExpression is empty and expression throw value is any, it does not generate a Keyword throw. void f(); | virtual | boolean[1]=false | Function Virtual virtual a(); Constraint: Only valid for member function and non static stereotype- >select(name=’C++Global’) ->isEmpty() and IsStatic = false | volatile | boolean[1]=false | Function Volatile void f() volatile; | funtionTryBlock | boolean[1]=false | Function try block void f() try{} |
C++OperatorStereotype «C++Operator» is used to define a C++ operator function. This stereotype extends the stereotype «C++Operation». Name | Meta Class | Constraints |
---|
C++Operator | Operation | Function Operator T& operator+(T& a); Constraint: the name start with word operator |
C++ConstructorStereotype «C++Constructor» is used to define C++ Constructor. This stereotype extends the stereotype «C++Operation». Name | Meta class | Constraints |
---|
C++Constructor | Operation | name = owner.name | Tag definition | Type and default value | Description |
---|
explicit | boolean[1]=false | Constructor Explicit explicit a(); | initialization list | String[0..1] | Constructor initialization: a() : x(1) {} |
C++DestructorStereotype «C++Destructor» is used to define C++ destructor. This stereotype extends Stereotype «C++Operation». Name | Meta Class | Constraints |
---|
C++Destructor | Operation | name = “~”+owner.name |
C++Parameter«C++Parameter» is an invisible stereotype used to include language properties for any C++ function parameter. Name | Meta Class | Constraints |
---|
C++Parameter | Parameter |
| Tag definition | Type and default value | Description |
---|
C Type declaration | boolean[1]=false | Declare parameter’s type in C style: void a(enum Day x); C++ style: void a(Day x); | Register | boolean[1]=false | Paramer Register void a(register int x); | Array | String[0..1] | C++ Array definition void a(int x[2][2]); |
C++ AttributeAn invisible stereotype «C++Attribute» is used to include language properties for any C++ variable. Name | Meta Class | Constraints |
---|
C++Attribute | Property | Constraint for code generation: it is valid to have a default value for any kind of attribute, but it is illegal to initialize a member variable within its definition. class A { int x = 1; }; if defaultValue.size() > 0 then owner.stereotype- >exists(name='C++Global') or (isStatic = true and typeModifiers.contains(“const”)) | Tag definition | Type and default value | Descriptions |
---|
abbreviated initialization | boolean[1]=false | Initialize the attribute with the abbreviated form: int x(5); Constraint owner.stereotype- >exists(name='C++Global') | bit field | String[0..1] | Bit field int x:2; Constraint: Only valid for member function stereotype- >select(name=’C++Global’) ->isEmpty() | c type declaration | boolean[1]=false | Declare attribute’s type in C style C style: enum Day x; C++ style: Day x; | container | String[0..1] | container of the attribute. $ character is replaced by the attribute type. vector<$> x; | mutable | boolean[1]=false | Attribute mutable modifier. mutable int x; Constraint: Only valid for member function stereotype->select(name=’C++Global’) ->isEmpty() | array | String[0..1] | C++ array definition int x[2][2]; |
C++LiteralValueAn invisible stereotype «C++LiteralValue» is used to include language properties for any C++ enum field. Name | Meta Class | Constraints |
---|
C++LiteralValue | EnumerationLiteral |
| Tag definition | Type and default value | Descriptions |
---|
value | String[0..1] | Value definition of an enum field: (A valid C++ expression) enum Day {Mon = 2}; |
C++Friend Stereotype «C++Friend» is used to define C++ friend relationship. Name | Meta Class | Constraints |
---|
C++Friend | Dependency | Client is Class or Operation and supplier is Class (client.oclIsTypeOf(Class) or client.oclIsTypeOf(Operation)) and supplier.oclIsTypeOf(Class) |
C++StructStereotype «C++Struct» is used to define C++ struct. Name | Meta Class |
---|
C++Struct | Class |
C++TypedefStereotype «C++Typedef» is used to define C++ typedef. Name | Meta Class | Constraints |
---|
C++Typedef | Class | A typedef does not contain an operation and attribute feature->isEmpty() A «C++BaseType» dependency is defined |
C++UnionStereotype «C++Union» is used to define C++ union. Name | Meta Class |
---|
C++Union | Class |
C++GlobalStereotype «C++Global» is used to define global functions and variables (functions and variables outside a class/struct/union declaration). Name | Meta Class | Constraints |
---|
C++Global | Class | Only one «C++Global» class into a package owner.ownedElement->select( stereotype->select(name=’C++Global’)).size()=1 All operations and attributes are public feature->forAll(visibility = #public) |
C++NamespaceStereotype «C++Namespace» is used to define a C++ namespace. Name | Meta class |
|
---|
C++Namespace | Package |
| Tag definition | Type and default value | Description |
---|
unique namespace name | String[0..1] | Unnamed namespace namespace {} | C++ExternStereotype «C++Extern» is used to define C++ extern variable. Name | Meta class | Constraints |
---|
C++Extern | Operation, Property | owner.stereotype->exists(name=’C++Global’) | Tag definition | Type and default value | Description |
---|
linkage | String[0..1] | Specification Linkage: extern “C” | C++FunctionPtrStereotype «C++FunctionPtr» is used to define C++ function pointer. Name | Meta class |
|
---|
C++FunctionPtr | Parameter, Property |
| Tag definition | Type and default value | Description |
---|
signature | Operation | The signature of the function (C++ function pointer definition without the operation name) | member class | Class | The class used for pointer to member function. | C++FunctionSignatureStereotype «C++FunctionSignature» is used as a container to model C++ function pointer. Name | Meta class | Constraints |
---|
C++FunctionSignature | Class | The class cannot have properties. properties->isEmpty() | C++ClassStereotype «C++Class» is an invisible stereotype used to include language properties for any C++ variable. Name | Meta class |
---|
C++Class | Class | C++BaseTypeStereotype «C++BaseType» is used to link base type of a typedef. Name | Meta class | Constraints |
---|
C++BaseType | Dependency | Client is type of Class with stereotype «C++Typedef». | Tag definition | Type and default value | Description |
---|
type modifiers | String[0..1] | Type modifiers of the typedef or function pointer. | member class | Class[0..1] | Memberclass of typedef or function pointer. | array | String[0..1] | Array definition. | C++IncludeStereotype «C++Include» is used to keep information about the include type, for generating include and forward class declaration. Name | Meta Class | Constraints |
---|
C++Include | Association, Dependency, Generalization, Parameter, Property, TemplateBinding, TemplateParameter | Client is type of Component | Tag definition | Type and default value | Description |
---|
header include | String | The value of the tag can be one of the following - None
- User Include
- System Include
- Class Forward
| implementation include | String | The value of the tag can be one of the following - None
- User Include
- System Include
- Class Forward
|
The header include tag is used when the client component has header file extension, “*.h”; otherwise, the tag implementation include will be used. The User Include tag value is used for generating user include, such as #include “test.h”. The System Include tag value is used for generating system include, such as #include <string.h> The Class Forward tag value is used for generating forward class declaration. C++TemplateParameterStereotype «C++Template Parameter» is used to keep type keyword between class and typename for template parameter declaration. Name | Meta Class |
|
---|
C++TemplateParameter | TemplateParameter |
| Tag definition | Type and default value | Description |
---|
type keyword | C++TemplateTypeKeyword=class | The value of tag is one of the following |
C++GeneralizationStereotype «C++Generalization» is used for information related to generalization and interface realization. Name | Meta Class |
|
---|
C++Generalization | Generalization, InterfaceRealization |
| Tag definition | Type and default value | Description |
---|
Inheritance Visibility | C++GeneralizationVisibility[1] = none | The value of tag can be one of the following - None
- public
- protected
- private
Example: class A : private B {}; | Virtual Inheritance | boolean[1]=false |
|
|