Luiza  v03-01
LuizaSteerCheck.h
1 #ifndef LuizaSteerCheck_h
2 #define LuizaSteerCheck_h 1
3 
4 #include "luiza/CCProcessor.h"
5 #include "luiza/CCCollection.h"
6 #include "luiza/CMProcessor.h"
7 #include "luiza/XMLParser.h"
8 
9 //comment out the line below if your terminal
10 //doesn't support colored output
11 #define TERM_COLOR
12 
13 #ifdef TERM_COLOR
14 
15 #define clrscr() printf("\033[2J")
16 #define dblue() printf("\x1b[34m")
17 #define dred() printf("\x1b[31m")
18 #define dyellow() printf("\x1b[33m")
19 #define dgreen() printf("\x1b[32m")
20 #define dunderline() printf("\x1b[4m")
21 #define ditalic() printf("\x1b[3m")
22 #define ddunkel() printf("\x1b[2m")
23 #define dhell() printf("\x1b[1m")
24 #define dblink() printf("\x1b[5m")
25 #define endcolor() printf("\x1b[m")
26 
27 #else
28 
29 #define clrscr()
30 #define dblue()
31 #define dred()
32 #define dyellow()
33 #define dgreen()
34 #define dunderline()
35 #define ditalic()
36 #define ddunkel()
37 #define dhell()
38 #define dblink()
39 #define endcolor()
40 
41 #endif
42 
43 #define MAXEVENTS 30
44 
45 namespace luiza {
46 
47  class CCCollection;
48  class CCProcessor;
49 
50  typedef std::vector< CCProcessor* > ProcVec;
51 
73 
74  public:
75 
76  // Constructor
77  LuizaSteerCheck( const char* steerFileName=NULL, const CommandLineParametersMap * cmdlineparams=NULL );
78 
79  // Destructor
80  ~LuizaSteerCheck();
81 
83  CMProcessor* getMProcs() { return _luizaProcs; };
84 
86  ProcVec& getAProcs() { return _aProc; };
87 
89  ProcVec& getIProcs() { return _iProc; };
90 
95  int existsProcessor( const std::string& type, const std::string& name="" );
96 
98  ColVec& getGLORIACols() const;
99 
101  StringVec& getGLORIAFiles(){ return _gloriaFiles; }
102 
104  sSet& getColsSet( const std::string& type, const std::string& name, CCProcessor* proc );
105 
107  StringParameters* getGlobalParameters(){ return _gparam; }
108 
110  void dumpColErrors( unsigned int i, std::ostream& stream, bool separators=false );
111 
113  int addGLORIAFile( const std::string& file );
114 
116  void remGLORIAFile( const std::string& file );
117 
119  void changeGLORIAFilePos( unsigned int pos, unsigned int newPos );
120 
122  void addProcessor( bool status, const std::string& name, const std::string& type, StringParameters* p=NULL );
123 
125  void remProcessor( unsigned int index, bool status );
126 
128  void activateProcessor( unsigned int index );
129 
131  void deactivateProcessor( unsigned int index );
132 
134  void changeProcessorPos( unsigned int pos, unsigned int newPos );
135 
137  void consistencyCheck();
138 
141  bool saveAsXMLFile( const std::string& file );
142 
143  /* Returns the relative path of the XML file */
144  const std::string getXMLFileRelPath(){ return _XMLFileRelPath; }
145 
146  /* Returns the absolute path of the XML file */
147  const std::string getXMLFileAbsPath(){ return _XMLFileAbsPath; }
148 
149  /* Returns the XML fileName */
150  const std::string getXMLFileName(){ return _XMLFileName; }
151 
152  /* Returns the XML file as given by the user in the command prompt */
153  const std::string getXMLFile(){ return _steeringFile; }
154 
156  void dump_information();
157 
159  sSet& getErrors(){ return _errors; };
160 
162  sSet& getPConditions(){ return _pConditions; };
163 
165  const std::string getCondition( unsigned int index );
166 
168  void addCondition( const std::string& condition );
169 
171  void repCondition( const std::string& oldCond, const std::string& newCond );
172 
174  void remCondition( const std::string& condition );
175 
177  bool saveAsDOTFile(const std::string& file);
178 
179  private:
180 
182  //METHODS
184 
185  // Return all available collections from the active or inactive processors
186  ColVec& getProcCols( const ProcVec& v, const std::string& iotype ) const;
187 
188  // Return all available collections found in GLORIA files and active/inactive processors
189  ColVec& getAllCols() const;
190 
191  // Return all available collections found in GLORIA files and active/inactive processors
192  ProcVec& getAllProcs() const;
193 
194  // Parse the given steering file
195  bool parseXMLFile( const std::string& file, const CommandLineParametersMap * cmdlineparams=NULL );
196 
197  // Pop a processor out of a vector from processors
198  CCProcessor* popProc(ProcVec& v, CCProcessor* p);
199 
200  // Find matching collections of a given type and value in a vector of collections for a given processor
201  ColVec& findMatchingCols( ColVec& v, CCProcessor* srcProc,
202  const std::string& type, const std::string& value="UNDEFINED", const std::string& name="UNDEFINED" );
203 
205  //VARIABLES
207 
208  sSet _errors; //XML File parsing error
209  //GLORIA Files loading error
210  //GEAR File loading error
211  //Some Processors have no parameters
212  //Some Active Processors are not installed
213  //Some Active Processors have collection errors
214  //Warning: Some Inactive Processors are not installed
215 
216  IParser* _parser; //parser
217  StringParameters* _gparam; //global parameters (without GLORIA Files)
218 
219  std::string _steeringFile; //steering file name + path as passed by the user in the command line
220  std::string _XMLFileName; //steering file name
221  std::string _XMLFileAbsPath; //steering file (absolute path without filename)
222  std::string _XMLFileRelPath; //steering file (relative path without filename)
223 
224  ProcVec _aProc; //active processors
225  ProcVec _iProc; //inactive processors
226  sColVecMap _gloriaCols; //GLORIA collections
227  StringVec _gloriaFiles; //GLORIA filenames
228 
229  sSet _colValues; //all available collection values for a given type (use in ComboBox)
230 
231  sSet _pConditions; //all processor's conditions
232 
233  CMProcessor* _luizaProcs; //Sigleton class containing all luiza processors
234  };
235 
236 } // namespace
237 #endif
void changeProcessorPos(unsigned int pos, unsigned int newPos)
Definition: LuizaSteerCheck.cc:223
ProcVec & getAProcs()
Definition: LuizaSteerCheck.h:86
Definition: CMProcessor.h:21
ProcVec & getIProcs()
Definition: LuizaSteerCheck.h:89
Definition: IParser.h:18
Definition: LuizaSteerCheck.h:72
StringVec & getGLORIAFiles()
Definition: LuizaSteerCheck.h:101
bool saveAsDOTFile(const std::string &file)
Definition: LuizaSteerCheck.cc:795
ColVec & getGLORIACols() const
Definition: LuizaSteerCheck.cc:577
void consistencyCheck()
Definition: LuizaSteerCheck.cc:251
int addGLORIAFile(const std::string &file)
Definition: LuizaSteerCheck.cc:118
CMProcessor * getMProcs()
Definition: LuizaSteerCheck.h:83
void activateProcessor(unsigned int index)
Definition: LuizaSteerCheck.cc:182
void remProcessor(unsigned int index, bool status)
Definition: LuizaSteerCheck.cc:149
StringParameters * getGlobalParameters()
Definition: LuizaSteerCheck.h:107
void dumpColErrors(unsigned int i, std::ostream &stream, bool separators=false)
Definition: LuizaSteerCheck.cc:979
void remGLORIAFile(const std::string &file)
Definition: LuizaSteerCheck.cc:128
sSet & getColsSet(const std::string &type, const std::string &name, CCProcessor *proc)
Definition: LuizaSteerCheck.cc:68
sSet & getErrors()
Definition: LuizaSteerCheck.h:159
const std::string getCondition(unsigned int index)
Definition: LuizaSteerCheck.cc:537
int existsProcessor(const std::string &type, const std::string &name="")
Definition: LuizaSteerCheck.cc:167
sSet & getPConditions()
Definition: LuizaSteerCheck.h:162
Namespace for Luiza framework.
Definition: CCCollection.h:6
void changeGLORIAFilePos(unsigned int pos, unsigned int newPos)
Definition: LuizaSteerCheck.cc:130
bool saveAsXMLFile(const std::string &file)
Definition: LuizaSteerCheck.cc:615
void repCondition(const std::string &oldCond, const std::string &newCond)
Definition: LuizaSteerCheck.cc:550
void addProcessor(bool status, const std::string &name, const std::string &type, StringParameters *p=NULL)
Definition: LuizaSteerCheck.cc:135
void addCondition(const std::string &condition)
Definition: LuizaSteerCheck.cc:546
void remCondition(const std::string &condition)
Definition: LuizaSteerCheck.cc:562
Definition: CCProcessor.h:43
void deactivateProcessor(unsigned int index)
Definition: LuizaSteerCheck.cc:200
void dump_information()
Definition: LuizaSteerCheck.cc:892