C++ mpi module for stochmagnet_main Package
RAND_RandomNumberGenerator.h
1 #ifndef RAND_RandomNumberGenerator_H
2 #define RAND_RandomNumberGenerator_H
3 
4 //inherited class
5 #include "RAND_Object.h"
6 
13 template<typename T,class I,class D>
15 
16  // ATTRIBUTES
17 
18 public:
19 
20 
21 
22 private:
23 
24 
25 
26  //class This
28 
29 
30 
31  //random number generator
32  I mGenerator;
33 
34 
35 protected:
36  // METHODS
37 
38  // CONSTRUCTORS
39 
43  }
44 
45 
46 
47  // DESTRUCTORS
48 
49 
53  }
54 
55 
56 public:
57 
58 
59  //MEMORY
60 
74  virtual tMemSize getMemorySize() const {
75  return sizeof(*this)+getContentsMemorySize();
76  }
85  virtual tMemSize getContentsMemorySize() const {
87  mem+=sizeof(mGenerator);
88  return mem;
89  }
90  //operator methods
91  //===============
92 
95  inline T& operator()() {
96  return mGenerator();
97  }
98 
99 
100 
101 
102  //SEED initialization methods
103  //============================
107  inline void setSeed(const tULInt& seed) {
108  this->getGenerator().seed(seed);
109  }
110 
113  inline void setSeed() {
114  this->getGenerator().seed();
115  }
116 
117 
118  //properties
119  //==========
120 
124  inline T minValue() const {
125  return mGenerator.min();
126  }
130  inline T maxValue() const {
131  return mGenerator.max();
132  }
133 
134  // random methods
135  // ==============
136 
140  inline I& getGenerator() {
141  return mGenerator;
142  }
143 
144 
145 
146 public:
147  // OTHERS methods
148 
149 
150 
151 };
152 
153 #endif
This class is the base class of all the parser package.
Definition: RAND_Object.h:24
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: RAND_Object.h:69
This class generates a random number of type T generator with internal implemented class I implemente...
Definition: RAND_RandomNumberGenerator.h:14
void setSeed(const tULInt &seed)
initialize the seed of the random number generator
Definition: RAND_RandomNumberGenerator.h:107
void setSeed()
initialize the seed of the generator with time(null) by defualt
Definition: RAND_RandomNumberGenerator.h:113
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: RAND_RandomNumberGenerator.h:74
virtual ~RAND_RandomNumberGenerator(void)
destroy
Definition: RAND_RandomNumberGenerator.h:52
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: RAND_RandomNumberGenerator.h:85
T & operator()()
return the internal generator
Definition: RAND_RandomNumberGenerator.h:95
T maxValue() const
get the max value
Definition: RAND_RandomNumberGenerator.h:130
T minValue() const
get the min value
Definition: RAND_RandomNumberGenerator.h:124
RAND_RandomNumberGenerator(void)
create
Definition: RAND_RandomNumberGenerator.h:42
I & getGenerator()
get the internal random nulber generator
Definition: RAND_RandomNumberGenerator.h:140