7 #include <TDirectory.h> 16 class ROOTContextSentinel {
18 ROOTContextSentinel() :
dir(gDirectory),
file(gFile) {}
19 ~ROOTContextSentinel() { gDirectory =
dir; gFile =
file; }
32 ROOTContextSentinel ctx;
34 rootFile.reset(TFile::Open(fileName.c_str(),
"RECREATE"));
37 TrainerMonitoring::~TrainerMonitoring()
43 ROOTContextSentinel ctx;
45 typedef std::map<std::string, std::shared_ptr<Module> > Map;
46 for(Map::const_iterator iter =
modules.begin();
47 iter !=
modules.end(); ++iter) {
49 TDirectory *
dir =
rootFile->mkdir(iter->first.c_str());
51 iter->second->write(dir);
59 TrainerMonitoring::Module::~Module()
65 typedef std::map<std::string, std::shared_ptr<Object> > Map;
66 for(Map::const_iterator iter =
data.begin();
67 iter !=
data.end(); ++iter)
68 iter->second->write(dir);
73 std::shared_ptr<Object> ptr(
object);
74 if (!
data.insert(std::make_pair(object->
getName(), ptr)).second)
76 <<
"Node \"" <<
object->getName() <<
"\" already" 77 " exists." << std::endl;
83 if (!
modules.insert(std::make_pair(name, module)).second)
85 <<
"Module \"" << name <<
"\" already" 86 " exists." << std::endl;
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
char data[epos_bytes_allocation]