00001 #ifndef FileReaderDCC_h
00002 #define FileReaderDCC_h
00003
00004 #include <stdexcept>
00005 #include <unistd.h>
00006
00007 class FileReaderDCC {
00008 private:
00009 unsigned short *raw_event;
00010
00011 unsigned long long word_0, word_1, word_2;
00012 unsigned long long file_buffer[4000];
00013
00014 unsigned long long *end, *file_buffer_end;
00015
00016 public:
00017 enum {Header=1,Trailer=2,DCCoversize=4,FFFF=8,Unknown=16,EndOfStream=32};
00018 enum {Type1=Header|Trailer, Type2=Header, Type3=Header|DCCoversize, Type4=Trailer, Type5=Unknown, Type6=Unknown|DCCoversize, Type7=FFFF};
00019 private:
00020 unsigned int eventStatus, selectCriteria, acceptCriteria, rejectCriteria;
00021
00022 int fd;
00023
00024 public:
00025 int open(const char *filename) throw (std::runtime_error);
00026 size_t read(const unsigned short* &buf) throw (std::runtime_error);
00027 size_t next(const unsigned short* &buf) throw (std::runtime_error);
00028 void select(unsigned int criteria) throw() { selectCriteria = criteria; }
00029 void accept(unsigned int criteria) throw() { acceptCriteria = criteria; }
00030 void reject(unsigned int criteria) throw() { rejectCriteria = criteria; }
00031
00032 unsigned int status(void) const throw() { return eventStatus; }
00033
00034 FileReaderDCC(void);
00035 virtual ~FileReaderDCC(void);
00036 };
00037
00038 #endif