Server
API Reference Guide
Product Documentation:

Rogue Wave Server
Documentation Home
List of all members | Public Types | Public Member Functions
IlsUses< UserType, UsedType > Class Template Reference

One-to-one uses relation. More...

#include <ilserver/model.h>

Inheritance diagram for IlsUses< UserType, UsedType >:
IlsSimpleRelation IlsOptionalRelation IlsViewedRel

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.
 
Myselfclear ()
 
virtual void cut (ILS_CUT_DIRECTIVE=ILS_ALL)
 
IlsRelationId getIdentifier () const
 Returns the relation identifier.
 
UsedTypeP getOldValue ()
 
UserType & getUser () const
 
CUsedTypePR getValueQuietly () const
 
Myselfset (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 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 UserType, class UsedType>
class IlsUses< UserType, UsedType >

One-to-one uses relation.

Template Parameters
UserTypeType of the object that contains the relation.
UsedTypeType 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.

See also
IlsException, IlsEntity, IlsObject, IlsOwns, IlsOwnsList, IlsUsesDynamicArray, IlsUsesFixedArray, IlsUsesList.

Constructor & Destructor Documentation

◆ IlsUses()

template<class UserType , class UsedType >
IlsUses< UserType, UsedType >::IlsUses ( UserType &  user,
CUsedTypePR  target = (UsedType *) 0,
IlsRelationId  identifier = IlsDefaultRelationId,
IlsActivity  activity = IlsModel::GetDefaultActivity(),
IlsBoolean  mandatory = IlsTrue 
)

Constructor.

Parameters
userA reference to the user object.
targeta 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.
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 member function IlsModel::GetDefaultActivity(), which is ILS_INACTIVE by default.
mandatoryspecifies whether the relation is mandatory. For details, see the function isMandatory().

Member Function Documentation

◆ clear()

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

◆ cut()

template<class UserType , class UsedType >
virtual void IlsUses< UserType, UsedType >::cut ( ILS_CUT_DIRECTIVE  = ILS_ALL)
virtual
\short Cuts the relation.

This function can be overloaded.

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

◆ getOldValue()

template<class UserType , class UsedType >
UsedTypeP IlsUses< UserType, UsedType >::getOldValue ( )
\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.

◆ getUser()

template<class UserType , class UsedType >
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.

◆ getValueQuietly()

template<class UserType , class UsedType >
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.

◆ operator CUsedTypePR()

template<class UserType , class UsedType >
IlsUses< UserType, UsedType >::operator CUsedTypePR ( )

This operator converts the relation to a smart pointer to an object of the UsedType.

◆ operator!=()

template<class UserType , class UsedType >
IlsBoolean IlsUses< UserType, UsedType >::operator!= ( CUsedTypePR  rhs)
\short Checks whether the relation is not equal to the

specified smart pointer.

◆ operator*()

template<class UserType , class UsedType >
UsedType& IlsUses< UserType, UsedType >::operator* ( )
\short Returns a reference to the used object.
Exceptions
IlsNullPointerDereferencingIf the relation is null.

◆ operator->()

template<class UserType , class UsedType >
UsedType* IlsUses< UserType, UsedType >::operator-> ( )

This dereference operator returns the target of the relation.

Exceptions
IlsNullPointerDereferencingIf the relation is null.

◆ operator==()

template<class UserType , class UsedType >
IlsBoolean IlsUses< UserType, UsedType >::operator== ( Myself rhs)
\short Checks whether the relation is equal to another

relation.

◆ set()

template<class UserType , class UsedType >
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.

Exceptions
IlsUpdateForbiddenIf the member function isUpdateAllowed() returns IlsFalse for the type in which the relation is declared.
IlsUnownedUseIf the specified object is neither an owned object nor an entity, and if the member function IlsModel::IsIntegrityChecked() returns IlsTrue.