]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RAW/AliRawReader.h
strdup replaced by malloc and strcpy
[u/mrichter/AliRoot.git] / RAW / AliRawReader.h
CommitLineData
a6e7b125 1#ifndef ALIRAWREADER_H
2#define ALIRAWREADER_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6#include <TObject.h>
39f9963f 7#include "AliRawDataHeader.h"
8de97894 8
a6e7b125 9
a6e7b125 10class AliRawReader: public TObject {
11 public :
8de97894 12 AliRawReader();
42d20574 13 AliRawReader(const AliRawReader& rawReader);
14 AliRawReader& operator = (const AliRawReader& rawReader);
15 virtual ~AliRawReader() {};
8de97894 16
17 void Select(Int_t detectorID,
18 Int_t minDDLID = -1, Int_t maxDDLID = -1);
f224de6c 19 void SelectEquipment(Int_t equipmentType,
20 Int_t minEquipmentId = -1,
21 Int_t maxEquipmentId = -1);
39f9963f 22 void SkipInvalid(Bool_t skip = kTRUE)
23 {fSkipInvalid = skip;};
a6e7b125 24
42d20574 25 virtual UInt_t GetType() const = 0;
26 virtual UInt_t GetRunNumber() const = 0;
27 virtual const UInt_t* GetEventId() const = 0;
28 virtual const UInt_t* GetTriggerPattern() const = 0;
29 virtual const UInt_t* GetDetectorPattern() const = 0;
30 virtual const UInt_t* GetAttributes() const = 0;
c946ab02 31 virtual UInt_t GetLDCId() const = 0;
42d20574 32 virtual UInt_t GetGDCId() const = 0;
04fa961a 33
c946ab02 34 virtual Int_t GetEquipmentSize() const = 0;
35 virtual Int_t GetEquipmentType() const = 0;
36 virtual Int_t GetEquipmentId() const = 0;
37 virtual const UInt_t* GetEquipmentAttributes() const = 0;
38 virtual Int_t GetEquipmentElementSize() const = 0;
a6e7b125 39
39f9963f 40 Int_t GetDetectorID() const
41 {if (GetEquipmentId() >= 0) return (GetEquipmentId() >> 8); else return -1;};
42 Int_t GetDDLID() const
43 {if (GetEquipmentId() >= 0) return (GetEquipmentId() & 0xFF); else return -1;};
44
c946ab02 45 Int_t GetDataSize() const
39f9963f 46 {if (fHeader) return fHeader->fSize - sizeof(AliRawDataHeader);
509a7696 47 else return GetEquipmentSize();};
48
c946ab02 49 Int_t GetVersion() const
39f9963f 50 {if (fHeader) return fHeader->fVersion; else return -1;};
51 Bool_t IsValid() const
52 {if (fHeader) return fHeader->TestAttribute(0);
53 else return kFALSE;};
c946ab02 54 Bool_t IsCompressed() const
39f9963f 55 {if (fHeader) return fHeader->TestAttribute(1);
c946ab02 56 else return kFALSE;};
57
58 virtual Bool_t ReadHeader() = 0;
8de97894 59 virtual Bool_t ReadNextData(UChar_t*& data) = 0;
60 virtual Bool_t ReadNextInt(UInt_t& data);
61 virtual Bool_t ReadNextShort(UShort_t& data);
62 virtual Bool_t ReadNextChar(UChar_t& data);
63
64 virtual Bool_t Reset() = 0;
a6e7b125 65
39f9963f 66 enum {kErrMagic=1, kErrNoDataHeader=2,
67 kErrSize=4, kErrOutOfBounds=8};
b4857df7 68 virtual Int_t CheckData() const;
69 Int_t GetErrorCode() {return fErrorCode;};
70
509a7696 71 void DumpData(Int_t limit = -1);
72
a6e7b125 73 protected :
42d20574 74 Bool_t IsSelected() const;
a6e7b125 75
8de97894 76 virtual Bool_t ReadNext(UChar_t* data, Int_t size) = 0;
a6e7b125 77
39f9963f 78 AliRawDataHeader* fHeader; // current data header
a6e7b125 79 Int_t fCount; // counter of bytes to be read for current DDL
80
f224de6c 81 Int_t fSelectEquipmentType; // type of selected equipment (<0 = no selection)
82 Int_t fSelectMinEquipmentId; // minimal index of selected equipment (<0 = no selection)
83 Int_t fSelectMaxEquipmentId; // maximal index of selected equipment (<0 = no selection)
39f9963f 84 Bool_t fSkipInvalid; // skip invalid data
8de97894 85
b4857df7 86 Int_t fErrorCode; // code of last error
87
a6e7b125 88 ClassDef(AliRawReader, 0) // base class for reading raw digits
89};
90
91#endif