Server
API Reference Guide
Product Documentation:

Rogue Wave Server
Documentation Home
List of all members | Public Types | Public Member Functions
IlsSortedOwnsList< OwnerType, OwnedType, Comparator > Class Template Reference

Sorted owns list. More...

#include <ilserver/model.h>

Inheritance diagram for IlsSortedOwnsList< OwnerType, OwnedType, Comparator >:
IlsOwnsList< OwnerType, OwnedType > IlsIdentifiedListRelation IlsListRelation

Public Types

typedef IlsSortedOwnsList< OwnerType, OwnedType, Comparator > Myself
 Myself is the type of the instantiated template class.
 
- Public Types inherited from IlsOwnsList< OwnerType, OwnedType >
typedef IlsListRelationConstIterator< MyselfConstIterator
 Const iterator for the list.
 
typedef IlsSmartDoublyLinkedList< OwnedTypeP, OwnedTypeP, IlsBasicListKeyManager< OwnedTypeP > > Initial
 Class to pass as parameter for initializing the content of the list in its constructor.
 
typedef IlsListRelationIterator< MyselfIterator
 Non const iterator for the list.
 
typedef IlsOwnsList< OwnerType, OwnedType > Myself
 Myself is the type of the instantiated template class.
 
typedef IlsPartial< OwnerType, OwnedType, MyselfPartial
 This class is an intermediate class that stores list items.
 
typedef IlsListRelationPosition< MyselfPosition
 This class sets en iterator to a given position.
 

Public Member Functions

 IlsSortedOwnsList (OwnerType &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...
 
Myselfcons (COwnedTypePR)
 
Myselfoperator<< (COwnedTypePR newe)
 
- Public Member Functions inherited from IlsOwnsList< OwnerType, OwnedType >
 IlsOwnsList (OwnerType &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...
 
virtual ~IlsOwnsList ()
 This destructor breaks all relations in the list.
 
Myselfclear ()
 
Myselfcons (COwnedTypePR)
 
virtual void cut (Partial &, ILS_CUT_DIRECTIVE d=ILS_ALL)
 
IlsActivity getActivity () const
 
OwnedType ** 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...
 
COwnedTypePR getFirst ()
 
virtual IlsViewedgetIdentifiedElement (const IlsString &id) const
 This virtual member function is used to retrieve an identified object from the relation. More...
 
COwnedTypePR getLast ()
 
OwnerType & getOwner () const
 
OwnedType ** 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...
 
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 (COwnedTypePR e)
 Returns IlsTrue if the object pointed to belongs to the list.
 
Myselfoperator<< (COwnedTypePR newe)
 Adds an item to the list. More...
 
Myselfoperator>> (COwnedTypePR olde)
 Removes an item from the list. More...
 
COwnedTypePR operator[] (int i) const
 Returns the i-th list item.
 
Myselfremove (COwnedTypePR olde, ILS_CUT_DIRECTIVE d=ILS_ALL)
 
Myselfremove (Partial &, ILS_CUT_DIRECTIVE d=ILS_ALL, IlsBoolean weak=IlsFalse)
 
- Public Member Functions inherited from IlsIdentifiedListRelation
IlsRelationId getIdentifier () const
 
- 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 IlsOwnsList< OwnerType, OwnedType >
static InitialNewInitial ()
 

Detailed Description

template<class OwnerType, class OwnedType, class Comparator>
class IlsSortedOwnsList< OwnerType, OwnedType, Comparator >

Sorted owns list.

Template Parameters
OwnerTypeThe class that contains the relation.
OwnedTypeThe class of targets of the relation.
ComparatorThe comparison class.

Library: server

Relations of type IlsSortedOwnsList are similar to relations of type IlsOwnsList. 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 OwnerType must directly or transitively derive from IlsEntity or IlsObject. The OwnedType must directly or transitively derive from IlsObject. Derivation must be public.

The Comparator class contains only one static function with the following signature:

[static] IlsBoolean Compare(const OwnedType&,const OwnedType&);

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.

See also
IlsEntity, IlsObject, IlsSortedUsesList.

Constructor & Destructor Documentation

◆ IlsSortedOwnsList()

template<class OwnerType , class OwnedType , class Comparator >
IlsSortedOwnsList< OwnerType, OwnedType, Comparator >::IlsSortedOwnsList ( OwnerType &  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.

Parameters
ownerA reference to the owner object.
identifierA relation identifier of type IlsRelationId. This argument defaults to IlsDefaultRelationId. It is generally used to invert relations.
activitySpecifies 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.
mincardThe minimal cardinality of the list. This argument is optional and defaults to zero.
maxcardThe maximal cardinality of the list. This argument is optional and defaults to ILS_UNLIMITED_MAXCARD.
targetsA list of objects. Its creates an empty list when set to its default value.
check_cardSpecifies whether cardinalities should be checked at construction.

Member Function Documentation

◆ cons()

template<class OwnerType , class OwnedType , class Comparator >
Myself& IlsSortedOwnsList< OwnerType, OwnedType, Comparator >::cons ( COwnedTypePR  )
\short Adds an object to the list at the position
specified by the function `Compare()`.
Exceptions
IlsMaxCardViolatedIf the maximal cardinality has been reached.
IlsUpdateForbiddenIf the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared.
IlsOwnershipCycleIf a cycle has been detected among ownership relations.
IlsAlreadyInsertedIf the supplied object is already owned.

◆ operator<<()

template<class OwnerType , class OwnedType , class Comparator >
Myself& IlsSortedOwnsList< OwnerType, OwnedType, Comparator >::operator<< ( COwnedTypePR  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()`.
Exceptions
IlsMaxCardViolatedIf the maximal cardinality has been reached.
IlsUpdateForbiddenIf the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared.
IlsOwnershipCycleIf a cycle has been detected among ownership relations.
IlsAlreadyInsertedIf the supplied object is already owned.
IlsBoolean
bool IlsBoolean
The type IlsBoolean handles Boolean values. A Boolean value is true when set to IlsTrue and false whe...
Definition: config.h:194