Automatic guessing on return parameters happens when C++ Designer is generating the code for a return parameter for which the automatic generation flag is set.
The following table shows the generated declaration for a return parameter.
Cardinality | Declaration |
---|---|
0..1 | int* |
1..1 | int |
0..* | int* |
1..* | int* |
n..m | int* |
Cardinality | Declaration |
---|---|
0..1 | std::string* |
1..1 | std::string& |
0..* | std::string* |
1..* | std::string* |
n..m | std::string* |
Cardinality | Declaration |
---|---|
0..1 | MyClass* |
1..1 | MyClass& |
0..* | MyClass* |
1..* | MyClass* |
n..m | MyClass* |
Cardinality | Declaration |
---|---|
0..1 | MyDatatype* |
1..1 | MyDatatype |
0..* | MyDatatype* |
1..* | MyDatatype* |
n..m | MyDatatype* |
Cardinality | Declaration |
---|---|
0..1 | MyDatatype* |
1..1 | MyDatatype& |
0..* | MyDatatype* |
1..* | MyDatatype* |
n..m | MyDatatype* |
Note 1: Where the table states integer, this can be any basic type (integer, char, float, boolean).
Note 2: Return parameters never return a collection, but simply a pointer to the first element of an array. This is because no assumptions can be made by C++ Designer about the internal implementation of the method returning the parameter. In real life, a reference to the container will most often be returned.
Note 3: For returned values with a minimum cardinality of 0, a pointer is returned, which allows the expression of the absence of any useful value (in which case a null pointer can be returned).