Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
Menge::Math::FloatGenerator Class Referenceabstract

Generic abstract class which generates a scalar float value. More...

#include <RandGenerator.h>

Inheritance diagram for Menge::Math::FloatGenerator:
Menge::Math::ConstFloatGenerator Menge::Math::NormalFloatGenerator Menge::Math::UniformFloatGenerator

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 FloatGeneratorcopy () const =0
 Create a copy of itself. More...
 

Detailed Description

Generic abstract class which generates a scalar float value.

Member Function Documentation

virtual FloatGenerator* Menge::Math::FloatGenerator::copy ( ) const
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.

Returns
A pointer to a new generator which is a copy of this one. The caller of this function is responsible for freeing up the memory for the copy.

Implemented in Menge::Math::UniformFloatGenerator, Menge::Math::NormalFloatGenerator, and Menge::Math::ConstFloatGenerator.

virtual float Menge::Math::FloatGenerator::getValue ( ) const
pure virtual

Return a value based on the float generation rules.

This is the basic functionality that must be overwridden by derived classes.

Returns
A float value.

Implemented in Menge::Math::UniformFloatGenerator, Menge::Math::NormalFloatGenerator, and Menge::Math::ConstFloatGenerator.

virtual float Menge::Math::FloatGenerator::getValueConcurrent ( ) const
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.

Returns
A float value.

Implemented in Menge::Math::UniformFloatGenerator, Menge::Math::NormalFloatGenerator, and Menge::Math::ConstFloatGenerator.

virtual void Menge::Math::FloatGenerator::print ( Logger out) const
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.

Parameters
outThe output stream to write the string representation to.

Implemented in Menge::Math::UniformFloatGenerator, Menge::Math::NormalFloatGenerator, and Menge::Math::ConstFloatGenerator.


The documentation for this class was generated from the following file: