Dynamic arrays of ownership relations. More...
#include <ilserver/model.h>
Public Types | |
typedef IlsOwnsDynamicArray< OwnerType, OwnedType > | Myself |
Myself is the type of the instantiated template class. | |
typedef IlsIndexedPartial< OwnerType, OwnedType, Myself > | Partial |
This class is an intermediate class that stores array elements. | |
Public Member Functions | |
IlsOwnsDynamicArray (OwnerType &owner, unsigned int size=0, IlsRelationId identifier=IlsDefaultRelationId, IlsActivity activity=IlsModel::GetDefaultActivity(), IlsBoolean mandatory=IlsFalse) | |
Constructor. More... | |
virtual | ~IlsOwnsDynamicArray () |
This destructor breaks all relations stored in the array. | |
Myself & | clear () |
Sets all the array elements to zero. More... | |
virtual void | cut (unsigned int rank, ILS_CUT_DIRECTIVE=ILS_ALL) |
Is called when a cut is applied to the target of the relation. | |
IlsActivity | getActivity () const |
Returns ILS_ACTIVE if the relation has been set as active. Otherwise, it returns ILS_INACTIVE . More... | |
virtual IlsViewed * | getIdentifiedElement (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 &) |
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) |
Returns the i -th array element. Partial can be assigned the type OwnedTypeP . More... | |
Myself & | renew (unsigned int=0) |
Lets you allocate or create a new array with a specified size. More... | |
![]() | |
unsigned int | getSize () const |
Lets you get the size of the relation array at a given time. | |
![]() | |
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... | |
![]() | |
IlsRelationId | getIdentifier () const |
Returns the relation identifier. | |
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 arrays of ownership relations.
OwnerType | Class that contains the relation, |
OwnedType | Class of the targets of the relation. |
Library: server
IlsOwnsDynamicArray< OwnerType, OwnedType >::IlsOwnsDynamicArray | ( | OwnerType & | owner, |
unsigned int | size = 0 , |
||
IlsRelationId | identifier = IlsDefaultRelationId , |
||
IlsActivity | activity = IlsModel::GetDefaultActivity() , |
||
IlsBoolean | mandatory = IlsFalse |
||
) |
Constructor.
owner | A reference to the owner-object. |
size | Specifies the maximum size of the array. |
identifier | Represents the relation Identifier. It behaves like a numeric type and is generally used to invert relations. Its default value is IlsDefaultRelationId . |
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. |
mandatory | Indicates whether the relation is mandatory. For details, see the member function isMandatory() documented below. |
Myself& IlsOwnsDynamicArray< OwnerType, OwnedType >::clear | ( | ) |
Sets all the array elements to zero.
IlsUpdateForbidden | If the member function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
IlsActivity IlsOwnsDynamicArray< OwnerType, OwnedType >::getActivity | ( | ) | const |
Returns ILS_ACTIVE
if the relation has been set as active. Otherwise, it returns 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.
OwnedType** IlsOwnsDynamicArray< OwnerType, 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.
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& IlsOwnsDynamicArray< OwnerType, OwnedType >::operator[] | ( | int | rank | ) |
Returns the i
-th array element. Partial
can be assigned the type OwnedTypeP
.
IlsSizeViolation | If i is greater than the size specified for the array (minus 1). |
Myself& IlsOwnsDynamicArray< OwnerType, OwnedType >::renew | ( | unsigned | int = 0 | ) |
Lets you allocate or create a new array with a specified size.
It takes the new size of the array as its argument. By default, the value of the argument is zero. Smart pointers to objects contained in the old array are erased and replaced with null smart pointers in the new array.
© Copyright 2018, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.