| 1 | /*
 | 
|---|
| 2 |  * RandomNumberEngine.hpp
 | 
|---|
| 3 |  *
 | 
|---|
| 4 |  *  Created on: Jan 01, 2011
 | 
|---|
| 5 |  *      Author: heber
 | 
|---|
| 6 |  */
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #ifndef RANDOMNUMBERENGINE_HPP_
 | 
|---|
| 9 | #define RANDOMNUMBERENGINE_HPP_
 | 
|---|
| 10 | 
 | 
|---|
| 11 | // include config.h
 | 
|---|
| 12 | #ifdef HAVE_CONFIG_H
 | 
|---|
| 13 | #include <config.h>
 | 
|---|
| 14 | #endif
 | 
|---|
| 15 | 
 | 
|---|
| 16 | class RandomNumberEngineFactoryTest;
 | 
|---|
| 17 | class RandomNumberGenerator;
 | 
|---|
| 18 | 
 | 
|---|
| 19 | /** Abstract base class for a random number engine.
 | 
|---|
| 20 |  *
 | 
|---|
| 21 |  *  This class represents the interface to the random number engine.
 | 
|---|
| 22 |  *  Hence, they all can be accessed the same way.
 | 
|---|
| 23 |  *
 | 
|---|
| 24 |  * It is also the base class that is needed for RandomNumberGeneratorFactory.
 | 
|---|
| 25 |  */
 | 
|---|
| 26 | class RandomNumberEngine
 | 
|---|
| 27 | {
 | 
|---|
| 28 |   /**
 | 
|---|
| 29 |    * test has to access cstor/dstor.
 | 
|---|
| 30 |    */
 | 
|---|
| 31 |   friend class RandomNumberEngineFactoryTest;
 | 
|---|
| 32 | 
 | 
|---|
| 33 |   /**
 | 
|---|
| 34 |    * RandomNumberGenerator(_Encapsulation) needs access to dstor.
 | 
|---|
| 35 |    */
 | 
|---|
| 36 |   friend class RandomNumberGenerator;
 | 
|---|
| 37 | 
 | 
|---|
| 38 | public:
 | 
|---|
| 39 |   /** Set the generator's seed.
 | 
|---|
| 40 |    *
 | 
|---|
| 41 |    * @param _seed seed to set to
 | 
|---|
| 42 |    */
 | 
|---|
| 43 |   virtual void seed(unsigned int _seed)=0;
 | 
|---|
| 44 | 
 | 
|---|
| 45 |   /** Getter for the generator's seed.
 | 
|---|
| 46 |    *
 | 
|---|
| 47 |    * @return _seed seed to set to
 | 
|---|
| 48 |    */
 | 
|---|
| 49 |   virtual unsigned int getseed() const = 0;
 | 
|---|
| 50 | 
 | 
|---|
| 51 |   /** Getter for smallest value the engine produces.
 | 
|---|
| 52 |    *
 | 
|---|
| 53 |    * @return smallest value
 | 
|---|
| 54 |    */
 | 
|---|
| 55 |   virtual double min() const=0;
 | 
|---|
| 56 | 
 | 
|---|
| 57 |   /** Getter for largest value the engine produces.
 | 
|---|
| 58 |    *
 | 
|---|
| 59 |    * @return largest value
 | 
|---|
| 60 |    */
 | 
|---|
| 61 |   virtual double max() const=0;
 | 
|---|
| 62 | 
 | 
|---|
| 63 |   /** Getter for the type name of the internal engine.
 | 
|---|
| 64 |    *
 | 
|---|
| 65 |    */
 | 
|---|
| 66 |   virtual std::string name()=0;
 | 
|---|
| 67 | 
 | 
|---|
| 68 |   /** Destructor of class RandomNumberEngine.
 | 
|---|
| 69 |    *
 | 
|---|
| 70 |    * @note must be public such that instances from factory can be destroyed.
 | 
|---|
| 71 |    *
 | 
|---|
| 72 |    */
 | 
|---|
| 73 |   virtual ~RandomNumberEngine() {};
 | 
|---|
| 74 | protected:
 | 
|---|
| 75 |   /** Constructor of class RandomNumberEngine.
 | 
|---|
| 76 |    *
 | 
|---|
| 77 |    * @note is protected such that instances can only be created by the factory.
 | 
|---|
| 78 |    */
 | 
|---|
| 79 |   RandomNumberEngine() {};
 | 
|---|
| 80 | };
 | 
|---|
| 81 | 
 | 
|---|
| 82 | #endif /* RANDOMNUMBERENGINE_HPP_ */
 | 
|---|