/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/RawFile/RawFile-00-00-10/RawFile/raw_ifstream.h

Go to the documentation of this file.
00001 #ifndef BESIII_RAW_IFSTREAM_H
00002 #define BESIII_RAW_IFSTREAM_H
00003 
00004 #include "RawFile/RawFileUtil.h"
00005 #include <stdint.h>
00006 #include <fstream>
00007 #include <vector>
00008 #include <string>
00009 #include <pthread.h>
00010 #include <assert.h>
00011 
00012 
00013 class raw_ifstream : virtual public std::ifstream
00014 {
00015    public :
00016 
00017       static raw_ifstream* instance(const std::vector<std::string>& fnames);
00018       static void release();
00019 
00020       static void lock() {
00021          int lstat = pthread_mutex_lock( &_pthread_lock );
00022          assert( lstat == 0 );
00023       };
00024       static void unlock() {
00025          int lstat = pthread_mutex_unlock( &_pthread_lock );
00026          assert( lstat == 0 );
00027       };
00028 
00029       std::string currentFile() const { return *m_curFile; }
00030 
00031       void next_file();
00032 
00033       uint32_t runNo();
00034 
00035 
00036    private :
00037 
00038       raw_ifstream(const std::vector<std::string>& fnames);
00039       virtual ~raw_ifstream();
00040 
00041       void init_fstream();
00042 
00043       raw_ifstream();  //stop default
00044 
00045 
00046    private :
00047 
00048       bool                  m_isOpen;
00049 
00050       FileStartRecord       m_fileStartRecord;
00051       FileNameStrings       m_fileNameStrings;
00052       RunParametersRecord   m_runParametersRecord;
00053 
00054       std::vector<std::string>            m_fnames;
00055       std::vector<std::string>::iterator  m_curFile;
00056 
00057       static int               _nHandler;
00058       static raw_ifstream*      _instance;
00059       static pthread_mutex_t   _pthread_lock;
00060 };
00061 
00062 #endif

Generated on Tue Nov 29 22:58:36 2016 for BOSS_7.0.2 by  doxygen 1.4.7