Server
API Reference Guide
Product Documentation:

Visualization Server
Documentation Home
List of all members | Public Types | Public Member Functions
IlsOwnsFixedArray< OwnerType, OwnedType, size > Class Template Reference

Fixed arrays of ownership relations. More...

#include <ilserver/model.h>

Inheritance diagram for IlsOwnsFixedArray< OwnerType, OwnedType, size >:
IlsArrayRelation IlsOptionalRelation

Public Types

typedef IlsOwnsFixedArray< OwnerType, OwnedType, size > Myself
 Myself is the type of the instantiated template class.
 
typedef IlsIndexedPartial< OwnerType, OwnedType, MyselfPartial
 This class is an intermediate class that stores array elements.
 

Public Member Functions

 IlsOwnsFixedArray (OwnerType &owner, IlsRelationId identifier=IlsDefaultRelationId, IlsActivity activity=IlsModel::GetDefaultActivity(), IlsBoolean mandatory=IlsFalse)
 Constructor. More...
 
virtual ~IlsOwnsFixedArray ()
 This destructor breaks all relations stored in the array.
 
Myselfclear ()
 Sets all the array elements to zero. More...
 
virtual void cut (unsigned int rank, ILS_CUT_DIRECTIVE=ILS_ALL)
 
IlsActivity getActivity () const
 
virtual IlsViewedgetIdentifiedElement (const IlsString &id) const
 This virtual member function is used to retrieve an identified object from the relation. More...
 
OwnerType & getOwner () const
 Returns the owner of the relation.
 
OwnedType ** getRemoved (int &)
 During a notification phase, this member function returns an array of pointers to the objects that have been removed from the array 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.
 
Partialoperator[] (int rank)
 
- Public Member Functions inherited from IlsArrayRelation
int * getAdded (int &s)
 During a notification phase, this member function returns an arrays of indices corresponding to the elements that have been added to the array since the last notification phase. More...
 
IlsBoolean isModified ()
 During a notification phase, this member function returns IlsTrue if the array-relation has been modified since the last notification phase. More...
 
- Public Member Functions inherited from IlsOptionalRelation
IlsRelationId getIdentifier () const
 
IlsBoolean isMandatory ()
 Returns IlsTrue if the relation is mandatory. Otherwise, it returns IlsFalse. When a relation is mandatory, a cut applied to the target of the relation is propagated to its origin. By default, the function returns IlsFalse for n-ary relations and IlsTrue for unary relations.
 

Detailed Description

template<class OwnerType, class OwnedType, int size>
class IlsOwnsFixedArray< OwnerType, OwnedType, size >

Fixed arrays of ownership relations.

Template Parameters
OwnerTypeClass that contains the relation,
OwnedTypeClass of the targets of the relation.
sizeSize of the array.

Library: server

See also
IlsEntity, IlsObject, IlsOwns, IlsOwnsDynamicArray, IlsOwnsFixedArray::Partial, IlsOwnsList, IlsOwnsSet.

Constructor & Destructor Documentation

◆ IlsOwnsFixedArray()

template<class OwnerType , class OwnedType , int size>
IlsOwnsFixedArray< OwnerType, OwnedType, size >::IlsOwnsFixedArray ( OwnerType &  owner,
IlsRelationId  identifier = IlsDefaultRelationId,
IlsActivity  activity = IlsModel::GetDefaultActivity(),
IlsBoolean  mandatory = IlsFalse 
)

Constructor.

Parameters
ownerA reference to the owner object.
identifierRepresents the relation identifier. It behaves like a numeric type and is generally used to invert relations. Its default value is IlsDefaultRelationId.
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.
mandatoryIndicates whether the relation is mandatory. For details, see the function isMandatory() documented below.

Member Function Documentation

◆ clear()

template<class OwnerType , class OwnedType , int size>
Myself& IlsOwnsFixedArray< OwnerType, OwnedType, size >::clear ( )

Sets all the array elements to zero.

Exceptions
IlsUpdateForbiddenIf the member function IlsObject::isUpdateAllowed() returns IlsFalse for the type in which the relation is declared.

◆ cut()

template<class OwnerType , class OwnedType , int size>
virtual void IlsOwnsFixedArray< OwnerType, OwnedType, size >::cut ( unsigned int  rank,
ILS_CUT_DIRECTIVE  = ILS_ALL 
)
virtual
\short Is called when a cut is applied

to the target of the relation.

◆ getActivity()

template<class OwnerType , class OwnedType , int size>
IlsActivity IlsOwnsFixedArray< OwnerType, OwnedType, size >::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.

◆ getIdentifiedElement()

template<class OwnerType , class OwnedType , int size>
virtual IlsViewed* IlsOwnsFixedArray< OwnerType, OwnedType, size >::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.

◆ getRemoved()

template<class OwnerType , class OwnedType , int size>
OwnedType** IlsOwnsFixedArray< OwnerType, OwnedType, size >::getRemoved ( int &  )

During a notification phase, this member function returns an array of pointers to the objects that have been removed from the array since the last notification phase.

It returns an empty array if no element has been removed from the array. The argument gives 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 [].

◆ operator[]()

template<class OwnerType , class OwnedType , int size>
Partial& IlsOwnsFixedArray< OwnerType, OwnedType, size >::operator[] ( int  rank)
\short Returns the \c i-th array element. \c Partial can

be assigned the type OwnedTypeP.

Exceptions
IlsSizeViolationIf i is greater than the size specified for the array (minus 1).