List of uses relations. More...
#include <ilserver/model.h>
Public Types | |
typedef IlsListRelationConstIterator< Myself > | ConstIterator |
Const iterator. | |
typedef IlsSmartDoublyLinkedList< UsedTypeP, UsedTypeP, IlsBasicListKeyManager< UsedTypeP > > | Initial |
This type provides a list of used objects when the relation is created. More... | |
typedef IlsListRelationIterator< Myself > | Iterator |
Non const iterator. | |
typedef IlsUsesList< UserType, UsedType > | Myself |
Myself is the type of the instantiated template class. | |
typedef IlsPartial< UserType, UsedType, Myself > | Partial |
This class is an intermediate class that stores list items. | |
typedef IlsListRelationPosition< Myself > | Position |
The class Position sets a list iterator to a given position. | |
Public Member Functions | |
IlsUsesList (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 | ~IlsUsesList () |
This destructor breaks all relations in the list. | |
Myself & | clear () |
Empties the list. More... | |
Myself & | cons (CUsedTypePR) |
Adds an object to the list. More... | |
virtual void | cut (Partial &) |
Is called when a cut is applied to the target of the relation. | |
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 items that have been added to the list since the last notification phase. More... | |
CUsedTypePR | getFirst () |
Returns the first item of the list. More... | |
virtual IlsViewed * | getIdentifiedElement (const IlsString &id) const |
This virtual member function is used to retrieve an identified object from the relation. More... | |
CUsedTypePR | getLast () |
Returns the last item of the list. More... | |
UsedType ** | getRemoved (int &) |
During a notification phase, this member function returns an array of pointers to the items that have been removed from the list 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 (CUsedTypePR e) |
Returns IlsTrue if the object pointed to belongs to the list. | |
Myself & | operator<< (CUsedTypePR newe) |
CUsedTypePR | operator[] (int i) const |
Returns the i -th list element. | |
Myself & | remove (CUsedTypePR olde) |
Removes an object from the list according to the specified cut instruction. More... | |
Myself & | remove (Partial &, IlsBoolean weak=IlsFalse) |
Removes the argument Partial from the list. More... | |
![]() | |
IlsRelationId | getIdentifier () const |
![]() | |
unsigned int | getLength () const |
Returns the number of objects in the list. | |
IlsCardinality | getMaxCard () const |
Indicates the maximal cardinality of the list. | |
IlsCardinality | getMinCard () const |
Indicates the minimal cardinality of the list. | |
IlsBoolean | isLengthModified () |
During a notification phase, this member function returns IlsTrue if the number of objects in the list has been modified since the last notification phase. | |
IlsBoolean | isModified () |
During a notification phase, this member function returns IlsTrue if the list relation has been modified since the last notification phase, that is, if one or more items have been added to, or removed from, the list. | |
Static Public Member Functions | |
static Initial & | NewInitial () |
Builds an empty list which is used by the constructor as the default value of the argument targets. | |
List of uses relations.
UserType | Class that contains the relation. |
UsedType | Class of the targets of the relation. |
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 set-relations, target objects in list-relations are listed in sequential order. Such relations are declared within the user class as instances of the class template IlsUsesList
.
typedef IlsSmartDoublyLinkedList<UsedTypeP, UsedTypeP, IlsBasicListKeyManager<UsedTypeP> > IlsUsesList< UserType, UsedType >::Initial |
This type provides a list of used objects when the relation is created.
This list must contain at least as many elements as specified for the minimal cardinality.
IlsUsesList< UserType, UsedType >::IlsUsesList | ( | 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 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, which can be an unsigned integer or indeterminate. This argument is optional and defaults to ILS_UNLIMITED_MAXCARD . |
targets | a list of objects. Its default value, newInitial, creates an empty list. |
check_card | specifies whether cardinalities should be checked at object construction. |
IlsMinCardViolated | If the number of objects in targets is lower than the value assigned to mincard. |
IlsMaxCardViolated | If the number of objects in targets is greater than the value of maxcard. |
Myself& IlsUsesList< UserType, UsedType >::clear | ( | ) |
Empties the list.
IlsMinCardViolated | If the minimal cardinality is different from zero. The number of items remaining in the list will be equal to the minimal cardinality specified. |
IlsUpdateForbidden | If the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
Myself& IlsUsesList< UserType, UsedType >::cons | ( | CUsedTypePR | ) |
Adds an object to the list.
IlsMaxCardViolated | If the maximal cardinality has been reached. |
IlsUnownedUse | If the specified object is neither an owned object nor an entity, and if the member function IlsModel::IsIntegrityChecked returns IlsTrue . |
IlsUpdateForbidden | if the member function isUpdateAllowed returns IlsFalse for the type in which the relation is declared. |
IlsActivity IlsUsesList< UserType, UsedType >::getActivity | ( | ) | const |
Returns ILS_ACTIVE
if the relation has been set as active. Otherwise, it returns ILS_INACTIVE
.
For details, see the constructor.
UsedType** IlsUsesList< UserType, UsedType >::getAdded | ( | int & | ) |
During a notification phase, this member function returns an array of pointers to the items that have been added to the list since the last notification phase.
It returns an empty array if no object has been added to the list-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 [].
CUsedTypePR IlsUsesList< UserType, UsedType >::getFirst | ( | ) |
Returns the first item of the list.
IlsForbiddenOnEmptyList | If the list is empty. |
|
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.
CUsedTypePR IlsUsesList< UserType, UsedType >::getLast | ( | ) |
Returns the last item of the list.
IlsForbiddenOnEmptyList | If the list is empty. |
UsedType** IlsUsesList< UserType, UsedType >::getRemoved | ( | int & | ) |
During a notification phase, this member function returns an array of pointers to the items that have been removed from the list since the last notification phase.
It returns an empty array if no object has been removed from the list-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& IlsUsesList< UserType, UsedType >::getUser | ( | ) | const |
Returns a reference to the user object.
This function is useful especially in the case of derived relations.
Myself& IlsUsesList< UserType, UsedType >::operator<< | ( | CUsedTypePR | newe | ) |
Adds an item to the list.
IlsMaxCardViolated | If the maximal cardinality has been reached. |
IlsUnownedUse | If the specified object is neither an owned object nor an entity, and if the member function IlsModel::IsIntegrityChecked returns IlsTrue . |
IlsUpdateForbidden | if the member function isUpdateAllowed returns IlsFalse for the type in which the relation is declared. |
Myself& IlsUsesList< UserType, UsedType >::remove | ( | CUsedTypePR | olde | ) |
Removes an object from the list according to the specified cut
instruction.
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 the item to be removed does not belong to the list. |
Myself& IlsUsesList< UserType, UsedType >::remove | ( | Partial & | , |
IlsBoolean | weak = IlsFalse |
||
) |
Removes the argument Partial
from the list.
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 the item to be removed does not belong to the list. |
© 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.