Server
API Reference Guide
Product Documentation:

Visualization Server
Documentation Home
List of all members | Public Types | Public Member Functions | Static Public Member Functions
IlsUsesList< UserType, UsedType > Class Template Reference

List of uses relations. More...

#include <ilserver/model.h>

Inheritance diagram for IlsUsesList< UserType, UsedType >:
IlsIdentifiedListRelation IlsListRelation IlsSortedUsesList< UserType, UsedType, Comparator >

Public Types

typedef IlsListRelationConstIterator< MyselfConstIterator
 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< MyselfIterator
 Non const iterator.
 
typedef IlsUsesList< UserType, UsedType > Myself
 Myself is the type of the instantiated template class.
 
typedef IlsPartial< UserType, UsedType, MyselfPartial
 This class is an intermediate class that stores list items.

 
typedef IlsListRelationPosition< MyselfPosition
 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.
 
Myselfclear ()
 
Myselfcons (CUsedTypePR)
 
virtual void cut (Partial &)
 
IlsActivity getActivity () const
 
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 ()
 
virtual IlsViewedgetIdentifiedElement (const IlsString &id) const
 This virtual member function is used to retrieve an identified object from the relation. More...
 
CUsedTypePR getLast ()
 
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
 
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.
 
Myselfoperator<< (CUsedTypePR newe)
 
CUsedTypePR operator[] (int i) const
 Returns the i-th list element.
 
Myselfremove (CUsedTypePR olde)
 
Myselfremove (Partial &, 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.
 

Static Public Member Functions

static InitialNewInitial ()
 

Detailed Description

template<class UserType, class UsedType>
class IlsUsesList< UserType, UsedType >

List of uses relations.

Template Parameters
UserTypeClass that contains the relation.
UsedTypeClass 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.

See also
IlsDefaultRelationId, IlsDerived, IlsEntity, IlsMoveDirective, IlsObject, IlsUses, IlsUsesDynamicArray, IlsUsesFixedArray, IlsUsesList::Initial, IlsUsesList::ConstIterator, IlsUsesList::Iterator, IlsUsesList::Partial, IlsUsesList::Position, IlsUsesSet, IlsRelationId.

Member Typedef Documentation

◆ Initial

template<class UserType , class UsedType >
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.

Constructor & Destructor Documentation

◆ IlsUsesList()

template<class UserType , class UsedType >
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.

Parameters
userA reference to the user 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 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, which can be an unsigned integer or indeterminate. This argument is optional and defaults to ILS_UNLIMITED_MAXCARD.
targetsa list of objects. Its default value, newInitial, creates an empty list.
check_cardspecifies whether cardinalities should be checked at object construction.
Exceptions
IlsMinCardViolatedIf the number of objects in targets is lower than the value assigned to mincard.
IlsMaxCardViolatedIf the number of objects in targets is greater than the value of maxcard.

Member Function Documentation

◆ clear()

template<class UserType , class UsedType >
Myself& IlsUsesList< UserType, UsedType >::clear ( )
\short Empties the list.
Exceptions
IlsMinCardViolatedIf the minimal cardinality is different from zero. The number of items remaining in the list will be equal to the minimal cardinality specified.
IlsUpdateForbiddenIf the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared.

◆ cons()

template<class UserType , class UsedType >
Myself& IlsUsesList< UserType, UsedType >::cons ( CUsedTypePR  )
\short Adds an object to the list.
Exceptions
IlsMaxCardViolatedIf the maximal cardinality has been reached.
IlsUnownedUseIf the specified object is neither an owned object nor an entity, and if the member function IlsModel::IsIntegrityChecked returns IlsTrue.
IlsUpdateForbiddenif the member function isUpdateAllowed returns IlsFalse for the type in which the relation is declared.

◆ cut()

template<class UserType , class UsedType >
virtual void IlsUsesList< UserType, UsedType >::cut ( Partial )
virtual
\short Is called when a cut is applied to the target of the relation.

◆ getActivity()

template<class UserType , class UsedType >
IlsActivity IlsUsesList< UserType, UsedType >::getActivity ( ) const
\short Returns \c ILS_ACTIVE if the relation has
been set as active. Otherwise, it returns \c ILS_INACTIVE.

For details, see the constructor.

◆ getAdded()

template<class UserType , class UsedType >
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 [].

◆ getFirst()

template<class UserType , class UsedType >
CUsedTypePR IlsUsesList< UserType, UsedType >::getFirst ( )
\short Returns the first item of the list.
Exceptions
IlsForbiddenOnEmptyListIf the list is empty.

◆ getIdentifiedElement()

template<class UserType , class UsedType >
virtual IlsViewed* IlsUsesList< UserType, UsedType >::getIdentifiedElement ( const IlsString id) const
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.

Note
On all subclasses of this class, the complexity of this method is always linear, in terms of the number of elements in the relation, even for set relations.

Reimplemented from IlsViewedRel.

◆ getLast()

template<class UserType , class UsedType >
CUsedTypePR IlsUsesList< UserType, UsedType >::getLast ( )
\short Returns the last item of the list.
Exceptions
IlsForbiddenOnEmptyListIf the list is empty.

◆ getRemoved()

template<class UserType , class UsedType >
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 [].

◆ getUser()

template<class UserType , class UsedType >
UserType& IlsUsesList< UserType, UsedType >::getUser ( ) const
\short Returns a reference to the user object.

This function is useful especially in the case of derived relations.

◆ NewInitial()

template<class UserType , class UsedType >
static Initial& IlsUsesList< UserType, UsedType >::NewInitial ( )
static
\short Builds an empty list which is used

by the constructor as the default value of the argument targets.

◆ operator<<()

template<class UserType , class UsedType >
Myself& IlsUsesList< UserType, UsedType >::operator<< ( CUsedTypePR  newe)

Adds an item to the list.

\short Adds an object to the list.
Exceptions
IlsMaxCardViolatedIf the maximal cardinality has been reached.
IlsUnownedUseIf the specified object is neither an owned object nor an entity, and if the member function IlsModel::IsIntegrityChecked returns IlsTrue.
IlsUpdateForbiddenif the member function isUpdateAllowed returns IlsFalse for the type in which the relation is declared.

◆ remove() [1/2]

template<class UserType , class UsedType >
Myself& IlsUsesList< UserType, UsedType >::remove ( CUsedTypePR  olde)
\short Removes an object from the list according

to the specified cut instruction.

Exceptions
IlsUpdateForbiddenIf the member function isUpdatedAllowed() returns IlsFalse for the type in which the relation is declared.
IlsMinCardViolatedIf the minimal cardinality has been reached.
IlsNotFoundIf the item to be removed does not belong to the list.

◆ remove() [2/2]

template<class UserType , class UsedType >
Myself& IlsUsesList< UserType, UsedType >::remove ( Partial ,
IlsBoolean  weak = IlsFalse 
)
\short Removes the argument \c Partial from the list.
\short Removes an object from the list according

to the specified cut instruction.

Exceptions
IlsUpdateForbiddenIf the member function isUpdatedAllowed() returns IlsFalse for the type in which the relation is declared.
IlsMinCardViolatedIf the minimal cardinality has been reached.
IlsNotFoundIf the item to be removed does not belong to the list.