C++ mpi module for stochmagnet_main Package
RNDB_UniformIntDistribution.h
1 #ifndef RNDB_UniformIntDistribution_H
2 #define RNDB_UniformIntDistribution_H
3 
4 //inherited class
5 #include "RAND_RandomNumberDistribution.h"
6 
7 //boost header
8 #include <boost/random/uniform_int_distribution.hpp>
9 
15 class RNDB_UniformIntDistribution : public RAND_RandomNumberDistribution<tRelativeInteger,boost::random::uniform_int_distribution<tRelativeInteger>,RNDB_UniformIntDistribution> {
16  // ATTRIBUTES
17 
18 private:
19 
20  //type of the return value of the distribution
21  typedef tRelativeInteger T;
22  //self class
24  //super class
26 
27 public:
28  // METHODS
29 
30  // CONSTRUCTORS
31 
34  boost::random::uniform_int_distribution<T> dist;
35  initialize(dist);
36  }
37 
38 
39 
40  // DESTRUCTORS
41 
42 
46  }
47 
48 
49 
50 public:
51 
55  inline static CORE_UniquePointer<RNDB_UniformIntDistribution> New() {
56  return CORE_UniquePointer<RNDB_UniformIntDistribution>(new RNDB_UniformIntDistribution(),
58  }
59 
60 private:
61 
62  public:
63 
64  //MEMORY
78  virtual tMemSize getMemorySize() const {
79  return sizeof(*this)+getContentsMemorySize();
80  }
81 
90  virtual tMemSize getContentsMemorySize() const {
91  tMemSize mem= SuperSelf::getContentsMemorySize();
92  return mem;
93  }
94 
95 
100  void setSupport(const T& a,const T& b) {
101  boost::random::uniform_int_distribution<T>::param_type p(a,b);
102  getDistribution().param(p);
103 
104  }
105 
117  inline void setProperties(const tReal& mean,
118  const tReal& sd) {
119  setSupport(mean-sqrt(3)*sd,mean+sqrt(3)*sd);
120  }
121 
122 
123 
124 };
125 
126 #endif
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class generates a distribution implemented in class G with internal implementation class I with ...
Definition: RAND_RandomNumberDistribution.h:17
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: RAND_RandomNumberDistribution.h:88
void initialize(boost::random::uniform_int_distribution< tRelativeInteger > &dist)
initiliaze generator
Definition: RAND_RandomNumberDistribution.h:103
boost::random::uniform_int_distribution< tRelativeInteger > & getDistribution()
get distribution
Definition: RAND_RandomNumberDistribution.h:124
This class implements a an uniform int law in [a,b] by the boost library.
Definition: RNDB_UniformIntDistribution.h:15
RNDB_UniformIntDistribution()
create an object
Definition: RNDB_UniformIntDistribution.h:33
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: RNDB_UniformIntDistribution.h:90
static CORE_UniquePointer< RNDB_UniformIntDistribution > New()
build a new instance of the stochasticfunction
Definition: RNDB_UniformIntDistribution.h:55
virtual ~RNDB_UniformIntDistribution(void)
destroy an object.
Definition: RNDB_UniformIntDistribution.h:45
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: RNDB_UniformIntDistribution.h:78
void setSupport(const T &a, const T &b)
set the support of the random function
Definition: RNDB_UniformIntDistribution.h:100
void setProperties(const tReal &mean, const tReal &sd)
set the properties of the stochastic function
Definition: RNDB_UniformIntDistribution.h:117