Multiplicity of objects
Objects have a multiplicity
that determines whether they
are implemented as a single object, an array, a list, a collection,
or a map. You can modify the default implementation using the CG::Relation::Implementation
property
for the object.
The Implementation
property
is
under the metaclass Relation
rather than Class
because
even objects without any visible relations have at least one relation
to an object type that is hidden in the browser.
Bounded multiplicity
Objects
with bounded
multiplicity
(for example,
2) are allocated to an array with the same number of elements as the
multiplicity. For example, for an object B
of implicit
type with a multiplicity of 2, the following array is allocated:
extern struct B_t B[2];
Unbounded multiplicity
Objects with a multiplicity
of
* (unbounded) are
allocated to an RiCList
structure. For example, for
an object A
with a multiplicity of *, the following
structure is allocated:
extern RiCList A;
RiCList
is a predefined list container type provided by
theRhapsody® Developer for C®
framework.
Unspecified or single multiplicity
Objects for which no multiplicity is specified have a default multiplicity of one. Single objects are allocated to a simple structure. For example:
struct A_t {
/* User explicit entries */
} A;
In this case, a single object A
is
allocated at the close of the A_t struct
definition
in the specification file for A
.