]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSHuffman.h
- introduce IsBad() virtual method in AliITSCalibration to check the status
[u/mrichter/AliRoot.git] / ITS / AliITSHuffman.h
CommitLineData
b0f5e3fc 1#ifndef AliITSHUFFMAN_H
2#define AliITSHUFFMAN_H
3
4///////////////////////////////////////////////////
5// Huffman Table associated classes for set:ITS //
6///////////////////////////////////////////////////
7
b0f5e3fc 8
9#include <TObject.h>
b0f5e3fc 10
11class AliITSInStream;
92c19c36 12class TObjectArray;
2574db5e 13
14
15//___________________________________________
16class AliITSHuffman: public TObject{
17
18public:
19class AliITSHNode : public TObject {
b0f5e3fc 20
b0f5e3fc 21 public:
22 AliITSHNode();
23 AliITSHNode(UChar_t symbol, ULong_t freq);
24 virtual ~AliITSHNode() {
25 // destructor
26 }
27 AliITSHNode(const AliITSHNode &source); // copy constructor
28 AliITSHNode& operator=(const AliITSHNode &source); // ass. op.
29
30 Bool_t IsSortable() const {
31 // is sortable
32 return kTRUE;
33 }
2a941f4e 34 Int_t Compare(const TObject *obj) const;
2574db5e 35 UChar_t GetSymbol() const {return fSymbol;}
36 ULong_t GetFrequency() const {return fFrequency;}
37 AliITSHNode *GetLeft() const {return fLeft;}
38 AliITSHNode *GetRight() const {return fRight;}
39 AliITSHNode *GetFather() const {return fFather;}
40 // void SetSymbol(UChar_r s){fSymbol=s;}
41 void SetFrequency(ULong_t fq){fFrequency=fq;}
42 void SetLeft(AliITSHNode *n){fLeft = n;}
43 void SetRight(AliITSHNode *n){fRight = n;}
44 void SetFather(AliITSHNode *n){fFather = n;}
e8189707 45
2574db5e 46
47 private:
e8189707 48
49 UChar_t fSymbol; // comment to be written
50 ULong_t fFrequency; // comment to be written
51 AliITSHNode *fLeft; // comment to be written
52 AliITSHNode *fRight; // comment to be written
53 AliITSHNode *fFather; // not used
2574db5e 54};
55 AliITSHuffman();
56 AliITSHuffman(Int_t size);
57 virtual ~AliITSHuffman();
58 AliITSHuffman(const AliITSHuffman &source); // copy constructor
59 AliITSHuffman& operator=(const AliITSHuffman &source); // ass. op.
b0f5e3fc 60
2574db5e 61 Int_t Size() const {
b0f5e3fc 62 // size
63 return fSize;
64 }
2574db5e 65 UChar_t *CodeLen() const {
b0f5e3fc 66 // code len
67 return fCodeLen;
68 }
2574db5e 69 ULong_t *Code() const {
b0f5e3fc 70 // code
71 return fCode;
72 }
2574db5e 73 TObjArray *HNodes() const {
b0f5e3fc 74 // HNodes
75 return fHNodes;
76 }
77
78
79 void GetFrequencies(Int_t len, UChar_t *stream);
80 void BuildHTable();
2574db5e 81 Bool_t SpanTree(AliITSHuffman::AliITSHNode*start, ULong_t code, UChar_t len);
b0f5e3fc 82 void ResetHNodes();
e8189707 83 void ClearTable();
2574db5e 84
b0f5e3fc 85 protected:
86
87 Int_t fSize; // size of the arrays
e8189707 88 UChar_t *fCodeLen; //![fSize] number of bits array
89 ULong_t *fCode; //![fSize] coded symbols array
b0f5e3fc 90
e8189707 91 Short_t *fSym; //![fSize] array of input symbols
b0f5e3fc 92 TObjArray *fHNodes; // array of nodes
93 Int_t fNnodes; // number of nodes
94
2574db5e 95 ClassDef(AliITSHuffman,1) //Huffman Table object for set:ITS
b0f5e3fc 96 };
97
98#endif