9 #include <framework/logging/Logger.h>
10 #include <framework/utilities/FileSystem.h>
11 #include <cdc/utilities/OpenFile.h>
13 #include <boost/iostreams/device/file.hpp>
14 #include <boost/iostreams/filter/gzip.hpp>
17 using namespace boost;
26 void openFileA(std::ifstream& ifs,
const std::string& fileName0)
28 std::string fileName1 =
"/data/cdc/" + fileName0;
29 std::string fileName = FileSystem::findFile(fileName1,
true);
32 fileName = FileSystem::findFile(fileName0,
true);
36 B2FATAL(
"CDC::openFile: " << fileName0 <<
" not exist!");
38 B2INFO(
"CDC::openFile: open " << fileName);
39 ifs.open(fileName.c_str());
40 if (!ifs) B2FATAL(
"CDC::openFile: cannot open " << fileName <<
" !");
45 void openFileB(boost::iostreams::filtering_istream& ifs,
const std::string& fileName0)
47 std::string fileName1 =
"/data/cdc/" + fileName0;
48 std::string fileName = FileSystem::findFile(fileName1,
true);
51 fileName = FileSystem::findFile(fileName0,
true);
55 B2FATAL(
"CDC::openFile: " << fileName0 <<
" not exist!");
57 B2INFO(
"CDC::openFile: open " << fileName);
58 if ((fileName.rfind(
".gz") != string::npos) && (fileName.length() - fileName.rfind(
".gz") == 3)) {
59 ifs.push(boost::iostreams::gzip_decompressor());
61 ifs.push(boost::iostreams::file_source(fileName));
62 if (!ifs) B2FATAL(
"CDC::openFile: cannot open " << fileName <<
" !");
void openFileB(boost::iostreams::filtering_istream &ifs, const std::string &fileName0)
Open a file using boost (to be able to read a gzipped file)
void openFileA(std::ifstream &ifs, const std::string &fileName0)
Open a file.
Abstract base class for different kinds of events.