IlsUsesFixedArray
Category
Modeling class template
Inheritance Path
IlsViewedRel➥ IlsUsesFixedArray Description
Rogue Wave Server lets you declare fixed arrays of use relations. Such relations are declared within the user class as instances of the class template IlsUsesFixedArray.
UserType and
UsedType must both derive directly or transitively from
IlsEntity or
IlsObject. Derivation must be public.
Library
Synopsis
template<class UserType, class UsedType, int size>
class IlsUsesFixedArray
{
public:
(UserType& user,
IlsRelationId identifier=IlsDefaultRelationId,
IlsActivity activity=IlsModel::GetDefaultActivity(),
IlsBoolean mandatory=IlsFalse);
virtual void
cut(unsigned int rank)
};
Constructor
IlsUsesFixedArray
(UserType& user,
IlsRelationId identifier=IlsDefaultRelationId,
IlsActivity activity=IlsModel::GetDefaultActivity(),
IlsBoolean mandatory=IlsFalse);
This constructor takes the following arguments:
The first argument is a reference to the user object.
The second argument is of type
IlsRelationId. It represents the relation identifier and behaves like a numeric type. Its default value is
IlsDefaultRelationId. It is generally used to invert relations.
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 argument
mandatory specifies whether the relation is mandatory. For details, see the member function
isMandatory.
Destructor
virtual ~IlsUsesFixedArray();
This destructor breaks all relations stored in the array.
Member Functions
IlsActivity getActivity() cons;
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 a 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, this function returns IlsFalse.
UserType& getUser();
This member function returns the user of the relation array.
IlsRelationId getIdentifier();
This member function returns the relation identifier.
[virtual] virtual void cut(unsigned int rank);
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.
It throws the exception
IlsUpdateForbidden if the member function
isUpdateAllowed returns
IlsFalse for the type in which the relation is declared.
Notification Member Functions
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 the following events occurred:
Addition of one or more elements to the array-relation;
Removal of one or more elements from the array-relation.
int* getAdded(int&);
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 [].
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 how_many gives 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 [].
Operators
Partial& operator[](int i);
This operator returns the i-th array element. Partial can be assigned the type UsedTypeP.
If
i is greater than the size specified for the array (minus 1), the exception
IlsSizeViolation is thrown.
See Also
Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.