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