1 #ifndef AliITSHUFFMAN_H
2 #define AliITSHUFFMAN_H
4 ///////////////////////////////////////////////////
5 // Huffman Table associated classes for set:ITS //
6 ///////////////////////////////////////////////////
15 //___________________________________________
16 class AliITSHuffman: public TObject{
19 class AliITSHNode : public TObject {
23 AliITSHNode(UChar_t symbol, ULong_t freq);
24 virtual ~AliITSHNode() {
27 AliITSHNode(const AliITSHNode &source); // copy constructor
28 AliITSHNode& operator=(const AliITSHNode &source); // ass. op.
30 Bool_t IsSortable() const {
34 Int_t Compare(const TObject *obj) const;
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;}
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
56 AliITSHuffman(Int_t size);
57 virtual ~AliITSHuffman();
58 AliITSHuffman(const AliITSHuffman &source); // copy constructor
59 AliITSHuffman& operator=(const AliITSHuffman &source); // ass. op.
65 UChar_t *CodeLen() const {
69 ULong_t *Code() const {
73 TObjArray *HNodes() const {
79 void GetFrequencies(Int_t len, UChar_t *stream);
81 Bool_t SpanTree(AliITSHuffman::AliITSHNode*start, ULong_t code, UChar_t len);
87 Int_t fSize; // size of the arrays
88 UChar_t *fCodeLen; //![fSize] number of bits array
89 ULong_t *fCode; //![fSize] coded symbols array
91 Short_t *fSym; //![fSize] array of input symbols
92 TObjArray *fHNodes; // array of nodes
93 Int_t fNnodes; // number of nodes
95 ClassDef(AliITSHuffman,1) //Huffman Table object for set:ITS