#include <raw_ifstream.h>
Public Member Functions | |
std::string | currentFile () const |
std::string | currentFile () const |
void | next_file () |
void | next_file () |
Static Public Member Functions | |
raw_ifstream * | instance (const std::vector< std::string > &fnames) |
raw_ifstream * | instance (const std::vector< std::string > &fnames) |
void | lock () |
void | lock () |
void | release () |
void | release () |
void | unlock () |
void | unlock () |
Private Member Functions | |
void | init_fstream () |
void | init_fstream () |
raw_ifstream () | |
raw_ifstream (const std::vector< std::string > &fnames) | |
raw_ifstream () | |
raw_ifstream (const std::vector< std::string > &fnames) | |
virtual | ~raw_ifstream () |
virtual | ~raw_ifstream () |
Private Attributes | |
std::vector< std::string >::iterator | m_curFile |
std::vector< std::string >::iterator | m_curFile |
FileNameStrings | m_fileNameStrings |
FileStartRecord | m_fileStartRecord |
std::vector< std::string > | m_fnames |
std::vector< std::string > | m_fnames |
RunParametersRecord | m_runParametersRecord |
Static Private Attributes | |
raw_ifstream * | _instance |
raw_ifstream * | _instance = 0 |
int | _nHandler = 0 |
pthread_mutex_t | _pthread_lock = PTHREAD_MUTEX_INITIALIZER |
|
00039 : m_fnames(fnames) 00040 { 00041 if ( m_fnames.empty() ) { 00042 throw RawExMessage("[RawFile] Empty input file list!"); 00043 } 00044 00045 m_curFile = m_fnames.begin(); 00046 init_fstream(); 00047 }
|
|
00050 { 00051 }
|
|
|
|
|
|
|
|
|
|
00029 { return *m_curFile; }
|
|
00029 { return *m_curFile; }
|
|
|
|
00067 { 00068 if ( access( m_curFile->c_str(), F_OK ) < 0 ) { 00069 std::cerr << "[RawFile] Invalid file: " << *m_curFile << std::endl; 00070 exit(1); 00071 } 00072 00073 std::cout << "[RawFile] Prepare for reading: " << *m_curFile << std::endl; 00074 00075 open( m_curFile->c_str(), std::ios::binary ); 00076 00077 try { 00078 (*this) >> m_fileStartRecord >> m_fileNameStrings >> m_runParametersRecord; 00079 } 00080 catch (RawFileException& e) { 00081 e.print(); 00082 exit(1); 00083 } 00084 }
|
|
|
|
00012 { 00013 lock(); 00014 00015 if ( _instance == 0 ) { 00016 _instance = new raw_ifstream(fnames); 00017 } 00018 00019 ++_nHandler; 00020 00021 unlock(); 00022 00023 return _instance; 00024 }
|
|
00020 {
00021 int lstat = pthread_mutex_lock( &_pthread_lock );
00022 assert( lstat == 0 );
00023 };
|
|
00020 {
00021 int lstat = pthread_mutex_lock( &_pthread_lock );
00022 assert( lstat == 0 );
00023 };
|
|
|
|
00054 { 00055 std::cout << "[RawFile] Closing: " << *m_curFile << std::endl; 00056 close(); 00057 00058 if ( ++m_curFile == m_fnames.end() ) { 00059 --m_curFile; 00060 throw ReachEndOfFileList(); 00061 } 00062 00063 init_fstream(); 00064 }
|
|
|
|
00027 { 00028 lock(); 00029 00030 if ( _nHandler > 0 && --_nHandler == 0 ) { 00031 delete _instance; 00032 _instance = 0; 00033 } 00034 00035 unlock(); 00036 }
|
|
00024 {
00025 int lstat = pthread_mutex_unlock( &_pthread_lock );
00026 assert( lstat == 0 );
00027 };
|
|
00024 {
00025 int lstat = pthread_mutex_unlock( &_pthread_lock );
00026 assert( lstat == 0 );
00027 };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|