| 1 | /*
 | 
|---|
| 2 |  * RandomNumberDistribution.hpp
 | 
|---|
| 3 |  *
 | 
|---|
| 4 |  *  Created on: Jan 01, 2011
 | 
|---|
| 5 |  *      Author: heber
 | 
|---|
| 6 |  */
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #ifndef RANDOMNUMBERDISTRIBUTION_HPP_
 | 
|---|
| 9 | #define RANDOMNUMBERDISTRIBUTION_HPP_
 | 
|---|
| 10 | 
 | 
|---|
| 11 | // include config.h
 | 
|---|
| 12 | #ifdef HAVE_CONFIG_H
 | 
|---|
| 13 | #include <config.h>
 | 
|---|
| 14 | #endif
 | 
|---|
| 15 | 
 | 
|---|
| 16 | class RandomNumberDistributionFactoryTest;
 | 
|---|
| 17 | class RandomNumberGenerator;
 | 
|---|
| 18 | class RandomNumberDistribution_Parameters;
 | 
|---|
| 19 | 
 | 
|---|
| 20 | /** Abstract base class for a random number distribution.
 | 
|---|
| 21 |  *
 | 
|---|
| 22 |  *  This class represents the interface to the random number distribution.
 | 
|---|
| 23 |  *  Hence, they all can be accessed the same way.
 | 
|---|
| 24 |  *
 | 
|---|
| 25 |  * It is also the base class that is needed for RandomNumberGeneratorFactory.
 | 
|---|
| 26 |  */
 | 
|---|
| 27 | class RandomNumberDistribution
 | 
