1 | /*
|
---|
2 | * RandomNumberDistribution_Encapsulation.hpp
|
---|
3 | *
|
---|
4 | * Created on: Jan 01, 2011
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef RANDOMNUMBERDISTRIBUTION_ENCAPSULATION_HPP_
|
---|
9 | #define RANDOMNUMBERDISTRIBUTION_ENCAPSULATION_HPP_
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include <typeinfo>
|
---|
17 |
|
---|
18 | #include "RandomNumberDistribution.hpp"
|
---|
19 | #include "RandomNumberGeneratorFactory.hpp"
|
---|
20 |
|
---|
21 | #include <boost/nondet_random.hpp>
|
---|
22 | #include <boost/random.hpp>
|
---|
23 | #include <boost/random/bernoulli_distribution.hpp>
|
---|
24 | #include <boost/random/binomial_distribution.hpp>
|
---|
25 | #include <boost/random/cauchy_distribution.hpp>
|
---|
26 | #include <boost/random/exponential_distribution.hpp>
|
---|
27 | #include <boost/random/gamma_distribution.hpp>
|
---|
28 | #include <boost/random/geometric_distribution.hpp>
|
---|
29 | #include <boost/random/linear_congruential.hpp>
|
---|
30 | #include <boost/random/lognormal_distribution.hpp>
|
---|
31 | #include <boost/random/normal_distribution.hpp>
|
---|
32 | #include <boost/random/poisson_distribution.hpp>
|
---|
33 | #include <boost/random/triangle_distribution.hpp>
|
---|
34 | #include <boost/random/uniform_01.hpp>
|
---|
35 | #include <boost/random/uniform_int.hpp>
|
---|
36 | #include <boost/random/uniform_on_sphere.hpp>
|
---|
37 | #include <boost/random/uniform_real.hpp>
|
---|
38 | #include <boost/random/uniform_smallint.hpp>
|
---|
39 |
|
---|
40 | #include "unittests/RandomNumberGeneratorFactoryUnitTest.hpp"
|
---|
41 |
|
---|
42 | /** Template class that encapsulates the random number distributions from
|
---|
43 | * random::boost.
|
---|
44 | *
|
---|
45 | *
|
---|
46 | * We need one template parameters:
|
---|
47 | * -# the distribution - generates uniform random numbers
|
---|
48 | */
|
---|
49 | template <class distribution>
|
---|
50 | class RandomNumberDistribution_Encapsulation : public RandomNumberDistribution
|
---|
51 | {
|
---|
52 | /**
|
---|
53 | * Factory is friend such that it can access private cstor.
|
---|
54 | */
|
---|
55 | friend class RandomNumberGeneratorFactory;
|
---|
56 | friend class RandomNumberGeneratorFactoryTest;
|
---|
57 |
|
---|
58 | public:
|
---|
59 |
|
---|
60 | /** Getter for the type name of the internal distribution.
|
---|
61 | *
|
---|
62 | */
|
---|
63 | std::string name() {
|
---|
64 | return typeid(distribution_type).name();
|
---|
65 | }
|
---|
66 |
|
---|
67 | /** Getter for the distribution instance.
|
---|
68 | *
|
---|
69 | * @return reference to instance
|
---|
70 | */
|
---|
71 | distribution& getDistribution() {
|
---|
72 | return distribution_type;
|
---|
73 | }
|
---|
74 |
|
---|
75 | /** Constructor that instantiates a specific random number generator and
|
---|
76 | * distribution.
|
---|
77 | * @param _distribution_type instance of the desired distribution
|
---|
78 | */
|
---|
79 | RandomNumberDistribution_Encapsulation()
|
---|
80 | {}
|
---|
81 |
|
---|
82 | /** Destructor of the class.
|
---|
83 | *
|
---|
84 | */
|
---|
85 | ~RandomNumberDistribution_Encapsulation() {}
|
---|
86 | private:
|
---|
87 | distribution distribution_type;
|
---|
88 | };
|
---|
89 |
|
---|
90 | #endif /* RANDOMNUMBERDISTRIBUTION_ENCAPSULATION_HPP_ */
|
---|