16 if(owner.empty())
DianaThrow(
"QGlobalDataManager::GetInstance() needs owner specification at first call")
49 std::map<QGlobalLabel, CachedObject>::iterator iter =
fDataMap.begin();
51 delete iter->second.object;
60 o<<
"Dump of cached global QObjects. Caller: \"";
63 std::map<QGlobalLabel,CachedObject>::const_iterator iter =
fDataMap.begin();
73 for(
int i = 0; i < 88; i++) o<<
"-";
78 if((iter->second.object)) evData = (iter->second.object);
85 snprintf(buf,128,
"%06d",label.
fEndRun);
87 snprintf(buf,128,
"%04d",label.
fChannel);
90 if(evData) isValid = evData->
IsValid();
94 std::stringstream msgStream;
95 evData->
Dump(msgStream);
97 std::getline(msgStream,line);
99 while(std::getline(msgStream,line)) {
108 o<<
"End of dump of global QObjects "<<std::endl;
116 std::vector<QGlobalLabel> labels;
117 std::map<QGlobalLabel, CachedObject>::const_iterator iter =
fDataMap.begin();
119 labels.push_back(iter->first);
129 std::map<QGlobalLabel, CachedObject>::const_iterator iter =
fDataMap.find(label);
131 obj = iter->second.object;
#define Q_BEGIN_NAMESPACE
Object to manage I/O (DB, file, or memory) of diana global quantities.
std::vector< QGlobalLabel > GetWriteLabels() const
get labels
static QGlobalDataManager & GetInstance(const std::string &owner="")
singleton interface provided for use in non diana executables. Do not use it within diana or root mac...
std::string fOutputVersion
Version tag of this release, used to write onto the DB. Parameter not accessible to the user.
bool fCacheEnabled
cache enabled
~QGlobalDataManager()
dtor
std::string fOwner
the module that is accessing this object
static QGlobalDataManager * fUniqueInstance
singleton instance
std::string fInputVersion
Version tag of the objects to be read, used to read from the DB. Parameter not accessible to the user...
void SetOwner(const std::string &owner)
set the module that is accessing this object
std::map< QGlobalLabel, CachedObject > fDataMap
cached QObject 's
void Dump(std::ostream &o) const
Dump cached objects to stream.
QGlobalDataManager()
constructor
std::map< QGlobalLabel, std::string > fDefaultMap
default owners
const QObject * GetByLabel(const QGlobalLabel &) const
get object by label (not-recommended). Works only on cached object's
static int fInstances
number of instances
Label for global QObject's.
std::string fName
Object name.
std::string fOwner
Object owner.
int fBeginRun
begin validity
base class for objects handled by QEvent and QGlobalDataManager.
virtual void Dump(std::ostream &o) const
print content to stream (intended for screen print or log files)
bool IsValid() const
check wheter object is valid
const char * GetDianaCleanVersionTag()
Return the DIANA version tag cleaned.
std::string Resize(const std::string &s, size_t len)
resize a string to len, adding spaces if necessary