Rogue Wave 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)
 Constructor. The first argument is a reference to the object that contains the derived member.
 
Notification
 operator DerivedType ()
 Lets you manipulate a derived member as if it were the derived type. More...
 
IlsBoolean isModified ()
 During a notification phase, this member function returns IlsTrue only if the derived data member has been modified since the last notification phase.
 
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.
 
Calculating Values
DerivedType getValue ()
 Recalculates the derived data member if necessary and returns its value. More...
 
DerivedType accessValue ()
 Returns the value of the most recent evaluation of a derived data member. More...
 
IlsBoolean wasEverSet ()
 Returns IlsTrue if the derived data member has been calculated at least once. Otherwise, it returns IlsFalse.
 
Eagerness
IlsEagerness getEagerness ()
 Returns the value of the eagerness counter.
 
IlsBoolean isEager ()
 Returns 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.
 
void incrEagerness ()
 Increments the counter managing the eagerness of the derived member.
 
void decrEagerness ()
 Decrements the counter managing the eagerness of the derived member.
 

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().

Member Function Documentation

§ accessValue()

template<class HolderType, class DerivedType, class Evaluator>
DerivedType IlsDerived< HolderType, DerivedType, Evaluator >::accessValue ( )

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.

§ getValue()

template<class HolderType, class DerivedType, class Evaluator>
DerivedType IlsDerived< HolderType, DerivedType, Evaluator >::getValue ( )

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.

§ operator DerivedType()

template<class HolderType, class DerivedType, class Evaluator>
IlsDerived< HolderType, DerivedType, Evaluator >::operator DerivedType ( )

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().


© 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.