BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
raw_ifstream Class Reference

#include <raw_ifstream.h>

+ Inheritance diagram for raw_ifstream:

Public Member Functions

std::string currentFile () const
 
void next_file ()
 
uint32_t runNo ()
 
 raw_ifstream (const std::vector< std::string > &fnames)
 
virtual ~raw_ifstream ()
 

Static Public Member Functions

static raw_ifstreaminstance (const std::vector< std::string > &fnames)
 
static void release ()
 
static void lock ()
 
static void unlock ()
 

Detailed Description

Definition at line 13 of file raw_ifstream.h.

Constructor & Destructor Documentation

◆ raw_ifstream()

raw_ifstream::raw_ifstream ( const std::vector< std::string > & fnames)

Definition at line 46 of file raw_ifstream.cxx.

47 : m_isOpen(false), m_fnames(fnames)
48{
49 if ( m_fnames.empty() ) {
50 throw RawExMessage("[RawFile] Empty input file list!");
51 }
52
53 m_curFile = m_fnames.begin();
54 init_fstream();
55}

Referenced by raw_ifstream().

◆ ~raw_ifstream()

raw_ifstream::~raw_ifstream ( )
virtual

Definition at line 57 of file raw_ifstream.cxx.

58{
59}

Member Function Documentation

◆ currentFile()

std::string raw_ifstream::currentFile ( ) const
inline

Definition at line 29 of file raw_ifstream.h.

29{ return *m_curFile; }

Referenced by RawFileReader::currentFile(), GenRdmTrgIdxAlg::execute(), and GenRdmTrgIdxAlg::finalize().

◆ instance()

raw_ifstream * raw_ifstream::instance ( const std::vector< std::string > & fnames)
static

Definition at line 15 of file raw_ifstream.cxx.

16{
17 lock();
18
19 if ( _instance == 0 ) {
20 _instance = new raw_ifstream(fnames);
21 }
22
23 ++_nHandler;
24
25 unlock();
26
27 return _instance;
28}
static void unlock()
static void lock()

Referenced by RawFileReader::RawFileReader(), RawFileReader::RawFileReader(), RawFileReader::RawFileReader(), and RawFileReader::RawFileReader().

◆ lock()

static void raw_ifstream::lock ( )
inlinestatic

Definition at line 20 of file raw_ifstream.h.

20 {
21 int lstat = pthread_mutex_lock( &_pthread_lock );
22 assert( lstat == 0 );
23 };

Referenced by instance(), RawFileReader::nextEvent(), and release().

◆ next_file()

void raw_ifstream::next_file ( )

Definition at line 61 of file raw_ifstream.cxx.

62{
63 std::cout << "[RawFile] Closing: " << *m_curFile << std::endl;
64 close();
65 m_isOpen = false;
66
67 if ( ++m_curFile == m_fnames.end() ) {
68 --m_curFile;
69 throw ReachEndOfFileList();
70 }
71
72 init_fstream();
73}
file close()

◆ release()

void raw_ifstream::release ( )
static

Definition at line 30 of file raw_ifstream.cxx.

31{
32 lock();
33
34 if ( _nHandler > 0 && --_nHandler == 0 ) {
35 if ( _instance->m_isOpen ) {
36 std::cout << "[RawFile] Closing: " << *(_instance->m_curFile) << std::endl;
37 _instance->close();
38 }
39 delete _instance;
40 _instance = 0;
41 }
42
43 unlock();
44}

Referenced by RawFileReader::~RawFileReader().

◆ runNo()

uint32_t raw_ifstream::runNo ( )

Definition at line 75 of file raw_ifstream.cxx.

76{
77 return m_runParametersRecord.getRecord().run_number;
78}
const run_parameters_record & getRecord() const

Referenced by RawFileReader::runNo().

◆ unlock()

static void raw_ifstream::unlock ( )
inlinestatic

Definition at line 24 of file raw_ifstream.h.

24 {
25 int lstat = pthread_mutex_unlock( &_pthread_lock );
26 assert( lstat == 0 );
27 };

Referenced by instance(), RawFileReader::nextEvent(), and release().


The documentation for this class was generated from the following files: