New flat raw-data event format. The details can be found at: http://indico.cern.ch...
[u/mrichter/AliRoot.git] / RAW / AliRawReaderMemory.h
CommitLineData
7ab595b2 1#ifndef ALIRAWREADERMEMORY_H
2#define ALIRAWREADERMEMORY_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8///////////////////////////////////////////////////////////////////////////////
9///
10/// This is a class for reading raw data memory.
11///
12///////////////////////////////////////////////////////////////////////////////
13
14#include "AliRawReader.h"
15#ifdef __CINT__
16class fstream;
17#else
18#include <Riostream.h>
19#endif
e8692df9 20#include <vector>
7ab595b2 21
22
23class AliRawReaderMemory: public AliRawReader {
24 public :
25 AliRawReaderMemory();
26 AliRawReaderMemory(UChar_t* memory, UInt_t size);
7ab595b2 27 virtual ~AliRawReaderMemory();
28
299738b9 29 virtual void RequireHeader(Bool_t required);
30
7ab595b2 31 virtual UInt_t GetType() const {return 0;};
32 virtual UInt_t GetRunNumber() const {return 0;};
33 virtual const UInt_t* GetEventId() const {return 0;};
34 virtual const UInt_t* GetTriggerPattern() const {return 0;};
35 virtual const UInt_t* GetDetectorPattern() const {return 0;};
36 virtual const UInt_t* GetAttributes() const {return 0;};
37 virtual const UInt_t* GetSubEventAttributes() const {return 0;};
38 virtual UInt_t GetLDCId() const {return 0;};
39 virtual UInt_t GetGDCId() const {return 0;};
741c154c 40 virtual UInt_t GetTimestamp() const {return 0;};
7ab595b2 41
e8692df9 42 virtual Int_t GetEquipmentSize() const;
7ab595b2 43 virtual Int_t GetEquipmentType() const {return 0;};
e8692df9 44 virtual Int_t GetEquipmentId() const;
7ab595b2 45 virtual const UInt_t* GetEquipmentAttributes() const {return NULL;};
46 virtual Int_t GetEquipmentElementSize() const {return 0;};
299738b9 47 virtual Int_t GetEquipmentHeaderSize() const {return 0;};
7ab595b2 48
49 virtual Bool_t ReadHeader();
50 virtual Bool_t ReadNextData(UChar_t*& data);
bf22797a 51 virtual Bool_t ReadNext(UChar_t* data, Int_t size);
7ab595b2 52
53 virtual Bool_t Reset();
54
55 virtual Bool_t NextEvent();
56 virtual Bool_t RewindEvents();
57
012425c9 58 virtual Bool_t SetMemory( UChar_t* memory, ULong_t size );
59
e8692df9 60 void SetEquipmentID(Int_t id);
7ab595b2 61
e8692df9 62 Bool_t AddBuffer(UChar_t* memory, ULong_t size, Int_t equipmentId );
63 void ClearBuffers();
7ab595b2 64
e8692df9 65 protected :
7ab595b2 66
67 private:
e8692df9 68 class AliRRMBuffer {
69 public:
70 AliRRMBuffer();
71 AliRRMBuffer(UChar_t* pBuffer, UInt_t bufferSize, Int_t equipmentId);
72 ~AliRRMBuffer();
73 AliRRMBuffer(const AliRRMBuffer& src);
74 AliRRMBuffer& operator=(const AliRRMBuffer& src);
75
76 UChar_t* GetBuffer() const {return fBuffer;}
77 UInt_t GetBufferSize() const {return fBufferSize;}
78 Int_t GetEquipmentId() const {return fEquipmentId;}
79 void SetEquipmentId(Int_t equipmentId) {fEquipmentId=equipmentId;}
80 private:
81 UChar_t* fBuffer; //! buffer for payload
82 UInt_t fBufferSize; //! size of fBuffer in bytes
83 Int_t fEquipmentId; //! Equipment id
84 };
7ab595b2 85
86 AliRawReaderMemory(const AliRawReaderMemory& rawReader);
87 AliRawReaderMemory& operator = (const AliRawReaderMemory& rawReader);
e8692df9 88
89 Bool_t OpenNextBuffer();
90
91 UInt_t fPosition; //! Current position in current buffer
92 vector<AliRRMBuffer> fBuffers; //! Current buffer descriptor
93 UInt_t fCurrent; //! Current buffer index
94
95 ClassDef(AliRawReaderMemory, 0) // class for reading raw digits from a memory block
7ab595b2 96};
97
98#endif
76a7ad7a 99