List of uses relations.
More...
#include <ilserver/model.h>
|
| IlsUsesList (UserType &user, IlsRelationId identifier=IlsDefaultRelationId, IlsActivity activity=IlsModel::GetDefaultActivity(), IlsCardinality mincard=0, IlsCardinality maxcard=ILS_UNLIMITED_MAXCARD, Initial &targets=(*new Initial()), IlsBoolean check_card=IlsTrue) |
| Constructor. More...
|
|
virtual | ~IlsUsesList () |
| This destructor breaks all relations in the list.
|
|
Myself & | clear () |
|
Myself & | cons (CUsedTypePR) |
|
virtual void | cut (Partial &) |
|
IlsActivity | getActivity () const |
|
UsedType ** | getAdded (int &) |
| During a notification phase, this member function returns an array of pointers to the items that have been added to the list since the last notification phase. More...
|
|
CUsedTypePR | getFirst () |
|
virtual IlsViewed * | getIdentifiedElement (const IlsString &id) const |
| This virtual member function is used to retrieve an identified object from the relation. More...
|
|
CUsedTypePR | getLast () |
|
UsedType ** | getRemoved (int &) |
| During a notification phase, this member function returns an array of pointers to the items that have been removed from the list since the last notification phase. More...
|
|
UserType & | getUser () const |
|
virtual IlsBoolean | hasElement (IlsViewed &) const |
| This virtual member function returns IlsTrue if the element is a target of the relation or IlsFalse otherwise.
|
|
IlsBoolean | isIn (CUsedTypePR e) |
| Returns IlsTrue if the object pointed to belongs to the list.
|
|
Myself & | operator<< (CUsedTypePR newe) |
|
CUsedTypePR | operator[] (int i) const |
| Returns the i -th list element.
|
|
Myself & | remove (CUsedTypePR olde) |
|
Myself & | remove (Partial &, IlsBoolean weak=IlsFalse) |
|
IlsRelationId | getIdentifier () const |
|
unsigned int | getLength () const |
| Returns the number of objects in the list.
|
|
IlsCardinality | getMaxCard () const |
|
IlsCardinality | getMinCard () const |
|
IlsBoolean | isLengthModified () |
| During a notification phase, this member function returns IlsTrue if the number of objects in the list has been modified since the last notification phase.
|
|
IlsBoolean | isModified () |
| During a notification phase, this member function returns IlsTrue if the list relation has been modified since the last notification phase, that is, if one or more items have been added to, or removed from, the list.
|
|
template<class UserType, class UsedType>
class IlsUsesList< UserType, UsedType >
List of uses relations.
- Template Parameters
-
UserType | Class that contains the relation. |
UsedType | Class of the targets of the relation. |
Library: server
Rogue Wave Server lets you declare use relations among object classes. Use relations are relations in which one particular object can be used by any number of other objects. The user object can also use one or more other objects. One-to-many relations can be defined as list-relations or as set-relations. Unlike set-relations, target objects in list-relations are listed in sequential order. Such relations are declared within the user class as instances of the class template IlsUsesList
.
- See also
IlsDefaultRelationId
, IlsDerived
, IlsEntity
, IlsMoveDirective
, IlsObject
, IlsUses
, IlsUsesDynamicArray
, IlsUsesFixedArray
, IlsUsesList::Initial
, IlsUsesList::ConstIterator
, IlsUsesList::Iterator
, IlsUsesList::Partial
, IlsUsesList::Position
, IlsUsesSet
, IlsRelationId
.
◆ Initial
template<class UserType , class UsedType >
This type provides a list of used objects when the relation is created.
This list must contain at least as many elements as specified for the minimal cardinality.
◆ IlsUsesList()
template<class UserType , class UsedType >
Constructor.
- Parameters
-
user | A reference to the user object. |
identifier | A relation identifier of type IlsRelationId . This argument defaults to 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 function IlsModel::GetDefaultActivity() , which is ILS_INACTIVE by default. |
mincard | The minimal cardinality of the list. This argument is optional and defaults to zero. |
maxcard | The maximal cardinality, which can be an unsigned integer or indeterminate. This argument is optional and defaults to ILS_UNLIMITED_MAXCARD . |
targets | a list of objects. Its default value, newInitial, creates an empty list. |
check_card | specifies whether cardinalities should be checked at object construction. |
- Exceptions
-
IlsMinCardViolated | If the number of objects in targets is lower than the value assigned to mincard. |
IlsMaxCardViolated | If the number of objects in targets is greater than the value of maxcard. |
◆ clear()
template<class UserType , class UsedType >
\short Empties the list.
- Exceptions
-
IlsMinCardViolated | If the minimal cardinality is different from zero. The number of items remaining in the list will be equal to the minimal cardinality specified. |
IlsUpdateForbidden | If the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
◆ cons()
template<class UserType , class UsedType >
\short Adds an object to the list.
- Exceptions
-
◆ cut()
template<class UserType , class UsedType >
\short Is called when a cut is applied to the target of the relation.
◆ getActivity()
template<class UserType , class UsedType >
\short Returns \c ILS_ACTIVE if the relation has
been set as active. Otherwise, it returns \c ILS_INACTIVE.
For details, see the constructor.
◆ getAdded()
template<class UserType , class UsedType >
UsedType** IlsUsesList< UserType, UsedType >::getAdded |
( |
int & |
| ) |
|
During a notification phase, this member function returns an array of pointers to the items that have been added to the list since the last notification phase.
It returns an empty array if no object has been added to the list-relation. The argument accepts 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
[].
◆ getFirst()
template<class UserType , class UsedType >
\short Returns the first item of the list.
- Exceptions
-
◆ getIdentifiedElement()
template<class UserType , class UsedType >
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.
◆ getLast()
template<class UserType , class UsedType >
\short Returns the last item of the list.
- Exceptions
-
◆ getRemoved()
template<class UserType , class UsedType >
UsedType** IlsUsesList< UserType, UsedType >::getRemoved |
( |
int & |
| ) |
|
During a notification phase, this member function returns an array of pointers to the items that have been removed from the list since the last notification phase.
It returns an empty array if no object has been removed from the list-relation. The argument accepts 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
[].
◆ getUser()
template<class UserType , class UsedType >
UserType& IlsUsesList< UserType, UsedType >::getUser |
( |
| ) |
const |
\short Returns a reference to the user object.
This function is useful especially in the case of derived relations.
◆ NewInitial()
template<class UserType , class UsedType >
\short Builds an empty list which is used
by the constructor as the default value of the argument targets.
◆ operator<<()
template<class UserType , class UsedType >
Adds an item to the list.
\short Adds an object to the list.
- Exceptions
-
◆ remove() [1/2]
template<class UserType , class UsedType >
\short Removes an object from the list according
to the specified cut
instruction.
- Exceptions
-
IlsUpdateForbidden | If the member function isUpdatedAllowed() returns IlsFalse for the type in which the relation is declared. |
IlsMinCardViolated | If the minimal cardinality has been reached. |
IlsNotFound | If the item to be removed does not belong to the list. |
◆ remove() [2/2]
template<class UserType , class UsedType >
\short Removes the argument \c Partial from the list.
\short Removes an object from the list according
to the specified cut
instruction.
- Exceptions
-
IlsUpdateForbidden | If the member function isUpdatedAllowed() returns IlsFalse for the type in which the relation is declared. |
IlsMinCardViolated | If the minimal cardinality has been reached. |
IlsNotFound | If the item to be removed does not belong to the list. |