IlsDerived
 
IlsDerived
Category 
Modeling class template
Inheritance Path 
IlsDerived
Description 
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. This class template takes the following arguments:
*The name of the class where the derived member is declared (HolderType)
The HolderType must derive directly or transitively from the class IlsEntity or IlsObject. Derivation must be public.
*The type of the derived member (DerivedType)
The DerivedType must contain a valid default and copy constructor, as well as an assignment and a comparison operator (==).
*The class Evaluator
The class Evaluator must contain one public static function with the following signature:
static DerivedType Evaluate(HolderType&);
Library 
<server>
Header File 
#include <ilserver/model.h>
Synopsis 
template <class HolderType, class DerivedType, class Evaluator>
class IlsDerived
{
public:
IlsDerived(HolderType& holder);
Eagerness
IlsBoolean isEager();
void incrEagerness();
void decrEagerness();
IlsEagerness getEagerness();
Calculating Values
DerivedType getValue();
IlsBoolean wasEverSet();
DerivedType accessValue();
Notification
IlsBoolean isModified();
DerivedType getOldValue();
operator DerivedType();
};
Constructor 
IlsDerived(HolderType& holder);
This is the constructor of IlsDerived. The first argument is a reference to the object that contains the derived member.
Member Functions 
Eagerness
IlsBoolean isEager();
This function 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();
A call to this function increments the counter managing the eagerness of the derived member.
void decrEagerness();
A call to this function decrements the counter managing the eagerness of the derived member.
IlsEagerness getEagerness();
This function returns the value of the eagerness counter.
Calculating Values
DerivedType getValue();
This function 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.
IlsBoolean wasEverSet();
This function returns IlsTrue if the derived data member has been calculated at least once. Otherwise, it returns IlsFalse.
DerivedType accessValue();
This function 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.
Notification
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.
Operators 
operator DerivedType();
This operator 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.
Implementation 
In order to compile with a program that was written for Rogue Wave Server 2.X/3.0, it is necessary to change the name of the Evaluator static function from evaluate to Evaluate. It is possible to compile older program by setting the compilation flag ILS_COMPATIBILITY to 300. Example :
*UNIX: -DILS_COMPATIBILITY=300
*PC: /D ILS_COMPATIBILITY=300
See Also 
ILS_DERIVED_XXX, IlsEntity, IlsEntry, IlsObject, IlsReevaluate

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.