Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ValueGenerator Template Class Reference

This heads a class hierarchy of objects which primarily contain a variable of the given type, but which also contain operations for automatically generating a new value from a given distribution or by some other means. More...

#include <valuegen.h>

Inheritance diagram for ValueGenerator

Inheritance graph

[legend]
Collaboration diagram for ValueGenerator:

Collaboration graph

[legend]
List of all members.

Public Methods

 ValueGenerator ()
 Empty default. More...

 ValueGenerator (T value)
 Variable. More...

 ValueGenerator (T* value_pointer)
 Reference. More...

 ValueGenerator (StringArgs& args)
 ValueGenerator (const ValueGenerator& other)
virtual ~ValueGenerator ()
void operator= (T new_value)
 Override the underlying value with a new one. More...

T* valueptr () const
 Returns a pointer to the underlying value; use with caution. More...

value () const
 Returns the current underlying value. More...

Operations that may be overridden by derived classes
virtual bool next ()
 Advance to the next state (whatever that means for this object). More...

virtual void reset ()
 Reset to the starting state. More...

virtual ValueGenerator<T>* clone () const
 Constructs an identical copy of self and returns it. More...

virtual void relink (T* ptr)
 Overwrite the internal pointer to point to an external value. More...


Detailed Description

template<class T = double> template class ValueGenerator

This heads a class hierarchy of objects which primarily contain a variable of the given type, but which also contain operations for automatically generating a new value from a given distribution or by some other means.

Semantics for a value "a" of this type and a value "b" of the numeric type "T" which it contains:

 ValueGenerator<T> a; T b; T* c; ValueGenerator<T>* d;

a = b; // Assign the value b to a b = a.value(); // Assign the value of a to b // (can omit .value() if conversion operator defined) a.next(); // Choose a new value for a; returns false if unsuccessful a.reset(); // Reset a to its initial value, if any c = a.valueptr();// Returns address of data in a c = a.genptr(); // Returns address of a d = a.clone(); // d points to an identical but independent copy of a // (i.e., d may outlive a. This helps support // polymorphism, since a may be of a subtype of d, yet // the duplicate is of the subtype, not d's type.

Various derived types are used to support different distributions by reimplementing "next()" and "reset()"; their interface should differ only by their constructors and not by their usage.

The operator relink() is supported for the rare instances when one might wish to change a stored external value pointer to point to a different location. If an internal storage location is actually being used, the operation has no effect.

This base class is a basic version that acts just like an ordinary variable or reference.

Definition at line 93 of file valuegen.h.


Constructor & Destructor Documentation

template<classT = double>
ValueGenerator<T>::ValueGenerator<T> ( )
 

Empty default.

Definition at line 96 of file valuegen.h.

Referenced by clone().

template<classT = double>
ValueGenerator<T>::ValueGenerator<T> ( T value )
 

Variable.

Definition at line 97 of file valuegen.h.

template<classT = double>
ValueGenerator<T>::ValueGenerator<T> ( T * value_pointer )
 

Reference.

Definition at line 98 of file valuegen.h.

template<classT = double>
ValueGenerator<T>::ValueGenerator<T> ( StringArgs & args )
 

Definition at line 101 of file valuegen.h.

template<classT = double>
ValueGenerator<T>::ValueGenerator<T> ( const ValueGenerator<T> & other )
 

Definition at line 106 of file valuegen.h.

template<classT = double>
ValueGenerator<T>::~ValueGenerator<T> ( ) [inline, virtual]
 

Definition at line 110 of file valuegen.h.


Member Function Documentation

template<classT = double>
ValueGenerator< T >* ValueGenerator<T>::clone ( ) const [inline, virtual]
 

Constructs an identical copy of self and returns it.

Reimplemented in ValueGenerator_Random, ValueGenerator_Correlate, ValueGenerator_Increment, and ValueGenerator_Expression.

Definition at line 134 of file valuegen.h.

template<classT = double>
bool ValueGenerator<T>::next ( void ) [inline, virtual]
 

Advance to the next state (whatever that means for this object).

Reimplemented from ValueGen.

Reimplemented in ValueGenerator_Random, ValueGenerator_Correlate, ValueGenerator_Increment, and ValueGenerator_Expression.

Definition at line 130 of file valuegen.h.

template<classT = double>
void ValueGenerator<T>::operator= ( T new_value ) [inline]
 

Override the underlying value with a new one.

Definition at line 114 of file valuegen.h.

template<classT = double>
void ValueGenerator<T>::relink ( T * ptr ) [inline, virtual]
 

Overwrite the internal pointer to point to an external value.

Definition at line 138 of file valuegen.h.

template<classT = double>
void ValueGenerator<T>::reset ( ) [inline, virtual]
 

Reset to the starting state.

Reimplemented from ValueGen.

Reimplemented in ValueGenerator_Random, ValueGenerator_Correlate, ValueGenerator_Increment, and ValueGenerator_Expression.

Definition at line 131 of file valuegen.h.

template<classT = double>
T ValueGenerator<T>::value ( ) const [inline]
 

Returns the current underlying value.

Definition at line 124 of file valuegen.h.

template<classT = double>
T * ValueGenerator<T>::valueptr ( ) const [inline]
 

Returns a pointer to the underlying value; use with caution.

Definition at line 117 of file valuegen.h.

Referenced by NamedValueGenerators::create().


The documentation for this class was generated from the following file:
Generated at Mon Aug 21 00:31:28 2000 for RF-LISSOM by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000