Dynamic array of uses relations. More...
#include <ilserver/model.h>
Public Types | |
typedef IlsUsesDynamicArray< UserType, UsedType > | Myself |
Myself is the type of the instantiated template class. | |
typedef IlsIndexedPartial< UserType, UsedType, Myself > | Partial |
This class is an intermediate class that stores array elements. | |
Public Member Functions | |
IlsUsesDynamicArray (UserType &user, unsigned int size=0, IlsRelationId identifier=IlsDefaultRelationId, IlsActivity activity=IlsModel::GetDefaultActivity(), IlsBoolean mandatory=IlsFalse) | |
Constructor. More... | |
virtual | ~IlsUsesDynamicArray () |
This destructor breaks all relations stored in the array. | |
Myself & | clear () |
virtual void | cut (unsigned int rank) |
Is called when a cut is applied to the target of the relation. | |
IlsActivity | getActivity () const |
virtual IlsViewed * | getIdentifiedElement (const IlsString &id) const |
This virtual member function is used to retrieve an identified object from the relation. More... | |
UsedType ** | 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... | |
UserType & | getUser () const |
Returns the user of the array-relation. | |
virtual IlsBoolean | hasElement (IlsViewed &) const |
This virtual member function returns IlsTrue if the element is a target of the relation or IlsFalse otherwise. | |
Partial & | operator[] (int rank) |
Myself & | renew (unsigned int=0) |
Public Member Functions inherited from IlsDynamicArrayRelation | |
unsigned int | getSize () const |
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. | |
Dynamic array of uses relations.
Library: server
IlsUsesDynamicArray< UserType, UsedType >::IlsUsesDynamicArray | ( | UserType & | user, |
unsigned int | size = 0 , |
||
IlsRelationId | identifier = IlsDefaultRelationId , |
||
IlsActivity | activity = IlsModel::GetDefaultActivity() , |
||
IlsBoolean | mandatory = IlsFalse |
||
) |
Constructor.
\param user A reference to the user object. \param size Specifies the maximum size of the array.
identifier | It represents the relation identifier and behaves like a numeric type. Its default value is 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. |
mandatory | Specifies whether the relation is mandatory. For details, see the member function isMandatory() . |
Myself& IlsUsesDynamicArray< UserType, UsedType >::clear | ( | ) |
\short Sets all the array elements to zero.
IlsUpdateForbidden | If the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
IlsActivity IlsUsesDynamicArray< 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.
|
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.
Reimplemented from IlsViewedRel.
UsedType** IlsUsesDynamicArray< UserType, UsedType >::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 [].
Partial& IlsUsesDynamicArray< UserType, UsedType >::operator[] | ( | int | rank | ) |
\short Returns the `i`-th array element.
Partial
can be assigned the type UsedTypeP
.
IlsSizeViolation | If i is greater than the size specified for the array (minus 1). |
Myself& IlsUsesDynamicArray< UserType, UsedType >::renew | ( | unsigned int | = 0 | ) |
\short Lets you allocate or create a new array
with a specified size.
It takes the new array size as its argument with \c 0 as the default value. Smart pointers to objects contained in the old array are erased and replaced with null smart pointers in the new array.
IlsUpdateForbidden | If the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |