]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliRawReaderMemory.h
Bug#56919: Fixing correct number of muon trk ldcs.
[u/mrichter/AliRoot.git] / RAW / AliRawReaderMemory.h
index 50e8d9643b1b52198bb1a1acb9f57ac5f01efeb8..e0905c698bc830a21ab6daf9a1a6621cd4ee1386 100644 (file)
@@ -17,17 +17,17 @@ class fstream;
 #else
 #include <Riostream.h>
 #endif
-#include <TString.h>
+#include <vector>
 
 
 class AliRawReaderMemory: public AliRawReader {
   public :
     AliRawReaderMemory();
     AliRawReaderMemory(UChar_t* memory, UInt_t size);
-/*     AliRawReaderMemory(const AliRawReaderMemory& rawReader); */
-/*     AliRawReaderMemory& operator = (const AliRawReaderMemory& rawReader); */
     virtual ~AliRawReaderMemory();
 
+    virtual void     RequireHeader(Bool_t required);
+
     virtual UInt_t   GetType() const {return 0;};
     virtual UInt_t   GetRunNumber() const {return 0;};
     virtual const UInt_t* GetEventId() const {return 0;};
@@ -37,12 +37,14 @@ class AliRawReaderMemory: public AliRawReader {
     virtual const UInt_t* GetSubEventAttributes() const {return 0;};
     virtual UInt_t   GetLDCId() const {return 0;};
     virtual UInt_t   GetGDCId() const {return 0;};
+    virtual UInt_t   GetTimestamp() const {return 0;};
 
-    virtual Int_t    GetEquipmentSize() const {return 0;};
+    virtual Int_t    GetEquipmentSize() const;
     virtual Int_t    GetEquipmentType() const {return 0;};
-    virtual Int_t    GetEquipmentId() const {return fEquipmentId;};
+    virtual Int_t    GetEquipmentId() const;
     virtual const UInt_t* GetEquipmentAttributes() const {return NULL;};
     virtual Int_t    GetEquipmentElementSize() const {return 0;};
+    virtual Int_t    GetEquipmentHeaderSize() const {return 0;};
 
     virtual Bool_t   ReadHeader();
     virtual Bool_t   ReadNextData(UChar_t*& data);
@@ -55,21 +57,43 @@ class AliRawReaderMemory: public AliRawReader {
 
     virtual Bool_t   SetMemory( UChar_t* memory, ULong_t size );
 
-    void             SetEquipmentID(Int_t id) { fEquipmentId = id; }
-
-  protected :
+    void             SetEquipmentID(Int_t id);
 
-    UChar_t*         fBuffer;      // buffer for payload
-    UInt_t           fBufferSize;  // size of fBuffer in bytes
-    UInt_t           fPosition;    // Current position in memory
-    Int_t            fEquipmentId;  // Equipment id provided by the user
+    Bool_t AddBuffer(UChar_t* memory, ULong_t size, Int_t equipmentId );
+    void ClearBuffers();
 
-    ClassDef(AliRawReaderMemory, 0) // class for reading raw digits from a memory block
+  protected :
 
   private:
+    class AliRRMBuffer {
+    public:
+      AliRRMBuffer();
+      AliRRMBuffer(UChar_t* pBuffer, UInt_t bufferSize, Int_t equipmentId);
+      ~AliRRMBuffer();
+      AliRRMBuffer(const AliRRMBuffer& src);
+      AliRRMBuffer& operator=(const AliRRMBuffer& src);
+
+      UChar_t* GetBuffer() const {return fBuffer;}
+      UInt_t GetBufferSize() const {return fBufferSize;}
+      Int_t GetEquipmentId() const {return fEquipmentId;}
+      void SetEquipmentId(Int_t equipmentId) {fEquipmentId=equipmentId;}
+    private:
+      UChar_t*         fBuffer;       //! buffer for payload
+      UInt_t           fBufferSize;   //! size of fBuffer in bytes
+      Int_t            fEquipmentId;  //! Equipment id
+    };
 
     AliRawReaderMemory(const AliRawReaderMemory& rawReader);
     AliRawReaderMemory& operator = (const AliRawReaderMemory& rawReader);
+
+    Bool_t OpenNextBuffer();
+
+    UInt_t                          fPosition;      //! Current position in current buffer
+    vector<AliRRMBuffer>            fBuffers;       //! Current buffer descriptor
+    UInt_t                          fCurrent;       //! Current buffer index
+
+    ClassDef(AliRawReaderMemory, 0) // class for reading raw digits from a memory block
 };
 
 #endif
+