Sorted uses list. More...
#include <ilserver/model.h>
Public Types | |
typedef IlsSortedUsesList< UserType, UsedType, Comparator > | Myself |
Myself is the type of the instantiated template class. | |
![]() | |
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 | |
IlsSortedUsesList (UserType &owner, 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... | |
Myself & | cons (CUsedTypePR) |
Adds an object to the list at the position specified by the function Compare() . More... | |
Myself & | operator<< (CUsedTypePR newe) |
Adds an element to the list at the position specified by the function Compare() . More... | |
![]() | |
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. | |
Additional Inherited Members | |
![]() | |
static Initial & | NewInitial () |
Builds an empty list which is used by the constructor as the default value of the argument targets. | |
Sorted uses list.
UserType | Class that contains the relation. |
UsedType | class of target objects of the relation. |
Comparator | Comparison class. |
Library: server
Relations of type IlsSortedUsesList
are similar to relations of type IlsUsesList
. The only difference is that sorted list-relations can be associated with a sort criterion that is used to automatically determine where a new object will be placed in a list.
The UserType
and the UsedType
must directly or transitively derive from IlsEntity
or IlsObject
. Derivation must be public.
The Comparator
class contains only one static function with the following signature:
New objects will be added to a list at the position specified by the function Compare()
.
If the function Comparator::Compare(O1, O2);
returns IlsTrue
, O1
is considered greater than O2
and thus placed after O2
in the list. If this function returns IlsFalse
, then O1
is considered lower than O2
and thus inserted before O2
in the list.
A list is sorted in the ascending order defined by the Compare()
function. To invert the sort order defined by a given Compare()
function, you have to change the return value into the opposite value.
IlsDerived
, IlsEntity
, IlsObject
, IlsSortedOwnsList
. IlsSortedUsesList< UserType, UsedType, Comparator >::IlsSortedUsesList | ( | UserType & | owner, |
IlsRelationId | identifier = IlsDefaultRelationId , |
||
IlsActivity | activity = IlsModel::GetDefaultActivity() , |
||
IlsCardinality | mincard = 0 , |
||
IlsCardinality | maxcard = ILS_UNLIMITED_MAXCARD , |
||
Initial & | targets = (*new Initial()) , |
||
IlsBoolean | check_card = IlsTrue |
||
) |
Constructor.
owner | 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 | specifies whether cardinalities should be checked at construction. |
Myself& IlsSortedUsesList< UserType, UsedType, Comparator >::cons | ( | CUsedTypePR | ) |
Adds an object to the list at the position specified by the function Compare()
.
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 function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
Myself& IlsSortedUsesList< UserType, UsedType, Comparator >::operator<< | ( | CUsedTypePR | newe | ) |
Adds an element to the list at the position specified by the function Compare()
.
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 function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
© 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.