Correction of the inheritance scheme
[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
8//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9// Attention! Two classes in this file.
10// They have to stay in the same file.
11//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
13#include <TObject.h>
14#include <TObjArray.h>
15
16class AliITSInStream;
17
18class AliITSHNode: public TObject {
19
20 public:
21
22 UChar_t fSymbol; // comment to be written
23 ULong_t fFrequency; // comment to be written
24 AliITSHNode *fLeft; // comment to be written
25 AliITSHNode *fRight; // comment to be written
26 AliITSHNode *fFather; // not used
27
28 public:
29 AliITSHNode();
30 AliITSHNode(UChar_t symbol, ULong_t freq);
31 virtual ~AliITSHNode() {
32 // destructor
33 }
34 AliITSHNode(const AliITSHNode &source); // copy constructor
35 AliITSHNode& operator=(const AliITSHNode &source); // ass. op.
36
37 Bool_t IsSortable() const {
38 // is sortable
39 return kTRUE;
40 }
41 Int_t Compare(TObject *obj);
42
43 ClassDef(AliITSHNode,1) //HuffT node object for set:ITS
44 };
45
46//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
47// Attention! Next class has kept deliberaty in
48// the same file as the previous one
49//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
50//___________________________________________
51class AliITSHTable: public TObject{
52
53public:
54 AliITSHTable();
55 AliITSHTable(Int_t size);
56 virtual ~AliITSHTable();
57 AliITSHTable(const AliITSHTable &source); // copy constructor
58 AliITSHTable& operator=(const AliITSHTable &source); // ass. op.
59
60 Int_t Size() {
61 // size
62 return fSize;
63 }
64 UChar_t *CodeLen() {
65 // code len
66 return fCodeLen;
67 }
68 ULong_t *Code() {
69 // code
70 return fCode;
71 }
72 TObjArray *HNodes() {
73 // HNodes
74 return fHNodes;
75 }
76
77
78 void GetFrequencies(Int_t len, UChar_t *stream);
79 void BuildHTable();
80 Bool_t SpanTree(AliITSHNode*start, ULong_t code, UChar_t len);
81 void ResetHNodes();
82 void Clear();
83
84 protected:
85
86 Int_t fSize; // size of the arrays
87 UChar_t *fCodeLen; //[fSize] number of bits array
88 ULong_t *fCode; //[fSize] coded symbols array
89
90 Short_t *fSym; //[fSize] array of input symbols
91 TObjArray *fHNodes; // array of nodes
92 Int_t fNnodes; // number of nodes
93
94 ClassDef(AliITSHTable,1) //Huffman Table object for set:ITS
95 };
96
97#endif