C++ mpi module for stochmagnet_main Package
RNDSTD_UniformIntDistribution.h
1 #ifndef RNDSTD_UniformIntDistribution_H
2 #define RNDSTD_UniformIntDistribution_H
3 
4 //inherited class
5 #include "RAND_RandomNumberDistribution.h"
6 
7 //header for standart random laws
8 #include <random>
9 
16 class RNDSTD_UniformIntDistribution : public RAND_RandomNumberDistribution<tRelativeInteger,std::uniform_int_distribution<tRelativeInteger>,RNDSTD_UniformIntDistribution> {
17  // ATTRIBUTES
18 
19 private:
20 
21  //type of the return value of the distribution
22  typedef tRelativeInteger T;
23  //self class
25  //super class
27 
28 public:
29  // METHODS
30 
31  // CONSTRUCTORS
32 
35  std::uniform_int_distribution<T> dist;
36  initialize(dist);
37  }
38 
39 
40 
41  // DESTRUCTORS
42 
43 
47  }
48 
49 
50 
51 public:
52 
53 
57  inline static CORE_UniquePointer<RNDSTD_UniformIntDistribution> New() {
58  return CORE_UniquePointer<RNDSTD_UniformIntDistribution>(new RNDSTD_UniformIntDistribution(),
60  }
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 
96 private:
97 
98 
99  // --------------------
100  // ATTRIBUTES setting
101  // --------------------
102 public:
103 
108  void setSupport(const T& a,const T& b) {
109  std::uniform_int_distribution<T>::param_type p(a,b);
110  getDistribution().param(p);
111 
112  }
113 
125  inline void setProperties(const tReal& mean,
126  const tReal& sd) {
127  setSupport(mean-sqrt(3)*sd,mean+sqrt(3)*sd);
128  }
129 
130 
131 
132 
133 
134 
135 };
136 
137 #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(std::uniform_int_distribution< tRelativeInteger > &dist)
initiliaze generator
Definition: RAND_RandomNumberDistribution.h:103
std::uniform_int_distribution< tRelativeInteger > & getDistribution()
get distribution
Definition: RAND_RandomNumberDistribution.h:124
This class implements a stochastic function with a int uniform law in [a,b] implemented from the std ...
Definition: RNDSTD_UniformIntDistribution.h:16
void setSupport(const T &a, const T &b)
set the support of the random function
Definition: RNDSTD_UniformIntDistribution.h:108
void setProperties(const tReal &mean, const tReal &sd)
set the properties of the stochastic futcion
Definition: RNDSTD_UniformIntDistribution.h:125
virtual ~RNDSTD_UniformIntDistribution(void)
destroy an object.
Definition: RNDSTD_UniformIntDistribution.h:46
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: RNDSTD_UniformIntDistribution.h:78
static CORE_UniquePointer< RNDSTD_UniformIntDistribution > New()
build a new instance of the stochasticfunction
Definition: RNDSTD_UniformIntDistribution.h:57
RNDSTD_UniformIntDistribution()
create an object
Definition: RNDSTD_UniformIntDistribution.h:34
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: RNDSTD_UniformIntDistribution.h:90