Sorted inverted relation list. More...
#include <ilserver/model.h>
Public Types | |
typedef IlsSortedInvertedRelationList< TargetType, OriginType, Comparator > | Myself |
Myself is the type of the instantiated template class. | |
Public Types inherited from IlsInvertedRelationList< TargetType, OriginType > | |
typedef Relations | Initial |
This class provides a list of origin objects when a relation is created. More... | |
typedef IlsInvertedRelationList< TargetType, OriginType > | Myself |
Myself is the type of the instantiated template class. | |
Public Member Functions | |
IlsSortedInvertedRelationList (TargetType &target, IlsActivity activity=IlsModel::GetDefaultActivity(), IlsCardinality mincard=0, IlsCardinality maxcard=ILS_UNLIMITED_MAXCARD, Initial &targets=(*new Initial()), IlsBoolean check_card=IlsTrue) | |
Constructor. More... | |
Myself & | cons (OriginType *) |
Myself & | operator<< (OriginType *newe) |
Public Member Functions inherited from IlsInvertedRelationList< TargetType, OriginType > | |
IlsInvertedRelationList (TargetType &target, IlsActivity activity=IlsModel::GetDefaultActivity(), IlsCardinality mincard=0, IlsCardinality maxcard=ILS_UNLIMITED_MAXCARD, Initial &targets=(*new Initial()), IlsBoolean check_card=IlsTrue) | |
virtual IlsViewed * | getIdentifiedElement (const IlsString &id) const |
This virtual member function is used to retrieve an identified object from the relation. More... | |
virtual IlsBoolean | hasElement (IlsViewed &) const |
This virtual member function returns IlsTrue if the element is a target of the relation or IlsFalse otherwise. | |
Myself & | cons (OriginType *newe) |
Myself & | operator<< (OriginType *newe) |
This insertion operator adds an object to the list. More... | |
Myself & | remove (OriginType *olde) |
Myself & | operator>> (OriginType *olde) |
This extraction operator removes an object from the list. More... | |
Myself & | clear () |
virtual void | reset () |
OriginType ** | getPointerArray (int &) |
IlsBoolean | notify (IlsView *, IlsRelSubscribing *, ILS_NOTIFY_STATE=ILS_NOTIFY_DEFAULT) |
TargetType & | getTarget () const |
Returns the target of the relation. | |
Relations & | getRelations () const |
Returns the target of the relation. | |
OriginType * | operator[] (int i) const |
Returns the i -th list element. | |
OriginType * | getFirst () const |
OriginType * | getLast () const |
IlsBoolean | isIn (OriginType *e) |
void | resetSentinel () |
Returns the target of the relation. | |
OriginType ** | getAdded (int &) |
During a notification phase, this member function returns an array of pointers to the objects that have been added to the list since the last notification phase. More... | |
OriginType ** | getRemoved (int &) |
During a notification phase, this member function returns an array of pointers to the objects that have been removed from the list since the last notification phase. More... | |
Public Member Functions inherited from IlsListRelation | |
unsigned int | getLength () const |
Returns the number of objects in the list. | |
IlsCardinality | getMaxCard () const |
IlsCardinality | getMinCard () const |
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 Public Member Functions inherited from IlsInvertedRelationList< TargetType, OriginType > | |
static Initial & | NewInitial () |
Protected Member Functions inherited from IlsInvertedRelationList< TargetType, OriginType > | |
virtual IlsBoolean | fillViewedTable (IlsPtrArray< IlsViewed > &) |
During a notification phase, this member function returns an array of pointers to the objects that have been added to the list since the last notification phase. More... | |
Sorted inverted relation list.
TargetType | Target class of the direct relation. |
OriginType | Class that contains the direct relation. |
Comparator | Comparison class. |
Library: server
Relations of type IlsSortedInvertedRelationList
are similar to relations of type IlsInvertedRelationList
. The only difference is that sorted list-relations are associated with a sort criterion that is used to automatically determine where a new object will be placed in a list.
The TargetType
and the OriginType
must derive publicly and directly or transitively 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
. IlsSortedInvertedRelationList< TargetType, OriginType, Comparator >::IlsSortedInvertedRelationList | ( | TargetType & | target, |
IlsActivity | activity = IlsModel::GetDefaultActivity() , |
||
IlsCardinality | mincard = 0 , |
||
IlsCardinality | maxcard = ILS_UNLIMITED_MAXCARD , |
||
Initial & | targets = (*new Initial()) , |
||
IlsBoolean | check_card = IlsTrue |
||
) |
Constructor.
target | A reference to the target object. |
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 of the list. This argument is optional and defaults to ILS_UNLIMITED_MAXCARD . |
targets | A list of objects. It creates an empty list when set to its default value. |
check_card | Specifies whether cardinalities should be checked at construction. |
Myself& IlsSortedInvertedRelationList< TargetType, OriginType, Comparator >::cons | ( | OriginType * | ) |
\short Adds an object to the list at the position specified by the function `Compare()`.
IlsMaxCardViolated | If the maximal cardinality has been reached. |
IlsUpdateForbidden | If the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
Myself& IlsSortedInvertedRelationList< TargetType, OriginType, Comparator >::operator<< | ( | OriginType * | newe | ) |
\short Adds an element to the list at the position specified by the function `Compare()`.
\short Adds an object to the list at the position specified by the function `Compare()`.
IlsMaxCardViolated | If the maximal cardinality has been reached. |
IlsUpdateForbidden | If the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |