00001 /* @version $Revision: 1776 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2012-06-13 16:43:36 +0200 (Wed, 13 Jun 2012) $ */ 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 void setSkipEvent(ui16 nbEvent) { skipNbEvent = nbEvent; } 00024 protected: 00025 /* Convert given binary into gray code - max 32 bits */ 00026 unsigned int binaryToGray(unsigned int bin); 00027 /* Convert given gray code into binary - max 32 bits */ 00028 unsigned int grayToBinary(unsigned int gray); 00029 void setComputeCrcFlag(bool value ); 00030 00031 00032 // ------ data members -------// 00033 protected: 00034 Run& run; // current run 00035 i32 lastEventId; // current event number 00036 FILE* inputFile; // current acquisition file being read 00037 bool computeCrc; 00038 CrcCheck *crc; 00039 ui16 skipNbEvent; 00040 00041 }; 00042 00043 #endif /* _ACQUISITIONPARSER_HH */