#include <valuegen.h>
Inheritance diagram for ValueGenerator


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... | |
| T | 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... | |
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.
|
||||
|
Empty default.
Definition at line 96 of file valuegen.h. Referenced by clone(). |
|
||||
|
Variable.
Definition at line 97 of file valuegen.h. |
|
||||
|
Reference.
Definition at line 98 of file valuegen.h. |
|
||||
|
Definition at line 101 of file valuegen.h. |
|
||||
|
Definition at line 106 of file valuegen.h. |
|
||||
|
Definition at line 110 of file valuegen.h. |
|
||||
|
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. |
|
||||
|
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. |
|
||||
|
Override the underlying value with a new one.
Definition at line 114 of file valuegen.h. |
|
||||
|
Overwrite the internal pointer to point to an external value.
Definition at line 138 of file valuegen.h. |
|
||||
|
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. |
|
||||
|
Returns the current underlying value.
Definition at line 124 of file valuegen.h. |
|
||||
|
Returns a pointer to the underlying value; use with caution.
Definition at line 117 of file valuegen.h. Referenced by NamedValueGenerators::create(). |
1.2.1 written by Dimitri van Heesch,
© 1997-2000