File indexing completed on 2024-04-06 12:19:14
0001 #ifndef FileReaderDCC_h
0002 #define FileReaderDCC_h
0003
0004 #include <stdexcept> // std::runtime_error
0005 #include <unistd.h> // size_t
0006
0007 class FileReaderDCC {
0008 private:
0009 unsigned short *raw_event;
0010
0011 unsigned long long word_0, word_1, word_2;
0012 unsigned long long file_buffer[4000];
0013
0014 unsigned long long *end, *file_buffer_end;
0015
0016 public:
0017 enum { Header = 1, Trailer = 2, DCCoversize = 4, FFFF = 8, Unknown = 16, EndOfStream = 32 };
0018 enum {
0019 Type1 = Header | Trailer,
0020 Type2 = Header,
0021 Type3 = Header | DCCoversize,
0022 Type4 = Trailer,
0023 Type5 = Unknown,
0024 Type6 = Unknown | DCCoversize,
0025 Type7 = FFFF
0026 };
0027 private:
0028 unsigned int eventStatus, selectCriteria, acceptCriteria, rejectCriteria;
0029
0030 int fd;
0031
0032 public:
0033 int open(const char *filename);
0034 size_t read(const unsigned short *&buf);
0035 size_t next(const unsigned short *&buf);
0036 void select(unsigned int criteria) throw() { selectCriteria = criteria; }
0037 void accept(unsigned int criteria) throw() {
0038 acceptCriteria = criteria;
0039 }
0040 void reject(unsigned int criteria) throw() {
0041 rejectCriteria = criteria;
0042 }
0043
0044 unsigned int status(void) const throw() { return eventStatus; }
0045
0046 FileReaderDCC(void);
0047 virtual ~FileReaderDCC(void);
0048 };
0049
0050 #endif