00001 /* Raw Data Reader: Classes for reading raw data blocks 00002 * 00003 * Created By: dandwyer@caltech.edu 2009/7/10 00004 */ 00005 00006 #ifndef RAWDATAREADER_H 00007 #define RAWDATAREADER_H 00008 00009 namespace DayaBay { 00010 class RawRecord; 00011 class RawData; 00012 class RawEvent; 00013 } 00014 00015 class IInputStream; 00016 00017 namespace DayaBay { 00018 00019 // Base raw data block 00020 class RawDataReader { 00021 public: 00022 RawDataReader(); 00023 ~RawDataReader(); 00025 bool open(const char* filename); 00026 00028 void close(); 00029 00031 DayaBay::RawRecord* nextRecord(); 00032 DayaBay::RawData* nextData(); 00033 DayaBay::RawEvent* nextEvent(); 00034 private: 00035 bool read(unsigned int size, unsigned int offset=0); 00036 void checkFileHeader(); 00037 bool processFileStart(); 00038 bool processDataSeparator(); 00039 private: 00040 IInputStream* m_input; 00041 unsigned int* m_buffer; 00042 unsigned int m_size; 00043 unsigned int m_version; 00044 }; 00045 00046 } 00047 00048 #endif // RAWDATAREADER_H