|---|
| 28 | {
 | 
|---|
| 29 |   /**
 | 
|---|
| 30 |    * test has to access cstor/dstor.
 | 
|---|
| 31 |    */
 | 
|---|
| 32 |   friend class RandomNumberDistributionFactoryTest;
 | 
|---|
| 33 | 
 | 
|---|
| 34 |   /**
 | 
|---|
| 35 |    * RandomNumberGenerator(_Encapsulation) needs access to dstor.
 | 
|---|
| 36 |    */
 | 
|---|
| 37 |   friend class RandomNumberGenerator;
 | 
|---|
| 38 | 
 | 
|---|
| 39 | public:
 | 
|---|
| 40 |   /** Getter for the whole set of possible parameters.
 | 
|---|
| 41 |    *
 | 
|---|
| 42 |    * @return filled instance of RandomNumberDistribution_Parameters
 | 
|---|
| 43 |    */
 | 
|---|
| 44 |   virtual RandomNumberDistribution_Parameters* getParameterSet() const=0;
 | 
|---|
| 45 | 
 | 
|---|
| 46 |   /** Getter for smallest value the uniform_... engines produces.
 | 
|---|
| 47 |    *
 | 
|---|
| 48 |    * @return smallest value
 | 
|---|
| 49 |    */
 | 
|---|
| 50 |   virtual double min() const=0;
 | 
|---|
| 51 | 
 | 
|---|
| 52 |   /** Getter for largest value the uniform_... engines produces.
 | 
|---|
| 53 |    *
 | 
|---|
| 54 |    * @return largest value
 | 
|---|
| 55 |    */
 | 
|---|
| 56 |   virtual double max() const=0;
 | 
|---|
| 57 | 
 | 
|---|
| 58 | 
 | 
|---|
| 59 |   /** Getter for bernoulli_distribution probability p.
 | 
|---|
| 60 |    *
 | 
|---|
| 61 |    * @return p
 | 
|---|
| 62 |    */
 | 
|---|
| 63 |   virtual double p() const=0;
 | 
|---|
| 64 | 
 | 
|---|
| 65 |   /** Getter for binomial_distribution's parameter t.
 | 
|---|
| 66 |    *
 | 
|---|
| 67 |    * @return t
 | 
|---|
| 68 |    */
 | 
|---|
| 69 |   virtual double t() const=0;
 | 
|---|
| 70 | 
 | 
|---|
| 71 |   /** Getter for cauchy_distribution parameter median.
 | 
|---|
| 72 |    *
 | 
|---|
| 73 |    * @return median
 | 
|---|
| 74 |    */
 | 
|---|
| 75 |   virtual double median() const=0;
 | 
|---|
| 76 | 
 | 
|---|
| 77 |   /** Getter for cauchy_distribution parameter sigma.
 | 
|---|
| 78 |    *
 | 
|---|
| 79 |    * @return sigma
 | 
|---|
| 80 |    */
 | 
|---|
| 81 |   virtual double sigma() const=0;
 | 
|---|
| 82 | 
 | 
|---|
| 83 |   /** Getter for gamma_distribution parameter alpha.
 | 
|---|
| 84 |    *
 | 
|---|
| 85 |    * @return alpha
 | 
|---|
| 86 |    */
 | 
|---|
| 87 |   virtual double alpha() const=0;
 | 
|---|
| 88 | 
 | 
|---|
| 89 |   /** Getter for poisson_distribution's parameter mean.
 | 
|---|
| 90 |    *
 | 
|---|
| 91 |    * @return mean
 | 
|---|
| 92 |    */
 | 
|---|
| 93 |   virtual double mean() const=0;
 | 
|---|
| 94 | 
 | 
|---|
| 95 |   /** Getter for triangle_distribution parameter a.
 | 
|---|
| 96 |    *
 | 
|---|
| 97 |    * @return a
 | 
|---|
| 98 |    */
 | 
|---|
| 99 |   virtual double a() const=0;
 | 
|---|
| 100 | 
 | 
|---|
| 101 |   /** Getter for triangle_distribution parameter b.
 | 
|---|
| 102 |    *
 | 
|---|
| 103 |    * @return b
 | 
|---|
| 104 |    */
 | 
|---|
| 105 |   virtual double b() const=0;
 | 
|---|
| 106 | 
 | 
|---|
| 107 |   /** Getter for triangle_distribution parameter c.
 | 
|---|
| 108 |    *
 | 
|---|
| 109 |    * @return c
 | 
|---|
| 110 |    */
 | 
|---|
| 111 |   virtual double c() const=0;
 | 
|---|
| 112 | 
 | 
|---|
| 113 |   /** Getter for exponential_distribution parameter lambda.
 | 
|---|
| 114 |    *
 | 
|---|
| 115 |    * @return lambda
 | 
|---|
| 116 |    */
 | 
|---|
| 117 |   virtual double lambda() const=0;
 | 
|---|
| 118 | 
 | 
|---|
| 119 |   /** Getter for the type name of the internal distribution.
 | 
|---|
| 120 |    *
 | 
|---|
| 121 |    * @return name of distribution
 | 
|---|
| 122 |    */
 | 
|---|
| 123 |   virtual std::string name()=0;
 | 
|---|
| 124 | 
 | 
|---|
| 125 |   /** Destructor of class RandomNumberDistribution.
 | 
|---|
| 126 |    *
 | 
|---|
| 127 |    * @note must be public such that instances from factory can be destroyed.
 | 
|---|
| 128 |    *
 | 
|---|
| 129 |    */
 | 
|---|
| 130 |   virtual ~RandomNumberDistribution() {};
 | 
|---|
| 131 | protected:
 | 
|---|
| 132 | 
 | 
|---|
| 133 |   /** Constructor of class RandomNumberDistribution.
 | 
|---|
| 134 |    *
 | 
|---|
| 135 |    * @note is protected such that instances can only be created by the factory.
 | 
|---|
| 136 |    */
 | 
|---|
| 137 |   RandomNumberDistribution() {};
 | 
|---|
| 138 | };
 | 
|---|
| 139 | 
 | 
|---|
| 140 | #endif /* RANDOMNUMBERDISTRIBUTION_HPP_ */
 | 
|---|