Generating accessors for associations

 

These are the accessors generated by C++ Developer when the "Create accessors" command is activated. These accessors are created in the model.  They are automatically decorated for C++ generation.

 

Association type

Card.

Declaration
(as generated by automatic guessing)

Get accessor

Set accessor

MyClass             

0..1

MyClass* assoc;

MyClass* getAssoc () const

void setAssoc(MyClass* value)

1..1

MyClass* assoc;

MyClass* getAssoc() const

void setAssoc(MyClass* value)

0..*

std::vector<MyClass*> assoc;

std::vector<MyClass*>& getAssoc() const

See note 2 below

1..*

std::vector<MyClass*> assoc;

std::vector<MyClass*>& getAssoc() const

See note 2 below

n..m

std::vector<MyClass*> assoc;

std::vector<MyClass*>& getAssoc() const

See note 2 below

MyDatatype isPrimitive=false              

0..1

MyDatatype* assoc;

MyDatatype* getAssoc() const

 

void setAssoc(MyDatatype* value)

1..1

MyDatatype* assoc;

MyDatatype* getAssoc() const

void setAssoc(MyDatatype* value)

0..*

std::vector<MyDatatype*> assoc;

std::vector<MyDatatype*>& getAssoc() const

See note 2 below

1..*

std::vector<MyDatatype*> assoc;

std::vector<MyDatatype*>& getAssoc() const

See note 2 below

n..m

std::vector<MyDatatype*> assoc;

std::vector<MyDatatype*>& getAssoc() const

See note 2 below

integer   

0..1

int* assoc;

const int* getAssoc() const

void setAssoc(int* value)

1..1

int* assoc;

const int* getAssoc() const

void setAssoc(int* value)

0..*

std::vector<int*> assoc;

std::vector<int*>& getAssoc() const

See note 2 below

1..*

std::vector<int*> assoc;

std::vector<int*>& getAssoc() const

See note 2 below

n..m

std::vector<int*> assoc;

std::vector<int*>& getAssoc() const

See note 2 below

string                  

0..1

std::string* assoc;

std::string* getAssoc() const

void setAssoc(std::string* value)

1..1

std::string* assoc;

std::string* getAssoc() const

 

void setAssoc(std::string* value)

0..*

std::vector<std::string*> assoc;

std::vector<std::string*>& getAssoc() const

See note 2 below

1..*

std::vector<std::string*> assoc;

std::vector<std::string*>& getAssoc() const

See note 2 below

n..m

std::vector<std::string*> assoc;

std::vector<std::string*>& getAssoc() const

See note 2 below

MyDatatype

isPrimitive=true                

0..1

MyDatatype* assoc;

const MyDatatype* getAssoc() const

 

void setAssoc(MyDatatype* value)

1..1

MyDatatype* assoc;

const MyDatatype* getAssoc() const

void setAssoc(MyDatatype* value)

0..*

std::vector<MyDatatype*> assoc;

std::vector<MyDatatype*>& getAssoc() const

See note 2 below

1..*

std::vector<MyDatatype*> assoc;

std::vector<MyDatatype*>& getAssoc() const

See note 2 below

n..m

std::vector<MyDatatype*> assoc;

std::vector<MyDatatype*>& getAssoc() const

See note 2 below

 

Note 1:     The gray cells in the above table are only provided for the sake of completeness.  However, no such models should be constructed.

 

Note 2:   Where the table states integer, this can be any basic type (integer, char, float, boolean).

 

Note 3:   Accessors with maximum cardinality "*" return a reference to the internal collection, so the user can directly manipulate the container contents using the accessors specific to the container type.  There are no "set" accessors for these cases and we recommend that you use the "get" accessor and the proper container API on the returned value.