Server
API Reference Guide
Product Documentation:

Rogue Wave Server
Documentation Home
List of all members | Public Types | Public Member Functions
IlsDerived< HolderType, DerivedType, Evaluator > Class Template Reference

Data member whose value depends on other data. More...

#include <ilserver/model.h>

Inherits IlsDerivedBase.

Public Types

typedef IlsDerived< HolderType, DerivedType, Evaluator > Myself
 Myself is the type of the instantiated template class.
 

Public Member Functions

 IlsDerived (HolderType &holder)
 
Calculating Values
DerivedType getValue ()
 
DerivedType accessValue ()
 
IlsBoolean wasEverSet ()
 
Eagerness
IlsEagerness getEagerness ()
 Returns the value of the eagerness counter.
 
IlsBoolean isEager ()
 
void incrEagerness ()
 Increments the counter managing the eagerness of the derived member.
 
void decrEagerness ()
 Decrements the counter managing the eagerness of the derived member.
 

Notification

HolderType & _holder
 
DerivedType _value
 
 operator DerivedType ()
 
IlsBoolean isModified ()
 
DerivedType getOldValue ()
 During a notification phase, this function returns the value of the derived data member before the last recomputation if the attribute has been recomputed since the last notification cycle.
 
void setValue (DerivedType)
 
COMPUTATION compute ()
 
 IlsDerived (const Myself &)
 
void operator= (const Myself &)
 

Detailed Description

template<class HolderType, class DerivedType, class Evaluator>
class IlsDerived< HolderType, DerivedType, Evaluator >

Data member whose value depends on other data.

Library: server
.

Template Parameters
HolderTypeThe name of the class where the derived member is declared. The HolderType must derive directly or transitively from the class IlsEntity or IlsObject. Derivation must be public.
DerivedTypeThe type of the derived member. The DerivedType must contain a valid default and copy constructor, as well as an assignment and a comparison operator (==).
EvaluatorThe class Evaluator must contain one public static function with the following signature:
static DerivedType Evaluate(HolderType&);

Rogue Wave Server lets you declare special data members called derived data members. Derived data members are associated with a function whose value is recalculated each time the derived data member is out-of-date. A derived data member can be marked as eager. An eager data member is recomputed each time the function IlsReevaluate() is explicitly called or during each re-evaluation phase of an interaction cycle. If a derived data member is not marked as eager, then it is recalculated only when it is accessed.

Derived data members are instances of the class template IlsDerived.

See also
ILS_DERIVED_XXX(), IlsEntity, IlsEntry, IlsObject, IlsReevaluate().

Constructor & Destructor Documentation

◆ IlsDerived() [1/2]

template<class HolderType , class DerivedType , class Evaluator >
IlsDerived< HolderType, DerivedType, Evaluator >::IlsDerived ( HolderType &  holder)
\short Constructor. The first argument

is a reference to the object that contains the derived member.

◆ IlsDerived() [2/2]

template<class HolderType , class DerivedType , class Evaluator >
IlsDerived< HolderType, DerivedType, Evaluator >::IlsDerived ( const Myself )
protected
\short Lets you manipulate a derived member as if it were

the derived type.

This operator is not const, since it can trigger an evaluation when called. It is equivalent to the function getValue().

Member Function Documentation

◆ accessValue()

template<class HolderType , class DerivedType , class Evaluator >
DerivedType IlsDerived< HolderType, DerivedType, Evaluator >::accessValue ( )
\short Returns the value of the most recent evaluation

of a derived data member.

Before you call this function, the derived data member must have been calculated at least once.

◆ compute()

template<class HolderType , class DerivedType , class Evaluator >
COMPUTATION IlsDerived< HolderType, DerivedType, Evaluator >::compute ( )
protected
\short Lets you manipulate a derived member as if it were

the derived type.

This operator is not const, since it can trigger an evaluation when called. It is equivalent to the function getValue().

◆ getValue()

template<class HolderType , class DerivedType , class Evaluator >
DerivedType IlsDerived< HolderType, DerivedType, Evaluator >::getValue ( )
\short Recalculates the derived data member if necessary

and returns its value.

It is useful when the conversion operator described below cannot be used or when the compiler is likely to encounter multiple user-defined conversions.

This function throws the exception IlsCycle if a dependence cycle is detected among derived data members.

◆ isEager()

template<class HolderType , class DerivedType , class Evaluator >
IlsBoolean IlsDerived< HolderType, DerivedType, Evaluator >::isEager ( )
\short Returns \c IlsTrue if the derived member is marked

as eager (that is, if the value of the eagerness counter is greater than 0). Otherwise, it returns IlsFalse.

◆ isModified()

template<class HolderType , class DerivedType , class Evaluator >
IlsBoolean IlsDerived< HolderType, DerivedType, Evaluator >::isModified ( )
\short During a notification phase, this member function returns
\c IlsTrue only if the derived data member has been modified since

the last notification phase.

◆ operator DerivedType()

template<class HolderType , class DerivedType , class Evaluator >
IlsDerived< HolderType, DerivedType, Evaluator >::operator DerivedType ( )
\short Lets you manipulate a derived member as if it were

the derived type.

This operator is not const, since it can trigger an evaluation when called. It is equivalent to the function getValue().

◆ operator=()

template<class HolderType , class DerivedType , class Evaluator >
void IlsDerived< HolderType, DerivedType, Evaluator >::operator= ( const Myself )
protected
\short Lets you manipulate a derived member as if it were

the derived type.

This operator is not const, since it can trigger an evaluation when called. It is equivalent to the function getValue().

◆ setValue()

template<class HolderType , class DerivedType , class Evaluator >
void IlsDerived< HolderType, DerivedType, Evaluator >::setValue ( DerivedType  )
protected
\short Lets you manipulate a derived member as if it were

the derived type.

This operator is not const, since it can trigger an evaluation when called. It is equivalent to the function getValue().

◆ wasEverSet()

template<class HolderType , class DerivedType , class Evaluator >
IlsBoolean IlsDerived< HolderType, DerivedType, Evaluator >::wasEverSet ( )
\short Returns \c IlsTrue if the derived data member has

been calculated at least once. Otherwise, it returns IlsFalse.

Member Data Documentation

◆ _holder

template<class HolderType , class DerivedType , class Evaluator >
HolderType& IlsDerived< HolderType, DerivedType, Evaluator >::_holder
protected
\short Lets you manipulate a derived member as if it were

the derived type.

This operator is not const, since it can trigger an evaluation when called. It is equivalent to the function getValue().

◆ _value

template<class HolderType , class DerivedType , class Evaluator >
DerivedType IlsDerived< HolderType, DerivedType, Evaluator >::_value
protected
\short Lets you manipulate a derived member as if it were

the derived type.

This operator is not const, since it can trigger an evaluation when called. It is equivalent to the function getValue().