11 #include <framework/logging/Logger.h>
12 #include <framework/utilities/FileSystem.h>
13 #include <cdc/utilities/OpenFile.h>
15 #include <boost/iostreams/device/file.hpp>
16 #include <boost/iostreams/filter/gzip.hpp>
19 using namespace boost;
28 void openFileA(std::ifstream& ifs,
const std::string& fileName0)
30 std::string fileName1 =
"/data/cdc/" + fileName0;
31 std::string fileName = FileSystem::findFile(fileName1,
true);
34 fileName = FileSystem::findFile(fileName0,
true);
38 B2FATAL(
"CDC::openFile: " << fileName0 <<
" not exist!");
40 B2INFO(
"CDC::openFile: open " << fileName);
41 ifs.open(fileName.c_str());
42 if (!ifs) B2FATAL(
"CDC::openFile: cannot open " << fileName <<
" !");
47 void openFileB(boost::iostreams::filtering_istream& ifs,
const std::string& fileName0)
49 std::string fileName1 =
"/data/cdc/" + fileName0;
50 std::string fileName = FileSystem::findFile(fileName1,
true);
53 fileName = FileSystem::findFile(fileName0,
true);
57 B2FATAL(
"CDC::openFile: " << fileName0 <<
" not exist!");
59 B2INFO(
"CDC::openFile: open " << fileName);
60 if ((fileName.rfind(
".gz") != string::npos) && (fileName.length() - fileName.rfind(
".gz") == 3)) {
61 ifs.push(boost::iostreams::gzip_decompressor());
63 ifs.push(boost::iostreams::file_source(fileName));
64 if (!ifs) B2FATAL(
"CDC::openFile: cannot open " << fileName <<
" !");