BOSS 7.0.9
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 42 of file raw_ifstream.cxx.

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

Referenced by raw_ifstream().

◆ ~raw_ifstream()

raw_ifstream::~raw_ifstream ( )
virtual

Definition at line 53 of file raw_ifstream.cxx.

54{
55}

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 11 of file raw_ifstream.cxx.

12{
13 lock();
14
15 if ( _instance == 0 ) {
16 _instance = new raw_ifstream(fnames);
17 }
18
19 ++_nHandler;
20
21 unlock();
22
23 return _instance;
24}
static void unlock()
Definition: raw_ifstream.h:24
static void lock()
Definition: raw_ifstream.h:20

Referenced by 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 57 of file raw_ifstream.cxx.

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

◆ release()

void raw_ifstream::release ( )
static

Definition at line 26 of file raw_ifstream.cxx.

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

Referenced by RawFileReader::~RawFileReader().

◆ runNo()

uint32_t raw_ifstream::runNo ( )

Definition at line 71 of file raw_ifstream.cxx.

72{
73 return m_runParametersRecord.getRecord().run_number;
74}
const run_parameters_record & getRecord() const
Definition: RawFileUtil.h:106

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: