IlsOwnsFixedArray
 
IlsOwnsFixedArray
Category 
Modeling class template
Inheritance Path 
IlsViewedRel
IlsOwnsFixedArray
Description 
Rogue Wave Server lets you declare fixed arrays of ownership relations. Such relations are declared inside the owner class as instances of the class template IlsOwnsFixedArray.
OwnerType must derive directly or transitively from IlsEntity or IlsObject. OwnedType must derive directly or transitively from IlsObject. Derivation must be public.
Library 
<server>
Header File 
#include <ilserver/model.h>
Synopsis 
template<class OwnerType,class OwnedType,int size>
class IlsOwnsFixedArray
{
public:
IlsOwnsFixedArray
(OwnerType& owner,
IlsRelationId identifier=IlsDefaultRelationId,
IlsActivity activity=IlsModel::GetDefaultActivity(),
IlsBoolean mandatory=IlsFalse);
virtual ~IlsOwnsFixedArray();
IlsActivity getActivity() const;
IlsBoolean isMandatory();
IlsBoolean isModified();
int* getAdded(int& how-many);
OwnedType** getRemoved(int& how-many);
OwnerType& getOwner();
IlsRelationId getIdentifier() const;
virtual void cut(unsigned int rank, ILS_CUT_DIRECTIVE=ILS_ALL);
Myself& clear();
Partial& operator[](int);
};
Constructor 
IlsOwnsFixedArray
(OwnerType& owner,
IlsRelationId identifier=IlsDefaultRelationId,
IlsActivity activity=IlsModel::GetDefaultActivity(),
IlsBoolean mandatory=IlsFalse);
This constructor takes the following four arguments:
*A reference to the owner object.
*The second argument of type IlsRelationId represents the relation identifier. It behaves like a numeric type and is generally used to invert relations. Its default value is IlsDefaultRelationId.
*The argument 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.
*The last argument indicates whether the relation is mandatory. For details, see the function isMandatory documented below.
Destructor 
virtual ~IlsOwnsFixedArray();
This destructor breaks all relations stored in the array.
Member Functions 
IlsActivity getActivity()const;
This member function returns ILS_ACTIVE if the relation has been set as active. Otherwise, it returns ILS_INACTIVE. For details, see the constructor.
IlsBoolean isMandatory();
This member function returns IlsTrue if the relation is mandatory. Otherwise, it returns IlsFalse. When a relation is mandatory, a cut applied to the target of this relation is propagated to its origin. By default, the function returns IlsFalse.
OwnerType& getOwner();
This member function returns the owner of the relation.
IlsRelationId getIdentifier() const;
This member function returns the identifier of the relation.
[virtual] void cut(unsigned int rank, ILS_CUT_DIRECTIVE=ILS_ALL);
This virtual member function is called when a cut is applied to the target of the relation.
Myself& clear();
This member function sets all the array elements to zero.
This function throws the exception IlsUpdateForbidden if the member function IlsObject::isUpdateAllowed returns IlsFalse for the type in which the relation is declared.
Notification
IlsBoolean isModified();
During a notification phase, this member function returns IlsTrue if the relation array has been modified since the last notification phase, that is, if one of these events has occurred:
*Addition of one or more elements to the array-relation;
*Removal of one or more elements from the array-relation.
int* getAdded(int& how_many);
During a notification phase, this member function returns an array of indices corresponding to the elements that have been added to the array since the last notification phase. It returns an empty array if no element has been added to the array. The argument how_many accepts the size of the array as a return value. You must explicitly destroy this array when you no longer use it. To do so, use delete with square brackets [].
OwnedType** getRemoved(int& how_many);
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 how_many 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 [].
Operators 
Partial& operator[](int);
This operator returns the i-th array element. Partial can be assigned the type OwnedTypeP.
If i is greater than the size specified for the array (minus 1), the exception IlsSizeViolation is thrown.
See Also 
IlsEntity, IlsObject, IlsOwns, IlsOwnsDynamicArray, IlsOwnsFixedArray::Partial, IlsOwnsList, IlsOwnsSet

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.