Cat
Application.h
Go to the documentation of this file.
1 // $Id: $
2 //-----------------------------------------------------------------------------
3 //
4 // Package : Application
5 // Description: Object defining the application instance itself.
6 //
7 // Author(s) : F. Machefert -
8 // Date : January 20, 2007
9 //
10 //-----------------------------------------------------------------------------
11 
12 #ifndef INC_APPMGR_H
13 #define INC_APPMGR_H 1
14 
15 // Include files
16 #include "Hierarchy.h"
17 #include "StatusCode.h"
18 #include "Object.h"
19 
20 class Options;
21 class Console;
22 class DLLMgr;
23 class Computer;
24 class Element;
25 class Processus;
26 class ProcDataBase;
27 class Server;
28 
29 
38 class State {
39  public:
40  int nRun;
41  int nEventMax;
42  int nEvent;
43  int nErrors;
44  char status[16];
45 };
46 
47 class Config {
48  public:
49  char config[10000];
50  // char currentElement[256];
51  // char processList[1000];
52  /* char children[10000]; */
53 };
54 
55 typedef StatusCode ( *RunSvc )( );
56 typedef StatusCode ( *PlotSvc )( );
57 
58 class Application : public Object {
59  public:
61  Application( );
62 
63  virtual ~Application( );
64 
68  StatusCode initialize();
69 
73  StatusCode run ( std::string procName,
74  Element* element=0,
75  int nEvt = 1);
76 
80  StatusCode finalize ();
81 
87  return m_options;
88  }
89 
95  // info("Computer"+ itos((int)(m_computer)));
96  return m_computer;
97  }
98 
104  return m_dllMgr;
105  }
106 
112  return m_procDb;
113  }
114 
119  StatusCode loadHistoryFile();
120 
125  StatusCode bookkeeping();
126 
130  void banner ();
131 
135  void exit ();
136 
141  void setCurrent (Hierarchy* current) {
142  m_current = current;
143  }
144 
150  return m_current;
151  }
152 
153 
158  StatusCode cd (std::string path) {
159  Hierarchy* newcurrent = m_current->child(path);
160  if (0!=newcurrent) {
161  setCurrent(newcurrent);
162  return StatusCode::SUCCESS;
163  }
164  else {
165  return StatusCode::FAILURE;
166  }
167  }
168 
169 
173  std::string hostname(){
174  return m_hostName;
175  }
176 
177  void treeRecursive( Hierarchy*,
178  std::string );
179 
184  StatusCode create( std::string, std::string);
185 
190  StatusCode makeDir (std::string);
191 
196  State* state ();
197 
202  Config* config ();
203 
209  void setState ( std::string state = std::string("") );
210 
214  void setConfig ();
215 
220  char* status () {
221  return m_state->status;
222  }
223 
228  void network(std::string);
229 
234  void server();
235 
240  void setProcessus (Processus* processus) {
241  m_processus = processus;
242  }
243 
249  return m_processus;
250  }
251 
257  RunSvc svc = m_runSvc;
258  return svc();
259  }
260 
265  void setRunSvc( RunSvc svc ) {
266  m_runSvc = svc;
267  }
268 
274  PlotSvc svc = m_plotSvc;
275  return svc();
276  }
277 
282  void setPlotSvc( PlotSvc svc ) {
283  m_plotSvc = svc;
284  }
285 
290  void setVersion (std::string version) {
291  m_version = version;
292  }
293 
298  std::string version () {
299  return m_version;
300  }
301 
306  void setCtrl ( std::string control){
307  m_ctrl = control;
308  }
309 
314  std::string ctrl() {
315  return m_ctrl;
316  }
317 
322  StatusCode svcRunning ( );
323 
328  StatusCode prepare ( std::string procName,
329  Element* element=0,
330  int nEvt = 1);
331 
336  StatusCode loop ( );
337 
342  StatusCode terminate ( );
343 
348  StatusCode svcPlot ( );
349 
350  protected:
351  std::string m_accountName;
352  std::string m_hostName;
353  std::string m_osName;
354  std::string m_osVersion;
355  std::string m_prompt;
356  std::string m_version;
359 
360  private:
365 
367 
368  State *m_state; //< Current state of the application
369  Config *m_config; //< Current config of the application
370 
371  RunSvc m_runSvc; //< Current Processing Service
372  PlotSvc m_plotSvc; //< Current Plotting Service
373 
375  bool m_network;
376  std::string m_ctrl;
377 
378 };
379 
380 #endif // INC_APPMGR_H
def create(object, type)
Definition: shell.py:131
StatusCode(* RunSvc)()
Definition: Application.h:55
Definition: Object.h:21
Processus * m_processus
Definition: Application.h:366
std::string m_version
Definition: Application.h:356
Server * m_server
Definition: Application.h:374
void setProcessus(Processus *processus)
Definition: Application.h:240
std::string m_hostName
Definition: Application.h:352
Hierarchy * child(std::string)
Definition: Hierarchy.cpp:133
Definition: Server.h:22
int nRun
Definition: Application.h:40
bool m_isRunning
Definition: Application.h:357
int nEvent
Definition: Application.h:42
std::string m_osName
Definition: Application.h:353
def network()
Definition: shell.py:208
Config * m_config
Definition: Application.h:369
std::string hostname()
Definition: Application.h:173
int nEventMax
Definition: Application.h:41
std::string m_osVersion
Definition: Application.h:354
def run(processus, element, nevt)
Definition: shell.py:237
DLLMgr * m_dllMgr
Definition: Application.h:362
Definition: DLLMgr.h:19
void setPlotSvc(PlotSvc svc)
Definition: Application.h:282
RunSvc m_runSvc
Definition: Application.h:371
Options * options()
Definition: Application.h:86
Computer * computer()
Definition: Application.h:94
StatusCode(* PlotSvc)()
Definition: Application.h:56
std::string m_accountName
Definition: Application.h:351
bool m_network
Definition: Application.h:375
std::string m_ctrl
Definition: Application.h:376
DLLMgr * dllMgr()
Definition: Application.h:103
StatusCode cd(std::string path)
Definition: Application.h:158
ProcDataBase * procDb()
Definition: Application.h:111
std::string m_prompt
Definition: Application.h:355
Computer * m_computer
Definition: Application.h:364
ProcDataBase * m_procDb
Definition: Application.h:363
std::string ctrl()
Definition: Application.h:314
Hierarchy * current()
Definition: Application.h:149
Options * m_options
Definition: Application.h:361
void setVersion(std::string version)
Definition: Application.h:290
Hierarchy * m_current
Definition: Application.h:358
void setCurrent(Hierarchy *current)
Definition: Application.h:141
PlotSvc m_plotSvc
Definition: Application.h:372
StatusCode runSvc()
Definition: Application.h:256
int nErrors
Definition: Application.h:43
Processus * processus()
Definition: Application.h:248
std::string version()
Definition: Application.h:298
StatusCode plotSvc()
Definition: Application.h:273
void setRunSvc(RunSvc svc)
Definition: Application.h:265
char * status()
Definition: Application.h:220
char status[16]
Definition: Application.h:44
void setCtrl(std::string control)
Definition: Application.h:306
State * m_state
Definition: Application.h:368