15 #include <TDirectory.h> 17 #include <TObjString.h> 23 using std::ostringstream;
84 if (map_iter ==
fCacheMap->end())
return 0;
85 return map_iter->second;
90 fCacheMap->insert( map<string, CacheBranchI *>::value_type(key,branch) );
98 if(k1.size()>0) key <<
"/" << k1;
99 if(k2.size()>0) key <<
"/" << k2;
112 LOG(
"Cache",
pNOTICE) <<
"Removing cache branches";
129 LOG(
"Cache",
pNOTICE) <<
"Removing cache branches: *"<< key_substring<<
"*";
140 TObjString * keyobj = 0;
142 while ((keyobj = (TObjString *)kiter.Next())) {
143 string key =
string(keyobj->GetString().Data());
145 bname <<
"buffer_" << ib++;
148 fCacheMap->insert( map<string, CacheBranchI *>::value_type(key,buffer) );
163 TList *
keys =
new TList;
164 keys->SetOwner(
true);
168 string key = citer->first;
172 bname <<
"buffer_" << ib++;
173 keys->Add(
new TObjString(key.c_str()));
174 branch->Write(bname.str().c_str(), TObject::kOverwrite);
177 keys->Write(
"key_list", TObject::kSingleKey | TObject::kOverwrite );
185 if(filename.size() == 0)
return;
196 fCacheFile =
new TFile(filename.c_str(),
"update");
208 stream <<
"\n [-] GENIE Cache Buffers:";
212 string key = citer->first;
214 stream <<
"\n |--o " <<
key;
216 stream <<
" *** NULL *** ";
THE MAIN GENIE PROJECT NAMESPACE
map< string, CacheBranchI * > * fCacheMap
map of cache buffers & cache file
void RmAllCacheBranches(void)
void AddCacheBranch(string key, CacheBranchI *branch)
void DummyMethodAndSilentCompiler()
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
void OpenCacheFile(string filename)
cache file
void Print(ostream &stream) const
print cache buffers
string CacheBranchKey(string k0, string k1="", string k2="") const
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
static Cache * fInstance
singleton instance
Cache()
singleton class: constructors are private
proper de-allocation of the singleton object
void RmMatchedCacheBranches(string key_substring)
static Cache * Instance(void)
QTextStream & endl(QTextStream &s)
The TObject at the root of concrete cache branches.
void RmCacheBranch(string key)
removing cache branches