00001 /* @version $Revision: 1328 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2011-10-03 17:04:17 +0200 (Mon, 03 Oct 2011) $ */ 00002 #ifndef _ACQUISITIONPARSER_HH 00003 #define _ACQUISITIONPARSER_HH 00004 00005 00006 #include "mTypes.h" 00007 #include "CrcCheck.hh" 00008 00009 class Run; 00010 class Event; 00011 00012 #define EVENT_CORRECT 1 00013 #define LAST_FILE_EVENT 2 00014 #define EVENT_ERROR 3 00015 #define TYPE_NOT_SUPPORTED 4 00016 #define NEW_CONFIG 5 00017 00018 class AcquisitionParser { 00019 public: 00020 AcquisitionParser(Run& aRun, FILE *anInputFilae,ui32 _lastEventId); 00021 ~AcquisitionParser() { }; 00022 virtual int getNextEvent(Event& event) = 0; 00023 protected: 00024 /* Convert given binary into gray code - max 32 bits */ 00025 unsigned int binaryToGray(unsigned int bin); 00026 /* Convert given gray code into binary - max 32 bits */ 00027 unsigned int grayToBinary(unsigned int gray); 00028 void setComputeCrcFlag(bool value ); 00029 00030 00031 // ------ data members -------// 00032 protected: 00033 Run& run; // current run 00034 i32 lastEventId; // current event number 00035 FILE* inputFile; // current acquisition file being read 00036 bool computeCrc; 00037 CrcCheck *crc; 00038 00039 }; 00040 00041 #endif /* _ACQUISITIONPARSER_HH */