Server
API Reference Guide
Product Documentation:

Visualization Server
Documentation Home
List of all members | Public Types | Public Member Functions
IlsOwns< OwnerType, OwnedType > Class Template Reference

One-to-one ownership relation. More...

#include <ilserver/model.h>

Inheritance diagram for IlsOwns< OwnerType, OwnedType >:
IlsSimpleRelation IlsOptionalRelation IlsViewedRel

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.
 
Myselfclear ()
 
virtual void cut (ILS_CUT_DIRECTIVE=ILS_ALL)
 
IlsRelationId getIdentifier () const
 Returns the relation identifier.
 
OwnerType & getOwner () const
 
COwnedTypePR getValueQuietly () const
 
IlsBoolean isMandatory ()
 Returns IlsTrue if a relation is mandatory. Otherwise, it returns IlsFalse. More...
 
Myselfset (COwnedTypePR target, ILS_CUT_DIRECTIVE=ILS_ALL, IlsBoolean avoid_notify=IlsFalse)
 
Operators

These operators let you use ownership relations as if they were pointers.

 operator COwnedTypePR ()
 
OwnedType & operator* ()
 
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)
 
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)
 
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.
 
- 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 IlsViewedgetIdentifiedElement (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.
 

Detailed Description

template<class OwnerType, class OwnedType>
class IlsOwns< OwnerType, OwnedType >

One-to-one ownership relation.

Template Parameters
OwnerTypeClass that contains the relation. The OwnerType must derive directly or transitively from IlsObject or IlsEntity. Derivation must be public.
OwnedTypeClass 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.

See also
IlsException, IlsEntity, IlsObject, IlsOwnsList, IlsOwnsDynamicArray, IlsOwnsFixedArray, IlsOwnsSet, IlsUses, IlsUsesList, IlsUsesSet.

Constructor & Destructor Documentation

◆ IlsOwns()

template<class OwnerType , class OwnedType >
IlsOwns< OwnerType, OwnedType >::IlsOwns ( OwnerType &  owner,
COwnedTypePR  target = (OwnedType *) 0,
IlsRelationId  identifier = IlsDefaultRelationId,
IlsActivity  activity = IlsModel::GetDefaultActivity(),
IlsBoolean  mandatory = IlsTrue 
)

Constructor.

Parameters
ownera reference to the owner object.
targeta 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.
identifierrepresents the relation identifier. It behaves like a numeric type and is generally used to invert relations. Its default value is IlsDefaultRelationId.
activityspecifies 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.
mandatoryspecifies whether the relation is mandatory. For details, see the function isMandatory() documented below.

Member Function Documentation

◆ clear()

template<class OwnerType , class OwnedType >
Myself& IlsOwns< OwnerType, OwnedType >::clear ( )
\short Sets the relation to zero.
Exceptions
IlsUpdateForbiddenIf the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared.

◆ cut()

template<class OwnerType , class OwnedType >
virtual void IlsOwns< OwnerType, OwnedType >::cut ( ILS_CUT_DIRECTIVE  = ILS_ALL)
virtual
\short Breaks the relation.

This function can be overloaded.

Exceptions
IlsUpdateForbiddenIf the function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared.

◆ getOwner()

template<class OwnerType , class OwnedType >
OwnerType& IlsOwns< OwnerType, OwnedType >::getOwner ( ) const
\short Returns a reference to the owner object.

This function is useful especially in the case of derived relations.

◆ getValueQuietly()

template<class OwnerType , class OwnedType >
COwnedTypePR IlsOwns< OwnerType, OwnedType >::getValueQuietly ( ) const
\short 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.

◆ isMandatory()

template<class OwnerType , class OwnedType >
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.

◆ operator COwnedTypePR()

template<class OwnerType , class OwnedType >
IlsOwns< OwnerType, OwnedType >::operator COwnedTypePR ( )
\short Converts the relation to a smart pointer to an

object of the OwnedType.

◆ operator!=()

template<class OwnerType , class OwnedType >
IlsBoolean IlsOwns< OwnerType, OwnedType >::operator!= ( COwnedTypePR  rhs)
\short Checks whether the relation is not equal to the

specified smart pointer.

◆ operator*()

template<class OwnerType , class OwnedType >
OwnedType& IlsOwns< OwnerType, OwnedType >::operator* ( )
\short Returns a reference to the owned object.
Exceptions
IlsNullPointerDereferencingIf the relation is null.

◆ operator->()

template<class OwnerType , class OwnedType >
OwnedType* IlsOwns< OwnerType, OwnedType >::operator-> ( )

This dereference operator returns the target of the relation.

Exceptions
IlsNullPointerDereferencingIf the relation is null.

◆ operator==()

template<class OwnerType , class OwnedType >
IlsBoolean IlsOwns< OwnerType, OwnedType >::operator== ( Myself rhs)
\short Checks whether the relation is equal to another

relation.

◆ set()

template<class OwnerType , class OwnedType >
Myself& IlsOwns< OwnerType, OwnedType >::set ( COwnedTypePR  target,
ILS_CUT_DIRECTIVE  = ILS_ALL,
IlsBoolean  avoid_notify = IlsFalse 
)
\short Equivalent to an assignment. It can be

used as a shortcut when you derive relations.

Exceptions
IlsUpdateForbiddenIf the member function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared.
IlsOwnershipCycleIf cycles are detected among ownership relations.
IlsAlreadyInsertedIf the supplied object is already owned.