Inverted relation list.
More...
#include <ilserver/model.h>
|
| IlsInvertedRelationList (TargetType &target, IlsActivity activity=IlsModel::GetDefaultActivity(), IlsCardinality mincard=0, IlsCardinality maxcard=ILS_UNLIMITED_MAXCARD, Initial &targets=(*new Initial()), IlsBoolean check_card=IlsTrue) |
|
virtual IlsViewed * | getIdentifiedElement (const IlsString &id) const |
| This virtual member function is used to retrieve an identified object from the relation. More...
|
|
virtual IlsBoolean | hasElement (IlsViewed &) const |
| This virtual member function returns IlsTrue if the element is a target of the relation or IlsFalse otherwise.
|
|
|
Myself & | cons (OriginType *newe) |
|
Myself & | operator<< (OriginType *newe) |
| This insertion operator adds an object to the list. More...
|
|
Myself & | remove (OriginType *olde) |
|
Myself & | operator>> (OriginType *olde) |
| This extraction operator removes an object from the list. More...
|
|
Myself & | clear () |
|
virtual void | reset () |
|
OriginType ** | getPointerArray (int &) |
|
IlsBoolean | notify (IlsView *, IlsRelSubscribing *, ILS_NOTIFY_STATE=ILS_NOTIFY_DEFAULT) |
|
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.
|
|
|
OriginType ** | getAdded (int &) |
| During a notification phase, this member function returns an array of pointers to the objects that have been added to the list since the last notification phase. More...
|
|
OriginType ** | getRemoved (int &) |
| During a notification phase, this member function returns an array of pointers to the objects that have been removed from the list since the last notification phase. More...
|
|
virtual IlsBoolean | fillViewedTable (IlsPtrArray< IlsViewed > &) |
| During a notification phase, this member function returns an array of pointers to the objects that have been added to the list since the last notification phase. More...
|
|
IlsViewed * | Ils2Viewed (OriginType *) |
| During a notification phase, this member function returns an array of pointers to the objects that have been added to the list since the last notification phase. More...
|
|
template<class TargetType, class OriginType>
class IlsInvertedRelationList< TargetType, OriginType >
Inverted relation list.
- Template Parameters
-
TargetType | Target class of the direct relation. |
OriginType | Class that contains the direct relation. |
Library: server
Rogue Wave Server lets you invert several relations by maintaining a list of back pointers to the origins of a set of relations. This list of pointers is declared as an instance of the class template IlsInvertedRelationList
and maintained by means of the functions setContext()
and unsetContext()
. Modifying an inverted relation may trigger the recomputation of derived data members that depend on that relation.
The IlsInvertedRelationList
template makes a forward declaration of the function IlsViewed* Ils2Viewed(OriginType*)
and uses it in its implementation. This is to prevent the compiler from requiring visibility on the class OriginType
when instantiating the inverted relation template. The implementation of the Ils2Viewed()
function is expanded by the macro ILS_OBJECT_DECL()
or its derivatives. If you do not want to use that macro because the type OriginType
is not notified by views, you can define your own function in a source of your application that has visibility on the class OriginType
, as follows:
- Related Pattern
Bridge
- See also
IlsException
, IlsDerived
, IlsEntity
, IlsInvertedRelationList::Initial
, IlsInvertedRelationList::ConstIterator
, IlsInvertedRelationList::Iterator
, IlsInvertedRelationList::Position
, IlsObject
, IlsOwnsList
, IlsUsesList
, setContext()
, unsetContext()
.
◆ Initial
template<class TargetType , class OriginType >
This class provides a list of origin objects when a relation is created.
This list must contain at least as many items as specified for the minimal cardinality.
◆ IlsInvertedRelationList()
template<class TargetType , class OriginType >
This constructor takes the following arguments:
- A reference to the target object (that is, to the object in which the relation is declared).
- 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 static member function IlsModel::GetDefaultActivity()
, which is ILS_INACTIVE
by default.
- The minimal cardinality of the list: This argument is optional and defaults to zero.
- The maximal cardinality of the list. The maximal cardinality can be an unsigned integer, or can be indetermined. This argument is optional and defaults to
ILS_UNLIMITED_MAXCARD
.
- The argument targets is a list of objects. Its default value,
NewInitial()
, creates an empty list.
- The argument
check_card
specifies whether cardinalities should be checked at object construction.
- Exceptions
-
◆ clear()
template<class TargetType , class OriginType >
\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. |
◆ cons()
template<class TargetType , class OriginType >
\short Adds the specified object to the list.
- Exceptions
-
IlsMaxCardViolated | If this function is called when the maximum cardinality has been reached. |
◆ fillViewedTable()
template<class TargetType , class OriginType >
During a notification phase, this member function returns an array of pointers to the objects 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.
Implements IlsViewedRel.
◆ getAdded()
template<class TargetType , class OriginType >
During a notification phase, this member function returns an array of pointers to the objects 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.
◆ getFirst()
template<class TargetType , class OriginType >
\short Returns the first item of the list.
- Exceptions
-
◆ getIdentifiedElement()
template<class TargetType , class OriginType >
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 TargetType , class OriginType >
\short Returns the last item of the list.
- Exceptions
-
◆ getPointerArray()
template<class TargetType , class OriginType >
\short Adds the specified object to the list.
- Exceptions
-
IlsMaxCardViolated | If this function is called when the maximum cardinality has been reached. |
◆ getRemoved()
template<class TargetType , class OriginType >
During a notification phase, this member function returns an array of pointers to the objects 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.
◆ isIn()
template<class TargetType , class OriginType >
\short Returns \c IlsTrue if the specified item
belongs to the list.
◆ NewInitial()
template<class TargetType , class OriginType >
\short Builds an empty list which is used
by the constructor as the default value of the argument origins
.
◆ notify()
template<class TargetType , class OriginType >
\short Adds the specified object to the list.
- Exceptions
-
IlsMaxCardViolated | If this function is called when the maximum cardinality has been reached. |
Implements IlsViewedRel.
◆ operator<<()
template<class TargetType , class OriginType >
This insertion operator adds an object to the list.
\short Adds the specified object to the list.
- Exceptions
-
IlsMaxCardViolated | If this function is called when the maximum cardinality has been reached. |
◆ operator>>()
template<class TargetType , class OriginType >
This extraction operator removes an object from the list.
\short Removes the specified object from the list.
- Exceptions
-
IlsMinCardViolated | If this function is called when the minimal cardinality has been reached |
IlsNotFound | If removing an object that does not belong to the list. |
◆ remove()
template<class TargetType , class OriginType >
\short Removes the specified object from the list.
- Exceptions
-
IlsMinCardViolated | If this function is called when the minimal cardinality has been reached |
IlsNotFound | If removing an object that does not belong to the list. |
◆ reset()
template<class TargetType , class OriginType >
\short Adds the specified object to the list.
- Exceptions
-
IlsMaxCardViolated | If this function is called when the maximum cardinality has been reached. |
Reimplemented from IlsViewedRel.
◆ Ils2Viewed
template<class TargetType , class OriginType >
During a notification phase, this member function returns an array of pointers to the objects 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.