6 #include "TObjString.h"
12 using namespace
Diana;
17 fQObjectCache =
new std::map<std::string, QObject*>;
29 if (!
fFile)
fFile =
new TFile(filename.c_str(),
"READ");
30 if(
fFile->IsZombie()) {
32 err.SetDescription(
"Cannot open " + filename);
36 else if(
fFile->TestBit(TFile::kRecovered)) {
38 err.SetDescription(
"File " + filename +
" not closed");
52 if(gROOT->GetListOfFiles()->GetSize() > 0)
delete fFile;
55 std::map<std::string, QObject*>::iterator iter;
64 if(
fFile != NULL)
return true;
78 std::map<std::string, QObject*>::const_iterator
object =
fQObjectCache->find(name);
83 QObject* obj =
dynamic_cast<QObject*
>(tobj);
84 if(obj) (*fQObjectCache)[name] = obj;
87 err.SetDescription(
GetName(),__LINE__,std::string(
"Could not find object \"")+name+
"\"");
#define REGISTER_GLOBAL_READER(clazz, ext)
global reader for root files
std::string GetFullPath(const std::string &name) const
QError Close()
Close file, called by QGlobalReaderDispatcher.
const Diana::QObject * GetQObject(const std::string &name, const std::string &className, QError &err) const
QError Open(const std::string &filename, const std::string &opt="")
Open file, called by QGlobalReaderDispatcher.
bool ReadingIsSafe() const
std::map< std::string, Diana::QObject * > * fQObjectCache
error class with error type and description
Abstract class for global readers.
const std::string & GetName() const
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...