BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
SimpleRawReader Class Reference

#include <SimpleRawReader.h>

Public Member Functions

 SimpleRawReader (const std::string &fname)
 
virtual ~SimpleRawReader ()
 
const uint32_t * nextEvent ()
 
raw_ifstreamraw_stream ()
 

Detailed Description

Definition at line 7 of file SimpleRawReader.h.

Constructor & Destructor Documentation

◆ SimpleRawReader()

SimpleRawReader::SimpleRawReader ( const std::string &  fname)

Definition at line 9 of file SimpleRawReader.cxx.

10 : m_bufferSize(DefaultEventBufferSize),
11 m_buffer( new uint32_t[DefaultEventBufferSize] )
12{
13 m_rfs = new raw_ifstream(std::vector<std::string>(1, fname));
14}
#define DefaultEventBufferSize

◆ ~SimpleRawReader()

SimpleRawReader::~SimpleRawReader ( )
virtual

Definition at line 16 of file SimpleRawReader.cxx.

17{
18 delete[] m_buffer;
19 m_rfs->close();
20 delete m_rfs;
21}

Member Function Documentation

◆ nextEvent()

const uint32_t * SimpleRawReader::nextEvent ( )

Definition at line 23 of file SimpleRawReader.cxx.

24{
25 (*m_rfs) >> _dataSeparatorRecord;
26
27 uint32_t size = _dataSeparatorRecord.getRecord().data_block_size;
28 if ( size > m_bufferSize*4 ) {
29 while ( size > m_bufferSize*4 ) {
30 m_bufferSize *= 2;
31 }
32 delete[] m_buffer;
33 m_buffer = new uint32_t[m_bufferSize];
34 }
35
36 m_rfs->read((char*)m_buffer, size);
37 if ( ! m_rfs->good() ) {
38 //std::cerr << "[RawFile] Failed to read FullEventFragment to buffer" << std::endl;
39 throw BadInputStream("event_data_block");
40 }
41
42 return m_buffer;
43}
const data_separator_record & getRecord() const
Definition: RawFileUtil.h:132

Referenced by GenRdmTrgIdxAlg::execute().

◆ raw_stream()

raw_ifstream * SimpleRawReader::raw_stream ( )
inline

Definition at line 15 of file SimpleRawReader.h.

15{ return m_rfs; }

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


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