Set of uses relations. More...
#include <ilserver/model.h>
Public Types | |
typedef IlsSetRelationIterator< Myself > | Iterator |
Non const iterator. | |
typedef IlsUsesSet< UserType, UsedType, KeyType, KeyManager > | Myself |
Myself is the type of the instantiated template class. | |
Public Member Functions | |
IlsUsesSet (UserType &user, IlsRelationId identifier=IlsDefaultRelationId, IlsActivity activity=IlsModel::GetDefaultActivity(), IlsCardinality mincard=0, IlsCardinality maxcard=ILS_UNLIMITED_MAXCARD, Initial &targets=(*new Initial()), IlsBoolean check_card=IlsTrue) | |
Constructor. More... | |
virtual | ~IlsUsesSet () |
This destructor breaks all the relations in the set. | |
Myself & | clear () |
Clears the list. More... | |
virtual void | cut (Partial &, ILS_CUT_DIRECTIVE d=ILS_ALL) |
UsedTypeP | get (CKeyTypeR identifier) |
Returns the object associated with the key specified; otherwise, it returns 0. | |
IlsActivity | getActivity () const |
Returns ILS_ACTIVE if the relation has been set as active. Otherwise, it returns ILS_INACTIVE . More... | |
UsedType ** | getAdded (int &) |
During a notification phase, this member function returns an array of pointers to the elements that have been added to the set since the last notification phase. More... | |
unsigned int | getCount () |
Returns the number of objects in the set at a given time. | |
virtual IlsViewed * | getIdentifiedElement (const IlsString &id) const |
This virtual member function is used to retrieve an identified object from the relation. More... | |
UsedType ** | getRemoved (int &) |
During a notification phase, this member function returns an array of pointers to the elements that have been removed from the set since the last notification phase. More... | |
UserType & | getUser () const |
Returns a reference to the user object. More... | |
virtual IlsBoolean | hasElement (IlsViewed &) const |
This virtual member function returns IlsTrue if the element is a target of the relation or IlsFalse otherwise. | |
IlsBoolean | isIn (CKeyTypeR identifier) |
Indicates whether the set contains the object associated with the key specified. | |
Myself & | operator<< (CUsedTypePR v) |
Adds an object to the set. More... | |
Myself & | operator>> (CUsedTypePR v) |
Removes an object from the set. More... | |
UsedTypeP | operator[] (CKeyTypeR identifier) |
This operation is identical to the member function get() . | |
Myself & | put (CUsedTypePR) |
Puts an object in the set. More... | |
Myself & | suppress (CKeyTypeR identifier, ILS_CUT_DIRECTIVE=ILS_ALL) |
Removes the object associated with the key specified according to the cut instruction specified. More... | |
![]() | |
IlsActivity | getActivity () const |
Indicates whether the set is active or not, that is, if derived data members are recomputed when the set is modified. | |
unsigned int | getCount () const |
Returns the number of objects in the set at a given time. | |
IlsRelationId | getIdentifier () const |
Returns the relation identifier. | |
IlsCardinality | getMaxCard () const |
Returns the maximal cardinality specified for the set. | |
IlsCardinality | getMinCard () const |
Returns the minimal cardinality specified for the set. | |
IlsBoolean | isCountModified () |
Indicates whether the number of objects in the set has changed. More... | |
IlsBoolean | isModified () |
Indicates whether the set has been modified. | |
Static Public Member Functions | |
static Initial & | NewInitial () |
Builds an empty set which is used by the constructor as the default value of the argument targets. | |
Set of uses relations.
UserType | Class that contains the relation, |
UsedType | Class of the targets of the relation. |
KeyType | The type of the key used to store objects in a set and retrieve objects from a set. |
KeyManager | A class that specifies how to handle keys. |
Library: server
Rogue Wave Server lets you declare use relations among object classes. Use relations are relations in which one particular object can be used by any number of other objects. The user object can also use one or more other objects. One-to-many relations can be defined as list-relations or as set-relations. Unlike list-relations, target objects in set-relations are not listed in sequential order but are grouped together in a non-ordered set and are directly accessible using a key. Such relations are declared within the user class as instances of the class template IlsUsesSet
.
IlsEntity
, IlsHashKeyManager
, IlsObject
, IlsOwnsSet
, IlsUsesList
, IlsUsesSet::Iterator
. IlsUsesSet< UserType, UsedType, KeyType, KeyManager >::IlsUsesSet | ( | UserType & | user, |
IlsRelationId | identifier = IlsDefaultRelationId , |
||
IlsActivity | activity = IlsModel::GetDefaultActivity() , |
||
IlsCardinality | mincard = 0 , |
||
IlsCardinality | maxcard = ILS_UNLIMITED_MAXCARD , |
||
Initial & | targets = (*new Initial()) , |
||
IlsBoolean | check_card = IlsTrue |
||
) |
Constructor.
user | A reference to the user object. |
identifier | A relation identifier of type IlsRelationId . This argument defaults to IlsDefaultRelationId . It is generally used to invert relations. |
activity | Specifies whether the relation is active or not. A relation is active if its modification sets off the recomputation of derived data members. The default value is the one returned by the member function IlsModel::GetDefaultActivity() , which is ILS_INACTIVE by default. |
mincard | The minimal cardinality of the list. This argument is optional and defaults to zero. |
maxcard | The maximal cardinality of the list. This argument is optional and defaults to ILS_UNLIMITED_MAXCARD . |
targets | A list of objects. Its creates an empty list when set to its default value. |
check_card | The argument check_card specifies whether cardinalities should be checked at construction. |
Myself& IlsUsesSet< UserType, UsedType, KeyType, KeyManager >::clear | ( | ) |
Clears the list.
IlsMinCardViolated | If the minimal cardinality is different from zero. The number of objects left in the set will be equal to the minimal cardinality specified. |
IlsUpdateForbidden | If the member function isUpdatedAllowed() returns IlsFalse for the type in which the relation is declared. |
|
virtual |
This static member function is called when a cut is applied to one of the used objects.
IlsActivity IlsUsesSet< UserType, UsedType, KeyType, KeyManager >::getActivity | ( | ) | const |
Returns ILS_ACTIVE
if the relation has been set as active. Otherwise, it returns ILS_INACTIVE
.
For details, see the constructor.
UsedType** IlsUsesSet< UserType, UsedType, KeyType, KeyManager >::getAdded | ( | int & | ) |
During a notification phase, this member function returns an array of pointers to the elements that have been added to the set since the last notification phase.
It returns an empty array if no object has been added to the set-relation. The argument accepts the size of the array as a return value.
You must explicitly destroy this array when you no longer need it. To do so, use delete
with square brackets [].
|
virtual |
This virtual member function is used to retrieve an identified object from the relation.
The member function IlsViewed::getKeyIdentifier()
is used to retrieve the identifier of the relation element.
Reimplemented from IlsViewedRel.
UsedType** IlsUsesSet< UserType, UsedType, KeyType, KeyManager >::getRemoved | ( | int & | ) |
During a notification phase, this member function returns an array of pointers to the elements that have been removed from the set since the last notification phase.
It returns an empty array if no object has been removed from the set-relation. The argument accepts the size of the array as a return value.
You must explicitly destroy this array when you no longer need it. To do so, use delete
with square brackets [].
UserType& IlsUsesSet< UserType, UsedType, KeyType, KeyManager >::getUser | ( | ) | const |
Returns a reference to the user object.
It is useful especially in the case of derived relations.
Myself& IlsUsesSet< UserType, UsedType, KeyType, KeyManager >::operator<< | ( | CUsedTypePR | v | ) |
Adds an object to the set.
A set cannot contain two objects associated with the same key.
IlsMaxCardViolated | If the maximal cardinality has been reached. |
IlsUpdateForbidden | If the member function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
IlsUnownedUse | If the specified object is neither an owned object nor an entity, and if the member function IlsModel::IsIntegrityChecked() returns IlsTrue . |
Myself& IlsUsesSet< UserType, UsedType, KeyType, KeyManager >::operator>> | ( | CUsedTypePR | v | ) |
Removes an object from the set.
IlsUpdateForbidden | If the member function isUpdatedAllowed() returns IlsFalse for the type in which the relation is declared. |
IlsMinCardViolated | If the minimal cardinality has been reached. |
IlsNotFound | If no object is associated with the key specified. |
Myself& IlsUsesSet< UserType, UsedType, KeyType, KeyManager >::put | ( | CUsedTypePR | ) |
Puts an object in the set.
A set cannot contain two objects associated with the same key.
IlsMaxCardViolated | If the maximal cardinality has been reached. |
IlsUpdateForbidden | If the member function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
IlsUnownedUse | If the specified object is neither an owned object nor an entity, and if the member function IlsModel::IsIntegrityChecked() returns IlsTrue . |
Myself& IlsUsesSet< UserType, UsedType, KeyType, KeyManager >::suppress | ( | CKeyTypeR | identifier, |
ILS_CUT_DIRECTIVE | = ILS_ALL |
||
) |
Removes the object associated with the key specified according to the cut instruction specified.
IlsUpdateForbidden | If the member function isUpdatedAllowed() returns IlsFalse for the type in which the relation is declared. |
IlsMinCardViolated | If the minimal cardinality has been reached. |
IlsNotFound | If no object is associated with the key specified. |
© Copyright 2018, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.