C++ main module for stochmagnet Package  1.0
SMS_BoostNormalFunction.h
Go to the documentation of this file.
1 #ifndef SMS_BoostNormalFunction_H
2 #define SMS_BoostNormalFunction_H
3 
5 
7 
8 #include <boost/random/normal_distribution.hpp>
9 #include <boost/random/variate_generator.hpp>
10 #include <boost/random/mersenne_twister.hpp>
11 
12 
13 
21  // ATTRIBUTES
22 
23 private:
24 
25 
26  // ASSOCIATIONS
27  boost::random::normal_distribution<tReal> *mRandomDistribution;
28  boost::random::variate_generator<RNGType&,
29  boost::random::normal_distribution<tReal> > *mGenerator;
30 
31 
32 public:
33  // METHODS
34 
35  // CONSTRUCTORS
36 
39 
40 
41 
42  // DESTRUCTORS
43 
44 
47  virtual ~SMS_BoostNormalFunction(void);
48 
49 
50 
51 public:
52 
59  }
60 
61 private:
62 
63 public:
64 
65  //MEMORY
79  virtual tMemSize getMemorySize() const {
80  return sizeof(*this)+getContentsMemorySize();
81  }
82 
91  virtual tMemSize getContentsMemorySize() const {
94  mem+=(mRandomDistribution==null)?0:sizeof(*mRandomDistribution);
95  mem+=(mGenerator==null)?0:sizeof(*mGenerator);
96 
97  return mem;
98  }
99 
100  // --------------------
101  // ATTRIBUTES setting
102  // --------------------
103 public:
104 
108  virtual void initializeSeed(const tULLInt& seed) override {
109  initSeed(seed);
110  }
111 
116  virtual void setProperties(const tReal& mean,
117  const tReal& sd) override;
118 
119 
120 
124  virtual tReal random() const override {
125  return templatedRandom();
126  }
127 
131  inline tReal templatedRandom() const {
132  return (*mGenerator)();
133  }
134 
135 
136 
137 };
138 
139 #endif
boost::mt19937 RNGType
Definition: SMS_BoostRandomFunction.h:21
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:94
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:259
This class implements a stochastic function with a normal law implemented from the boost library.
Definition: SMS_BoostNormalFunction.h:20
tReal templatedRandom() const
random return a random numbers in range
Definition: SMS_BoostNormalFunction.h:131
boost::random::variate_generator< RNGType &, boost::random::normal_distribution< tReal > > * mGenerator
Definition: SMS_BoostNormalFunction.h:29
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SMS_BoostNormalFunction.h:79
virtual void initializeSeed(const tULLInt &seed) override
initialize the seed
Definition: SMS_BoostNormalFunction.h:108
static CORE_UniquePointer< SMS_BoostNormalFunction > New()
build a new instance of the stochasticfunction
Definition: SMS_BoostNormalFunction.h:56
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SMS_BoostNormalFunction.h:91
virtual ~SMS_BoostNormalFunction(void)
destroy an object.
Definition: SMS_BoostNormalFunction.cpp:16
virtual tReal random() const override
random return a random numbers in range
Definition: SMS_BoostNormalFunction.h:124
virtual void setProperties(const tReal &mean, const tReal &sd) override
set the properties of the stochastic fntion
Definition: SMS_BoostNormalFunction.cpp:24
boost::random::normal_distribution< tReal > * mRandomDistribution
Definition: SMS_BoostNormalFunction.h:27
SMS_BoostNormalFunction()
create an object
Definition: SMS_BoostNormalFunction.cpp:7
This class is the class to describes general distribution.
Definition: SMS_BoostRandomFunction.h:23
static void initSeed()
init the seed
Definition: SMS_BoostRandomFunction.cpp:22
This class describes a templated stochastic function to generate random numbers.
Definition: SM_TemplatedStochasticFunction.h:15
typename std::unique_ptr< T, CORE_Object::Delete > CORE_UniquePointer
Definition: sp.h:8
#define tULLInt
Definition: types.h:58
#define tMemSize
Definition: types.h:166
#define tReal
Definition: types.h:137