C++ main module for stochmagnet Package  1.0
CORE_Run.h
Go to the documentation of this file.
1 #ifndef CORE_Run_H
2 #define CORE_Run_H
3 
4 #include "CORE_Object.h"
5 
6 //output
7 #include "CORE_Out.h"
8 //class factory
9 #include "CORE_ClassFactory.h"
10 
36 class CORE_Run : public virtual CORE_Object {
37 
38  //attributes
39 private :
40 
41  //name of the soft
43 
44  //version of the progam
45  static tString mVersion;
46 
47  //output
49 
50  //class factory
52 
53  //for profiling method
55 
56 public:
57  // CONSTRUCTORS
60  CORE_Run(void);
61 
62  // DESTRUCTORS
65  virtual ~CORE_Run(void);
66 
67 
68 
69 public :
70  // CREATE class
71 
79  virtual tMemSize getMemorySize() const override {
80  return sizeof(*this)+getContentsMemorySize();
81  }
90  virtual tMemSize getContentsMemorySize() const override {
91  return mOut->getMemorySize()+mClassFactory->getMemorySize();
92  }
93 
94  //SET & GET methods
95 public:
99  inline static void SetSoftName(const tString& soft) {
100  mSoftName=soft;
101  }
105  inline static const tString& GetSoftName() {
106  return mSoftName;
107  }
108 
113  inline static void SetVersion(const tString& version) {
114  mVersion=version;
115  }
119  inline static const tString& GetVersion() {
120  return mVersion;
121  }
122 
123  //debug methods
124  //=============
125 
129  static inline const tBoolean& IsProfiling() {
130  return mIsProfiling;
131  }
132 
133 
134  //system methods
135  //===============
136 
140  inline static tBoolean Is64Architecture() {
141  return (sizeof(tLDouble)==16);
142  }
143 
147  inline static tBoolean Is32Architecture() {
148  return (sizeof(tLDouble)==8);
149  }
150 
151  //initialization of global variables
152  //=================================
153 
157  inline static void InitSeed(const unsigned int& seed) {
158  std::srand(seed);
159  }
162  inline static void InitSeed() {
163  std::srand(time(NULL));
164  }
165 
166 
167 public:
168 
169  //output methods
170  //==============
174  inline static CORE_Out& Out() {
175  return *mOut.get();
176  }
177 
181  static void SetOutputOptions(const std::map<tString,tString>& option);
182 
186  static void SetDebugOptions(const std::map<tString,tString>& option);
187 
188  //options methods
189  //===============
190 
194  virtual void initManOptions(std::map<tString,std::map<tString,tString> >& options) const;
195 
199  virtual void initOptions(std::map<tString,tString>& options) const;
200 
201 
202 
203  //classes factory
204  //===============
208  virtual void createClassFactories(const std::map<tString,tString>& options) const;
209 
214  return *mClassFactory.get();
215  }
216 
217  // Make Methods
218  //============
219 
225  tBoolean executeRun(int argc,char* argv[]) const;
226 
232  virtual tBoolean makeRun(const tString& command,const std::map<tString,tString>& options) const;
233 
234 
235 
240  virtual tBoolean makeTests(const std::map<tString,tString>& options) const;
241 
246  tBoolean printHelp(const std::map<tString,tString>& options) const;
247 
248 
249 
250 
251 
252 
253 
254 };
255 
256 
257 #endif
this class describes a class factory to generate classes
Definition: CORE_ClassFactory.h:22
abstract base class for most classes.
Definition: CORE_Object.h:48
this class describes the output stream by default write on standart output
Definition: CORE_Out.h:28
This class is an outpput results generator for stoch magnet program.
Definition: CORE_Run.h:36
static void InitSeed()
init the seed for uniform random generator
Definition: CORE_Run.h:162
tBoolean printHelp(const std::map< tString, tString > &options) const
print the help
Definition: CORE_Run.cpp:331
virtual ~CORE_Run(void)
destroy
Definition: CORE_Run.cpp:30
virtual tMemSize getMemorySize() const override
return the memory size of the class
Definition: CORE_Run.h:79
static CORE_UniquePointer< CORE_ClassFactory > mClassFactory
Definition: CORE_Run.h:51
static tBoolean Is64Architecture()
return true if the machine is a 64 bits machine
Definition: CORE_Run.h:140
static CORE_ClassFactory & GetClassFactory()
return the class factory
Definition: CORE_Run.h:213
static tBoolean mIsProfiling
Definition: CORE_Run.h:54
static void SetVersion(const tString &version)
set the version
Definition: CORE_Run.h:113
virtual tMemSize getContentsMemorySize() const override
return the memory size in byte
Definition: CORE_Run.h:90
static tBoolean Is32Architecture()
return true if the machine is a 32 bits machine
Definition: CORE_Run.h:147
static void SetOutputOptions(const std::map< tString, tString > &option)
create the output stream from the options
Definition: CORE_Run.cpp:67
virtual tBoolean makeTests(const std::map< tString, tString > &options) const
make tests command
Definition: CORE_Run.cpp:321
static void SetSoftName(const tString &soft)
set soft name
Definition: CORE_Run.h:99
static tString mSoftName
Definition: CORE_Run.h:42
virtual void initManOptions(std::map< tString, std::map< tString, tString > > &options) const
init the man of the options
Definition: CORE_Run.cpp:145
static CORE_UniquePointer< CORE_Out > mOut
Definition: CORE_Run.h:48
static const tString & GetSoftName()
get soft name
Definition: CORE_Run.h:105
virtual void initOptions(std::map< tString, tString > &options) const
default initialization of the options
Definition: CORE_Run.cpp:168
static tString mVersion
Definition: CORE_Run.h:45
static CORE_Out & Out()
return the output stream
Definition: CORE_Run.h:174
static void InitSeed(const unsigned int &seed)
init the seed for uniform random generator
Definition: CORE_Run.h:157
tBoolean executeRun(int argc, char *argv[]) const
run the program from main class
Definition: CORE_Run.cpp:196
static const tBoolean & IsProfiling()
retun true if the code is in profing mode
Definition: CORE_Run.h:129
virtual tBoolean makeRun(const tString &command, const std::map< tString, tString > &options) const
make Run command
Definition: CORE_Run.cpp:314
static void SetDebugOptions(const std::map< tString, tString > &option)
create the debug data from options
Definition: CORE_Run.cpp:41
virtual void createClassFactories(const std::map< tString, tString > &options) const
create the class factories from options
Definition: CORE_Run.cpp:138
CORE_Run(void)
create
Definition: CORE_Run.cpp:26
static const tString & GetVersion()
get the version
Definition: CORE_Run.h:119
typename std::unique_ptr< T, CORE_Object::Delete > CORE_UniquePointer
Definition: sp.h:8
#define tLDouble
Definition: types.h:70
#define tString
Definition: types.h:147
#define tMemSize
Definition: types.h:166
#define tBoolean
Definition: types.h:151