Modeling Services > Relations > One-to-one Relations > Constructing Use Relations
 
Constructing Use Relations
The relation initialization is performed in the initialization list of the constructor of the user class, like this:
Link::Link():
from(*this),
to(*this)
{}
Relations built this way contain a null smart pointer. If you want to initialize the relation in the constructor, you can provide the used object.
The following code sample creates a link by specifying its extremities.
Link::Link(NodeP f, NodeP t):
from(*this,f),
to(*this,t)
{}
You can provide an identifier of type IlsRelationId as a third argument. This identifier
is used essentially to invert relations. Typically, the value you put in this identifier is an enumerated type that behaves like a numeric type.
For more information about this identifier, see “Using Relation Identifiers with an Inverted Relation”. and “Using Relation Identifiers with an Inverted List-Relation”.. The constructor can take a fourth argument of type IlsActivity. When this argument is set to ILS_ACTIVE, any modifications of the relation set off the recomputation of derived data members whose value depends on that relation. Derived data members are discussed in Entry and Derived Data Members.

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.