BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
raw_ifstream.h
Go to the documentation of this file.
1#ifndef BESIII_RAW_IFSTREAM_H
2#define BESIII_RAW_IFSTREAM_H
3
5#include <stdint.h>
6#include <fstream>
7#include <vector>
8#include <string>
9#include <pthread.h>
10#include <assert.h>
11
12
13class raw_ifstream : virtual public std::ifstream
14{
15 public :
16
17 static raw_ifstream* instance(const std::vector<std::string>& fnames);
18 static void release();
19
20 static void lock() {
21 int lstat = pthread_mutex_lock( &_pthread_lock );
22 assert( lstat == 0 );
23 };
24 static void unlock() {
25 int lstat = pthread_mutex_unlock( &_pthread_lock );
26 assert( lstat == 0 );
27 };
28
29 std::string currentFile() const { return *m_curFile; }
30
31 void next_file();
32
33
34 private :
35
36 raw_ifstream(const std::vector<std::string>& fnames);
37 virtual ~raw_ifstream();
38
39 void init_fstream();
40
41 raw_ifstream(); //stop default
42
43
44 private :
45
46 bool m_isOpen;
47
48 FileStartRecord m_fileStartRecord;
49 FileNameStrings m_fileNameStrings;
50 RunParametersRecord m_runParametersRecord;
51
52 std::vector<std::string> m_fnames;
53 std::vector<std::string>::iterator m_curFile;
54
55 static int _nHandler;
56 static raw_ifstream* _instance;
57 static pthread_mutex_t _pthread_lock;
58};
59
60#endif
#define private
void next_file()
static void unlock()
Definition: raw_ifstream.h:24
static void lock()
Definition: raw_ifstream.h:20
static void release()
static raw_ifstream * instance(const std::vector< std::string > &fnames)
std::string currentFile() const
Definition: raw_ifstream.h:29