| Level | Name | Description | Example |
|---|---|---|---|
| M2 | metamodel | UML Syntax | ![]() |
| M1 | model | UML Model | |
| M0 | data layer | Real World | ![]() |
+ public- private# protected~ package| UML Type | C++ Type | C++ Standard Alternatives | Compiler Extensions (MSVC Italicized) |
|---|---|---|---|
| Integer | int (32) |
int8_t (8), int16_t (16), int32_t (32), int64_t (64), short (16), long (32/64), long long (64) |
__int128 (128), __int8 (8), __int16 (16), __int32 (32), __int64 (64) (MSVC) |
| UnlimitedNatural | unsigned int (32) |
size_t (32/64), uint8_t (8), uint16_t (16), uint32_t (32), uint64_t (64), unsigned short (16), unsigned long (32/64), unsigned long long (64) |
unsigned __int128 (128), unsigned __int8 (8), unsigned __int16 (16), unsigned __int32 (32), unsigned __int64 (64) |
| Real | double (64) |
long double (80/128), float (32) |
__float128 (128), __fp16 (16), _Float16 (16), _Float32 (32), _Float64 (64), _Float128 (128), __bf16 (16) |
| Boolean | bool |
||
| String | std::string |
std::string_view, std::u8string, std::wstring, std::u16string, std::u32string, const char*, char* |
| Attribute Syntax | Description |
|---|---|
+name |
public name |
-name |
private name |
-name:Name |
private name of type Name |
-name:Name = "Project" |
private name of type Name with default "Project" |
-name:Name[3] |
private name of type Name with multiplicity of 3 |
-name:Name = "Project" { persistent } |
private name of type Name with the default "Project", and property 'persistent' |
| Operator Syntax | Description |
|---|---|
+draw() |
public operator draw() |
-draw() |
private operator draw() |
#draw() |
protected operator draw() |
+draw() : Boolean |
public operator draw() with return type Boolean |
+draw() : Boolean {optional} |
public operator draw() with return type Boolean, and a property optional |
| Parameter Syntax | Description |
|---|---|
+draw(: Shape) |
parameter of type Shape |
+draw(s: Shape) |
parameter s of type Shape |
+draw(in shape : Shape) |
in parameter shape of type Shape |
+draw(out picture : Picture) |
out parameter picture of type Picture |
+draw(inout picture : Picture) |
inout parameter picture of type Picture |
| C++ Declaration | UML Parameter Direction |
|---|---|
| Shape | in |
| const Shape& | in |
| const Shape* | in |
| Shape& | inout |
| Shape& | out |
| Shape* | inout |
| Shape* | out |
| Shape** | out (typical API usage) |
| Multiplicity Syntax | Description |
|---|---|
* |
Any number of values |
1 |
Single value (default) |
0..1 |
No more than a single value |
2..4 |
Two to four values |
| Multiplicity Term | Description |
|---|---|
| Optional | * |
| Mandatory | 1..* |
| Single-valued | 0..1 |
| Multivalued | 0..2, 0..* |
std::array, std::vector, std::deque, std::list, std::forward_liststd::optional (C++17)
And, IMHO, the UML standard started going off the rails when some started morphing it to be a programming language with formal semantics. Visual representations are, by their very nature, abstractions, not precise representations.