Menge
Modular Pedestrian Simulation Framework for Research and Development
|
Generic abstract class which generates a scalar float value. More...
#include <RandGenerator.h>
Public Member Functions | |
FloatGenerator () | |
Constructor. | |
virtual | ~FloatGenerator () |
Virtual destructor. | |
virtual void | print (Logger &out) const =0 |
Function for converting the generator to a string on a output stream. More... | |
virtual float | getValue () const =0 |
Return a value based on the float generation rules. More... | |
virtual float | getValueConcurrent () const =0 |
Return a value based on the float generation rules - performed in a thread-safe manner. More... | |
virtual FloatGenerator * | copy () const =0 |
Create a copy of itself. More... | |
Generic abstract class which generates a scalar float value.
|
pure virtual |
Create a copy of itself.
This is the basic functionality that must be overwridden by derived classes. This is not an exact copy. The copy should not have the same seed as the original. All other parameters should be identical.
Implemented in Menge::Math::UniformFloatGenerator, Menge::Math::NormalFloatGenerator, and Menge::Math::ConstFloatGenerator.
|
pure virtual |
Return a value based on the float generation rules.
This is the basic functionality that must be overwridden by derived classes.
Implemented in Menge::Math::UniformFloatGenerator, Menge::Math::NormalFloatGenerator, and Menge::Math::ConstFloatGenerator.
|
pure virtual |
Return a value based on the float generation rules - performed in a thread-safe manner.
This is the basic functionality that must be overwridden by derived classes.
Implemented in Menge::Math::UniformFloatGenerator, Menge::Math::NormalFloatGenerator, and Menge::Math::ConstFloatGenerator.
|
pure virtual |
Function for converting the generator to a string on a output stream.
This must be overridden by each derived class to provide a string format of the float generator.
This method is used instead of the traditional method of writing a friend overloaded operator (>>). The reason for this is that using pointers to this base class to refer to derived classes would need to be derefenced to pass (as objects) to the output stream and dereferencing them precludes the use of polymorphism in the format.
This could be overcome by writing the streaming operator to operate on a pointer to the base class, which in turn calls a virtual function. But this approach removes one level of indirection, and preserves the ability to output pointer addresses for the sake of debugging.
out | The output stream to write the string representation to. |
Implemented in Menge::Math::UniformFloatGenerator, Menge::Math::NormalFloatGenerator, and Menge::Math::ConstFloatGenerator.