39 std::stringstream name;
78 std::string extraLabel =
GetString(
"ExtraLabel",
"",
false);
79 if(extraLabel !=
"")
fLabel += std::string(
"_") + extraLabel;
85 std::string strVerb =
GetString(
"verbosity",
"info");
86 if ( strVerb ==
"debug")
88 else if ( strVerb ==
"info")
90 else if ( strVerb ==
"warning")
92 else if ( strVerb ==
"error")
94 else if ( strVerb ==
"panic")
97 Warn(
"Invalid value for parameter \"verbosity\"");
102 bool overWriteEvent =
GetBool(
"OverWriteEvent",
false,
false);
103 overWriteEvent = overWriteEvent || (
GetIteration() > 1);
113 std::vector<QEventLabel> empty;
134 for(
size_t i = 0; i < evl.
Size(); i++) { evl[i].SetOwner(&
fLabel); }
137 ret =
Process(eva,evl,exec,oevl);
140 for(
size_t i = 0; i < evl.
Size(); i++) { evl[i].SetOwner(0); }
149 for(
size_t i = 0; i < evl.
Size(); i++) { evl[i].SetOwner(&
fLabel); }
151 ret =
Process(eva,evl,exec,oevl);
153 for(
size_t i = 0; i < evl.
Size(); i++) { evl[i].SetOwner(0); }
181 return GetName() +
"." + occBuf;
190 catch(std::exception &ex) {
191 if(warnCfg)
Warn(
"%s; using default: %f", ex.what(), defVal);
201 std::vector<double> param;
205 catch(std::exception &ex) {
206 std::stringstream defMsg;
208 for(
size_t i =0; i < defVal.size(); i++) defMsg<<defVal[i]<<
",";
210 if(warnCfg)
Warn(
"%s; using default: %s", ex.what(), defMsg.str().c_str());
225 catch(std::exception &ex) {
226 if(warnCfg)
Warn(
"%s; using default: %d", ex.what(), defVal);
236 std::vector<int> param;
240 catch(std::exception &ex) {
241 std::stringstream defMsg;
243 for(
size_t i =0; i < defVal.size(); i++) defMsg<<defVal[i]<<
",";
246 if(warnCfg)
Warn(
"%s; using default: %s", ex.what(), defMsg.str().c_str());
262 catch(std::exception &ex) {
263 if(warnCfg)
Warn(
"%s; using default: %s", ex.what(), (defVal ?
"true" :
"false") );
272 std::vector<bool> param;
276 catch(std::exception &ex) {
277 std::stringstream defMsg;
278 std::vector<int> boolToInt;
280 for(
size_t i =0; i < defVal.size(); i++) {
281 defMsg<<defVal[i]<<
",";
282 boolToInt.push_back(defVal[i]);
286 if(warnCfg)
Warn(
"%s; using default: %s", ex.what(), defMsg.str().c_str());
299 const std::string* param;
304 catch(std::exception &ex) {
305 if(warnCfg)
Warn(
"%s; using default: %s", ex.what(), defVal.c_str() );
315 std::vector<std::string> param;
319 catch(std::exception &ex) {
320 std::stringstream defMsg;
322 for(
size_t i =0; i < defVal.size(); i++) defMsg<<defVal[i]<<
",";
325 if(warnCfg)
Warn(
"%s; using default: %s", ex.what(), defMsg.str().c_str());
std::string Demangle(const C &obj, int firstChar=0)
#define Q_BEGIN_NAMESPACE
std::string GetFullPath() const
Get Full Path of module "GetName() + "." + GetOccurrence".
const std::string & GetString(const std::string &parname, const std::string &defVal, bool warnCfg=true) const
Get a string parameter from config file ( see GetDouble() )
bool ProcessBase(QEventAssembler &ev, QEventList &evl, const bool exec, QEventList &ovl)
ProcessBase method is called for each event, getting the event and as argument.
void Warn(const char *descr,...) const
Send a warning message (an error that the framework can recover) with printf syntax.
virtual ~QBaseModule()
constructor
void EndBase()
EndBase method is called after event loop.
unsigned int GetIteration() const
Get Current sequence iteration.
virtual bool Process(QEventAssembler &ev, QEventList &evl, const bool exec, QEventList &ovl)=0
Process method is called for each event, getting the event and as argument and must be implemented by...
std::vector< QEventLabel > fRequiredLabels
void Info(const char *descr,...) const
Send an info message (information) with printf syntax.
void UpdateConfigParameters(const std::string &p) const
update module config
double GetDouble(const std::string &parname, double defVal, bool warnCfg=true) const
Get a double parameter from config file.
const QSequence & GetSequence() const
get reference to this sequence
virtual void End()=0
End method is called after event loop and must be implemented by inheriting classes.
int GetInt(const std::string &parname, int defVal, bool warnCfg=true) const
Get an int parameter from config file ( see GetDouble() )
std::vector< std::string > GetVectorString(const std::string &parname, std::vector< std::string > defVal, bool warnCfg=true) const
Get a vector<string> parameter from config file ( see GetVectorDouble() )
bool GetBool(const std::string &parname, bool defVal, bool warnCfg=true) const
Get a bool parameter from config file ( see GetDouble() )
std::vector< bool > GetVectorBool(const std::string &parname, std::vector< bool > defVal, bool warnCfg=true) const
Get a vector<bool> parameter from config file ( see GetVectorDouble() )
std::vector< int > GetVectorInt(const std::string &parname, std::vector< int > defVal, bool warnCfg=true) const
Get an vector<int> parameter from config file ( see GetVectorDouble() )
void Update(QSequence *s, unsigned int occurrence)
set the occurrence in the same sequence. MV FIXME: should not be public
virtual void Begin(QEventAssembler &ev)=0
Begin method is called before event loop and must be implemented by inheriting classes.
void BeginBase(QEventAssembler &ev)
Begin Base method is called before event loop.
unsigned int GetOccurrence() const
get the number of times the same module is loaded inside a QSequence
std::vector< double > GetVectorDouble(const std::string &parname, std::vector< double > defVal, bool warnCfg=true) const
Get a std::vector<double> parameter from config file with syntax "{x,y,z}".
QBaseModule(Type type)
constructor
const std::string & GetName() const
Get Module name.
Visitor class of QEvent that provides full handling of QEvent.
void SetOverWrite(const bool ow=true)
set that all the QEvent QObject (s) can be overwritten (calls QEvent::SetOverWrite())
void SetOwner(const std::string *owner)
set the module that is currently acting on the QEvent calls (QEvent::SetOwner())
void SetRequiredLabels(const std::vector< QEventLabel > &labels, bool incremental=true)
set which QObjects are required. If incremental = false, labels not in the vector are set to not requ...
std::vector< QEventLabel > GetRequiredLabels(const std::string &owner="all") const
Get the list of all required QObject labels.
list of references to const QEvent (s)
size_t Size() const
number of QEvent (s)
void SetOwner(const std::string &owner)
set the module that is accessing this object
int fOccurrence
occurrence in sequence
std::map< std::string, std::string > fParameters
config and optional parameters
std::string fName
module name
std::string fLabel
label of the module = fName + "_" + ExtraLabel
std::string fSoftwareRevision
GIT revision SHA-1
std::string fVersionTag
Version release tag.
std::string fSequenceName
sequence name
std::string fType
module type (reader,module,driver...)
void ResetTimer()
Reset the timer to now.
void SetTimeProfilingOn(bool val)
Set the time profiling on/off.
unsigned long long int fProcessCalls
NUmber of calls to the process.
double fProcessTime
Total time spent running the process.
bool GetTimeProfilingOn() const
Check if the time profiling is on.
double GetTimer() const
return the time since the last reset
std::string GetTimeProfileReport(const std::string &prefix="") const
Report the time profiling.
const std::string & GetName() const
const std::string & GetString(const std::string &seq, const std::string &mod, size_t occ, const std::string &par)
double GetDouble(const std::string &seq, const std::string &mod, size_t occ, const std::string &par)
std::vector< double > GetVectorDouble(const std::string &seq, const std::string &mod, size_t occ, const std::string &par)
void SetParameter(const std::string &n, const QVdt &value, const bool isDefault=false)
std::vector< bool > GetVectorBool(const std::string &seq, const std::string &mod, size_t occ, const std::string &par)
const QVdt & GetParameter(const std::string &seq, const std::string &mod, size_t occ, const std::string &par)
std::vector< std::string > GetVectorString(const std::string &seq, const std::string &mod, size_t occ, const std::string &par)
int GetInt(const std::string &seq, const std::string &mod, size_t occ, const std::string &par)
static QOptions & GetInstance()
std::vector< int > GetVectorInt(const std::string &seq, const std::string &mod, size_t occ, const std::string &par)
bool GetBool(const std::string &seq, const std::string &mod, size_t occ, const std::string &par)
Diana Reconstruction program.
const QGlobalDataManager & GlobalData() const
Access to the global data manager for the sequence.
const std::string & GetString() const