]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawReader.h
extended check
[u/mrichter/AliRoot.git] / RAW / AliRawReader.h
index 564524cdaca8e165400dc971bb113c3726723e15..3ba999969d8f1c1a67db03fa9a087c268740d194 100644 (file)
@@ -4,37 +4,32 @@
  * See cxx source for full Copyright notice                               */
 
 #include <TObject.h>
+#include "AliMiniHeader.h"
 
 
-struct AliMiniHeader {
-  UInt_t    fSize;
-  UChar_t   fDetectorID;
-  UChar_t   fMagicWord[3];
-  UChar_t   fVersion;
-  UChar_t   fCompressionFlag;
-  UShort_t  fDDLID;
-};
-
 class AliRawReader: public TObject {
   public :
     AliRawReader();
+    AliRawReader(const AliRawReader& rawReader);
+    AliRawReader& operator = (const AliRawReader& rawReader);
+    virtual ~AliRawReader() {};
 
     void             Select(Int_t detectorID, 
                            Int_t minDDLID = -1, Int_t maxDDLID = -1);
 
-    virtual UInt_t   GetType() = 0;
-    virtual UInt_t   GetRunNumber() = 0;
-    virtual const UInt_t* GetEventId() = 0;
-    virtual const UInt_t* GetTriggerPattern() = 0;
-    virtual const UInt_t* GetDetectorPattern() = 0;
-    virtual const UInt_t* GetAttributes() = 0;
-    virtual UInt_t   GetGDCId() = 0;
+    virtual UInt_t   GetType() const = 0;
+    virtual UInt_t   GetRunNumber() const = 0;
+    virtual const UInt_t* GetEventId() const = 0;
+    virtual const UInt_t* GetTriggerPattern() const = 0;
+    virtual const UInt_t* GetDetectorPattern() const = 0;
+    virtual const UInt_t* GetAttributes() const = 0;
+    virtual UInt_t   GetGDCId() const = 0;
 
-    inline Int_t     GetDataSize() const {return fMiniHeader->fSize;};
-    inline Int_t     GetDetectorID() const {return fMiniHeader->fDetectorID;};
-    inline Int_t     GetDDLID() const {return fMiniHeader->fDDLID;};
-    inline Int_t     GetVersion() const {return fMiniHeader->fVersion;};
-    inline Bool_t    IsCompressed() const {return fMiniHeader->fCompressionFlag != 0;};
+    Int_t            GetDataSize() const {return fMiniHeader->fSize;};
+    Int_t            GetDetectorID() const {return fMiniHeader->fDetectorID;};
+    Int_t            GetDDLID() const {return fMiniHeader->fDDLID;};
+    Int_t            GetVersion() const {return fMiniHeader->fVersion;};
+    Bool_t           IsCompressed() const {return fMiniHeader->fCompressionFlag != 0;};
 
     virtual Bool_t   ReadMiniHeader() = 0;
     virtual Bool_t   ReadNextData(UChar_t*& data) = 0;
@@ -44,10 +39,15 @@ class AliRawReader: public TObject {
 
     virtual Bool_t   Reset() = 0;
 
+    enum {kErrMagic=1, kErrNoMiniHeader=2, kErrMiniMagic=4, 
+         kErrSize=8, kErrOutOfBounds=16};
+    virtual Int_t    CheckData() const;
+    Int_t            GetErrorCode() {return fErrorCode;};
+
   protected :
-    Bool_t           IsSelected();
+    Bool_t           IsSelected() const;
 
-    Bool_t           CheckMiniHeader();
+    Bool_t           CheckMiniHeader(AliMiniHeader* miniHeader = NULL) const;
     virtual Bool_t   ReadNext(UChar_t* data, Int_t size) = 0;
 
     AliMiniHeader*   fMiniHeader;  // current mini header
@@ -57,6 +57,8 @@ class AliRawReader: public TObject {
     Int_t            fSelectMinDDLID;    // minimal index of selected DDLs (<0 = no selection)
     Int_t            fSelectMaxDDLID;    // maximal index of selected DDLs (<0 = no selection)
 
+    Int_t            fErrorCode;         // code of last error
+
     ClassDef(AliRawReader, 0) // base class for reading raw digits
 };