]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSHuffman.h
Fix for coverity
[u/mrichter/AliRoot.git] / ITS / AliITSHuffman.h
... / ...
CommitLineData
1#ifndef AliITSHUFFMAN_H
2#define AliITSHUFFMAN_H
3
4///////////////////////////////////////////////////
5// Huffman Table associated classes for set:ITS //
6///////////////////////////////////////////////////
7
8
9#include <TObject.h>
10
11class AliITSInStream;
12class TObjectArray;
13
14
15//___________________________________________
16class AliITSHuffman: public TObject{
17
18public:
19class AliITSHNode : public TObject {
20
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 }
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;}
45
46
47 private:
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
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.
60
61 Int_t Size() const {
62 // size
63 return fSize;
64 }
65 UChar_t *CodeLen() const {
66 // code len
67 return fCodeLen;
68 }
69 ULong_t *Code() const {
70 // code
71 return fCode;
72 }
73 TObjArray *HNodes() const {
74 // HNodes
75 return fHNodes;
76 }
77
78
79 void GetFrequencies(Int_t len, UChar_t *stream);
80 void BuildHTable();
81 Bool_t SpanTree(AliITSHuffman::AliITSHNode*start, ULong_t code, UChar_t len);
82 void ResetHNodes();
83 void ClearTable();
84
85 protected:
86
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
90
91 Short_t *fSym; //![fSize] array of input symbols
92 TObjArray *fHNodes; // array of nodes
93 Int_t fNnodes; // number of nodes
94
95 ClassDef(AliITSHuffman,1) //Huffman Table object for set:ITS
96 };
97
98#endif