One-to-one ownership relation. More...
#include <ilserver/model.h>
Public Types | |
typedef IlsOwns< OwnerType, OwnedType > | Myself |
Myself is the type of the instanciated template class. | |
Public Member Functions | |
IlsOwns (OwnerType &owner, COwnedTypePR target=(OwnedType *) 0, IlsRelationId identifier=IlsDefaultRelationId, IlsActivity activity=IlsModel::GetDefaultActivity(), IlsBoolean mandatory=IlsTrue) | |
Constructor. More... | |
virtual | ~IlsOwns () |
This destructor cuts the relation. | |
Myself & | clear () |
Sets the relation to zero. More... | |
virtual void | cut (ILS_CUT_DIRECTIVE=ILS_ALL) |
Breaks the relation. More... | |
IlsRelationId | getIdentifier () const |
Returns the relation identifier. | |
OwnerType & | getOwner () const |
Returns a reference to the owner object. More... | |
COwnedTypePR | getValueQuietly () const |
Provides quick access to the value of the owned type. More... | |
IlsBoolean | isMandatory () |
Returns IlsTrue if a relation is mandatory. Otherwise, it returns IlsFalse . More... | |
Myself & | set (COwnedTypePR target, ILS_CUT_DIRECTIVE=ILS_ALL, IlsBoolean avoid_notify=IlsFalse) |
Equivalent to an assignment. It can be used as a shortcut when you derive relations. More... | |
Operators | |
These operators let you use ownership relations as if they were pointers. | |
operator COwnedTypePR () | |
Converts the relation to a smart pointer to an object of the OwnedType . | |
OwnedType & | operator* () |
Returns a reference to the owned object. More... | |
IlsBoolean | operator! () |
This logical not operator returns IlsTrue if the relation is null. | |
OwnedType * | operator-> () |
This dereference operator returns the target of the relation. More... | |
IlsBoolean | operator== (Myself &rhs) |
Checks whether the relation is equal to another relation. | |
IlsBoolean | operator== (COwnedTypePR 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!= (COwnedTypePR rhs) |
Checks whether the relation is not equal to the specified smart pointer. | |
Notification | |
OwnedTypeP | getOldValue () |
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. | |
![]() | |
IlsBoolean | isModified () |
During a notification phase, this member function returns IlsTrue only if the relation has been modified since the last notification phase. | |
![]() | |
IlsRelationId | getIdentifier () const |
Returns the relation identifier. | |
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. | |
![]() | |
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 | |
![]() | |
IlsViewedRel () | |
This is the protected constructor of the class. | |
One-to-one ownership relation.
OwnerType | Class that contains the relation. The OwnerType must derive directly or transitively from IlsObject or IlsEntity . Derivation must be public. |
OwnedType | Class of the target of the relation. The OwnedType must derive directly or transitively from IlsObject . Derivation must be public. |
Library: server
Server lets you declare ownership relations among object classes. Ownership relations are relations in which one particular object is owned by at most one other object, called the owner. With Rogue Wave Server, you can define one-to-one relations, in which the owner owns only one other object, and one-to-many relations, in which the owner owns several objects. One-to-one ownership relations are declared inside the owner class as instances of the class template IlsOwns
.
IlsOwns< OwnerType, OwnedType >::IlsOwns | ( | OwnerType & | owner, |
COwnedTypePR | target = (OwnedType *) 0 , |
||
IlsRelationId | identifier = IlsDefaultRelationId , |
||
IlsActivity | activity = IlsModel::GetDefaultActivity() , |
||
IlsBoolean | mandatory = IlsTrue |
||
) |
Constructor.
owner | a reference to the owner object. |
target | a smart pointer to the owned object specified. 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 function IlsModel::GetDefaultActivity() , which is ILS_INACTIVE by default. |
mandatory | specifies whether the relation is mandatory. For details, see the function isMandatory() documented below. |
Sets the relation to zero.
IlsUpdateForbidden | If the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
|
virtual |
Breaks the relation.
This function can be overloaded.
IlsUpdateForbidden | If the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared. |
OwnerType& IlsOwns< OwnerType, OwnedType >::getOwner | ( | ) | const |
Returns a reference to the owner object.
This function is useful especially in the case of derived relations.
COwnedTypePR IlsOwns< OwnerType, OwnedType >::getValueQuietly | ( | ) | const |
Provides quick access to the value of the owned type.
It should not be used to evaluate a derived data member or to retrieve a value when using Rogue Wave Server transactions.
IlsBoolean IlsOwns< OwnerType, OwnedType >::isMandatory | ( | ) |
Returns IlsTrue
if a 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 IlsTrue
.
OwnedType& IlsOwns< OwnerType, OwnedType >::operator* | ( | ) |
Returns a reference to the owned object.
IlsNullPointerDereferencing | If the relation is null. |
OwnedType* IlsOwns< OwnerType, OwnedType >::operator-> | ( | ) |
This dereference operator returns the target of the relation.
IlsNullPointerDereferencing | If the relation is null. |
Myself& IlsOwns< OwnerType, OwnedType >::set | ( | COwnedTypePR | target, |
ILS_CUT_DIRECTIVE | = ILS_ALL , |
||
IlsBoolean | avoid_notify = IlsFalse |
||
) |
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. |
IlsOwnershipCycle | If cycles are detected among ownership relations. |
IlsAlreadyInserted | If the supplied object is already owned. |
© Copyright 2018, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.