One-to-one uses relation. More...
#include <ilserver/model.h>
Public Types | |
typedef IlsUses< UserType, UsedType > | Myself |
Myself is the type of the instantiated template class. | |
Public Member Functions | |
IlsUses (UserType &user, CUsedTypePR target=(UsedType *) 0, IlsRelationId identifier=IlsDefaultRelationId, IlsActivity activity=IlsModel::GetDefaultActivity(), IlsBoolean mandatory=IlsTrue) | |
Constructor. More... | |
virtual | ~IlsUses () |
This destructor cuts the relation. | |
Myself & | clear () |
virtual void | cut (ILS_CUT_DIRECTIVE=ILS_ALL) |
IlsRelationId | getIdentifier () const |
Returns the relation identifier. | |
UsedTypeP | getOldValue () |
UserType & | getUser () const |
CUsedTypePR | getValueQuietly () const |
Myself & | set (CUsedTypePR target, IlsBoolean avoid_notify=IlsFalse) |
Operators | |
These operators let you handle relations as if they were pointers. | |
operator CUsedTypePR () | |
UsedType & | operator* () |
IlsBoolean | operator! () |
This logical not operator returns IlsTrue if the relation is null. | |
UsedType * | operator-> () |
This dereference operator returns the target of the relation. More... | |
IlsBoolean | operator== (Myself &rhs) |
IlsBoolean | operator== (CUsedTypePR rhs) |
Checks whether the relation is equal to the specified smart pointer. | |
IlsBoolean | operator!= (Myself &rhs) |
Checks whether the relation is not equal to another relation. | |
IlsBoolean | operator!= (CUsedTypePR rhs) |
Public Member Functions inherited from IlsSimpleRelation | |
IlsBoolean | isModified () |
During a notification phase, this member function returns IlsTrue only if the relation has been modified since the last notification phase. | |
Public Member Functions inherited from IlsOptionalRelation | |
IlsRelationId | getIdentifier () const |
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. | |
Public Member Functions inherited from IlsViewedRel | |
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. | |
IlsBoolean | isViewed () |
This member function returns IlsTrue if at least one regular view (as opposed to a multithreaded view) subscribes to the relation. More... | |
virtual void | onSubscribe (IlsView &) |
This empty virtual member function is called each time a view subscribes to the relation. | |
virtual void | onUnsubscribe (IlsView &) |
This empty virtual member function is called each time the subscription of a view to the relation is canceled. | |
Additional Inherited Members | |
Protected Member Functions inherited from IlsViewedRel | |
IlsViewedRel () | |
This is the protected constructor of the class. | |
One-to-one uses relation.
UserType | Type of the object that contains the relation. |
UsedType | Type of the target object of the relation. |
Library: server
Use relations are relations in which one particular object can be used by any number of other objects, called the users.
With Rogue Wave Server, you can define one-to-one relations, in which the user uses only one other object, and one-to-many relations, in which the user uses several objects. One-to-one use relations are declared inside the user class as instances of the class template IlsUses
.
IlsUses< UserType, UsedType >::IlsUses | ( | UserType & | user, |
CUsedTypePR | target = (UsedType *) 0 , |
||
IlsRelationId | identifier = IlsDefaultRelationId , |
||
IlsActivity | activity = IlsModel::GetDefaultActivity() , |
||
IlsBoolean | mandatory = IlsTrue |
||
) |
Constructor.
user | A reference to the user object. |
target | a smart pointer to the specified used object. This argument is optional. If it is left out, then the relation will contain a null smart pointer. |
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 member function IlsModel::GetDefaultActivity() , which is ILS_INACTIVE by default. |
mandatory | specifies whether the relation is mandatory. For details, see the function isMandatory() . |
\short Sets the relation to zero.
IlsUpdateForbidden | If the member function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
|
virtual |
\short Cuts the relation.
This function can be overloaded.
IlsUpdateForbidden | If the member function isUpdatedAllowed() returns IlsFalse for the type in which the relation is declared. |
\short During a notification phase, this member function returns a smart pointer to the object that was the target of the relation before
the notification phase.
UserType& IlsUses< UserType, UsedType >::getUser | ( | ) | const |
\short Returns a reference to the user object.
This function is useful especially in the case of derived relations.
CUsedTypePR IlsUses< UserType, UsedType >::getValueQuietly | ( | ) | const |
\short Provides quick access to the value of the used type.
It should not be used to evaluate a derived data member or to retrieve a value when using Rogue Wave Server transactions.
IlsUses< UserType, UsedType >::operator CUsedTypePR | ( | ) |
This operator converts the relation to a smart pointer to an object of the UsedType
.
IlsBoolean IlsUses< UserType, UsedType >::operator!= | ( | CUsedTypePR | rhs | ) |
\short Checks whether the relation is not equal to the
specified smart pointer.
UsedType& IlsUses< UserType, UsedType >::operator* | ( | ) |
\short Returns a reference to the used object.
IlsNullPointerDereferencing | If the relation is null. |
UsedType* IlsUses< UserType, UsedType >::operator-> | ( | ) |
This dereference operator returns the target of the relation.
IlsNullPointerDereferencing | If the relation is null. |
IlsBoolean IlsUses< UserType, UsedType >::operator== | ( | Myself & | rhs | ) |
\short Checks whether the relation is equal to another
relation.
Myself& IlsUses< UserType, UsedType >::set | ( | CUsedTypePR | target, |
IlsBoolean | avoid_notify = IlsFalse |
||
) |
\short Equivalent to an assignment. It can be
used as a shortcut when you derive relations.
IlsUpdateForbidden | If the member function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
IlsUnownedUse | If the specified object is neither an owned object nor an entity, and if the member function IlsModel::IsIntegrityChecked() returns IlsTrue . |