C++ main module for gpm 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_VectorReader.h"
5 #include "CORE_Object.h"
6 #include "CORE_Out.h"
7 
21 class CORE_Run : public virtual CORE_Object {
22  SP_OBJECT(CORE_Run);
23 
24  //attributes
25 private :
26 
27 
28  tString mVersion;
29 
30 protected:
31  // CONSTRUCTORS
34  CORE_Run(void);
35 
36  // DESTRUCTORS
39  virtual ~CORE_Run(void);
40 
41 
42 
43 public :
44  // CREATE class
47  static inline SP::CORE_Run New() {
48  SP::CORE_Run p(new CORE_Run(),CORE_Run::Delete());
49  p->setThis(p);
50  return p;
51  }
52 
53  //SET & GET methods
56  inline void setVersion(const tString& version) {
57  mVersion=version;
58  }
61  inline tString getVersion() const {
62  return mVersion;
63  }
64  // MAIN Method
65 
68  virtual tBoolean run(int argc,char* argv[]) const;
69 
70 
73  virtual tString man() const;
74 
75 
76 
79  virtual tBoolean runTests() const;
80 
81 protected:
84  tString readPath(const tString& path) const;
87  tString readFile(const tString& path, const tString& fn) const;
88 
91  inline tBoolean readVector(const tString& str,vector<tReal>& value) const {
92  tString s=str;
93  tBoolean succeeds=CORE_VectorReader::readVector(s,value);
94  return succeeds;
95  }
98  inline tBoolean readVector(const tString& str,tReal value[3]) const {
99 
100  vector<tReal> vs;
101  tString s=str;
103  unsigned int i,p=(vs.size()<3)?vs.size():3;
104  for (i=0;i<p;i++) value[i]=vs[i];
105  return succeeds;
106  }
109  inline tBoolean readVector(const tString& str,int value[3]) const {
110  tReal rv[3];
111  tString s=str;
112  tBoolean succeeds=readVector(s,rv);
113  for (int i=0;i<3;i++) value[i]=(int) rv[i];
114  return succeeds;
115  }
118  inline tBoolean readVector(const tString& str,tBoolean value[3]) const {
119  vector<tBoolean> vs;
120  tString s=str;
122  unsigned int i,p=(vs.size()<3)?vs.size():3;
123  for (i=0;i<p;i++) value[i]=vs[i];
124  return succeeds;
125  }
126 
129  tBoolean readBoolean(const tString& fn) const;
132  int readInt(const tString& fn) const;
135  tReal readReal(const tString& fn) const;
136 
139  map<tString,tString> readOptions(int argc,char *argv[]) const;
140 
143  SP::CORE_Out createIO(const tBoolean& isVerbose,
144  const tString& verboseFile,
145  const tFlag& mode) const;
146 
149  inline SP::CORE_Out createIO(const tBoolean& isVerbose,
150  const tString& verboseFile) const {
151 
152  return createIO(isVerbose,verboseFile,CORE_Out::CREATE);
153  }
154 
155 
156 };
157 
158 
159 #endif
SP::CORE_Out createIO(const tBoolean &isVerbose, const tString &verboseFile, const tFlag &mode) const
create the io
Definition: CORE_Run.cpp:91
static const tFlag CREATE
Definition: CORE_Out.h:34
DEFINE_SPTR(CORE_Run)
tBoolean readVector(const tString &str, int value[3]) const
read an int vector
Definition: CORE_Run.h:109
CORE_Run(void)
create
Definition: CORE_Run.cpp:5
map< tString, tString > readOptions(int argc, char *argv[]) const
read the options
Definition: CORE_Run.cpp:31
This class is a Run class for Common package.
Definition: CORE_Run.h:21
tBoolean readVector(const tString &str, tBoolean value[3]) const
read an int vector
Definition: CORE_Run.h:118
virtual ~CORE_Run(void)
destroy
Definition: CORE_Run.cpp:9
int readInt(const tString &fn) const
read int
Definition: CORE_Run.cpp:85
void setVersion(const tString &version)
set the version
Definition: CORE_Run.h:56
static SP::CORE_Run New()
create a new class
Definition: CORE_Run.h:47
#define tBoolean
Definition: types.h:35
virtual tBoolean run(int argc, char *argv[]) const
run the progrm
Definition: CORE_Run.cpp:109
tBoolean readVector(const tString &str, tReal value[3]) const
read a double vector
Definition: CORE_Run.h:98
tString readFile(const tString &path, const tString &fn) const
read the file name from options
Definition: CORE_Run.cpp:22
static tBoolean readVector(tString &str, vector< T > &vs)
read vector of string v v=[x,y,z,t] or x,y,z,t
Definition: CORE_VectorReader.hpp:7
SP::CORE_Out createIO(const tBoolean &isVerbose, const tString &verboseFile) const
create the io
Definition: CORE_Run.h:149
tBoolean readBoolean(const tString &fn) const
read boolean
Definition: CORE_Run.cpp:79
tString readPath(const tString &path) const
read the path from options
Definition: CORE_Run.cpp:14
abstract base class for most classes.
Definition: CORE_Object.h:30
virtual tString man() const
return the man
Definition: CORE_Run.cpp:115
tBoolean readVector(const tString &str, vector< tReal > &value) const
read a double vector
Definition: CORE_Run.h:91
#define tString
Definition: types.h:36
#define tReal
Definition: types.h:18
tReal readReal(const tString &fn) const
read real
Definition: CORE_Run.cpp:88
virtual tBoolean runTests() const
run the tests
Definition: CORE_Run.cpp:119
tString getVersion() const
get the version
Definition: CORE_Run.h:61
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14