27 if (!SafeTFile::file_map().empty())
close();
33 SafeTFile::TFileMap::iterator iter(SafeTFile::file_map().find(filename));
34 if (iter != SafeTFile::file_map().end())
37 what <<
"PHTFileServer::open - file " << filename <<
" already opened.";
38 cout << (what.str()) << endl;
41 iter->second->counter()++;
47 what <<
"PHTFileServer::open - opening file " << filename <<
" (" << type <<
")";
48 cout << (what.str()) << endl;
52 if (!file->IsOpen()) cout << (
"PHTFileServer::open - error opening TFile") << endl;
53 SafeTFile::file_map().insert(make_pair(filename, file));
61 SafeTFile::TFileMap::iterator iter(SafeTFile::file_map().find(filename));
62 if (iter != SafeTFile::file_map().end())
63 iter->second->Flush();
67 what <<
"PHTFileServer::flush - file " << filename <<
" not found";
68 cout << (what.str()) << endl;
78 SafeTFile::TFileMap::iterator iter(SafeTFile::file_map().find(filename));
79 if (iter != SafeTFile::file_map().end())
84 what <<
"PHTFileServer::flush - file " << filename <<
" not found";
85 cout << (what.str()) << endl;
95 SafeTFile::TFileMap::iterator iter(SafeTFile::file_map().find(filename));
96 if (iter != SafeTFile::file_map().end())
98 if (iter->second->counter() > 1)
100 iter->second->counter()--;
102 what <<
"PHTFileServer::write - file " << filename <<
" still in use.";
103 cout << (what.str()) << endl;
105 else if (iter->second->counter() == 1)
107 iter->second->Write();
108 iter->second->counter()--;
110 what <<
"PHTFileServer::write - writing file " << filename <<
".";
111 cout << (what.str()) << endl;
115 iter->second->Write();
117 what <<
"PHTFileServer::write - warning: too many calls for file " << filename <<
".";
118 cout << (what.str()) << endl;
124 what <<
"PHTFileServer::write - file " << filename <<
" not found";
125 cout << (what.str()) << endl;
137 for (SafeTFile::TFileMap::iterator iter = SafeTFile::file_map().begin(); iter != SafeTFile::file_map().end(); ++iter)
139 if (iter->second->IsOpen())
141 if (iter->second->counter())
144 what <<
"PHTFileServer::close - file " << iter->first <<
" forced write with kWriteDelete.";
145 cout << (what.str()) << endl;
146 iter->second->Write(
"0", TObject::kWriteDelete);
151 what <<
"PHTFileServer::close - closing " << iter->first <<
".";
152 iter->second->Close();
153 cout << (what.str()) << endl;
158 SafeTFile::file_map().clear();
171 what <<
"PHTFileServer::SafeTFile::~SafeTFile - file " << _filename <<
" forced write with kWriteDelete.";
172 cout << (what.str()) << endl;
173 Write(
"0", TObject::kWriteDelete);
177 what <<
"PHTFileServer::SafeTFile::~SafeTFile - closing " << _filename <<
".";
178 cout << (what.str()) << endl;
186 _map.erase(_filename);