1#include "RawFile/raw_ifstream.h"
2#include "IRawFile/RawFileExceptions.h"
10int raw_ifstream::_nHandler = 0;
12pthread_mutex_t raw_ifstream::_pthread_lock = PTHREAD_MUTEX_INITIALIZER;
17 if ( _instance == 0 ) { _instance =
new raw_ifstream( fnames ); }
29 if ( _nHandler > 0 && --_nHandler == 0 )
31 if ( _instance->m_isOpen )
33 std::cout <<
"[RawFile] Closing: " << *( _instance->m_curFile ) << std::endl;
44 : m_isOpen( false ), m_fnames( fnames ) {
45 if ( m_fnames.empty() ) { throw RawExMessage(
"[RawFile] Empty input file list!" ); }
47 m_curFile = m_fnames.begin();
54 std::cout <<
"[RawFile] Closing: " << *m_curFile << std::endl;
58 if ( ++m_curFile == m_fnames.end() )
69void raw_ifstream::init_fstream() {
70 if ( access( m_curFile->c_str(), F_OK ) < 0 )
72 std::cerr <<
"[RawFile] Invalid file: " << *m_curFile << std::endl;
76 std::cout <<
"[RawFile] Prepare for reading: " << *m_curFile << std::endl;
78 open( m_curFile->c_str(), std::ios::binary );
83 ( *this ) >> m_fileStartRecord >> m_fileNameStrings >> m_runParametersRecord;
84 }
catch ( RawFileException& e )
m_outputFile open("YYYY/m_txt_dir/LumTau_XXXX.txt", ios_base::app)
virtual void print() const
raw_ifstream(const std::vector< std::string > &fnames)
static raw_ifstream * instance(const std::vector< std::string > &fnames)