X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=ITS%2FAliITSHuffman.h;h=054b91bcc694e2a98c774b50794343d74fb49e9b;hp=d3649ef6b3bd166be3e5c01caf0e185fc53b4fd1;hb=5379c4a36d42baeb9f7a3f573a57bb4957b3628d;hpb=b0f5e3fcf84ecedb50df35ebe629b44bafc15bc0 diff --git a/ITS/AliITSHuffman.h b/ITS/AliITSHuffman.h index d3649ef6b3b..054b91bcc69 100644 --- a/ITS/AliITSHuffman.h +++ b/ITS/AliITSHuffman.h @@ -5,26 +5,19 @@ // Huffman Table associated classes for set:ITS // /////////////////////////////////////////////////// -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -// Attention! Two classes in this file. -// They have to stay in the same file. -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #include -#include class AliITSInStream; +class TObjectArray; -class AliITSHNode: public TObject { - public: - - UChar_t fSymbol; // comment to be written - ULong_t fFrequency; // comment to be written - AliITSHNode *fLeft; // comment to be written - AliITSHNode *fRight; // comment to be written - AliITSHNode *fFather; // not used +//___________________________________________ +class AliITSHuffman: public TObject{ +public: +class AliITSHNode : public TObject { + public: AliITSHNode(); AliITSHNode(UChar_t symbol, ULong_t freq); @@ -38,38 +31,46 @@ class AliITSHNode: public TObject { // is sortable return kTRUE; } - Int_t Compare(TObject *obj); - - ClassDef(AliITSHNode,1) //HuffT node object for set:ITS - }; + Int_t Compare(const TObject *obj) const; + UChar_t GetSymbol() const {return fSymbol;} + ULong_t GetFrequency() const {return fFrequency;} + AliITSHNode *GetLeft() const {return fLeft;} + AliITSHNode *GetRight() const {return fRight;} + AliITSHNode *GetFather() const {return fFather;} + // void SetSymbol(UChar_r s){fSymbol=s;} + void SetFrequency(ULong_t fq){fFrequency=fq;} + void SetLeft(AliITSHNode *n){fLeft = n;} + void SetRight(AliITSHNode *n){fRight = n;} + void SetFather(AliITSHNode *n){fFather = n;} -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -// Attention! Next class has kept deliberaty in -// the same file as the previous one -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -//___________________________________________ -class AliITSHTable: public TObject{ - -public: - AliITSHTable(); - AliITSHTable(Int_t size); - virtual ~AliITSHTable(); - AliITSHTable(const AliITSHTable &source); // copy constructor - AliITSHTable& operator=(const AliITSHTable &source); // ass. op. + + private: + + UChar_t fSymbol; // comment to be written + ULong_t fFrequency; // comment to be written + AliITSHNode *fLeft; // comment to be written + AliITSHNode *fRight; // comment to be written + AliITSHNode *fFather; // not used +}; + AliITSHuffman(); + AliITSHuffman(Int_t size); + virtual ~AliITSHuffman(); + AliITSHuffman(const AliITSHuffman &source); // copy constructor + AliITSHuffman& operator=(const AliITSHuffman &source); // ass. op. - Int_t Size() { + Int_t Size() const { // size return fSize; } - UChar_t *CodeLen() { + UChar_t *CodeLen() const { // code len return fCodeLen; } - ULong_t *Code() { + ULong_t *Code() const { // code return fCode; } - TObjArray *HNodes() { + TObjArray *HNodes() const { // HNodes return fHNodes; } @@ -77,21 +78,21 @@ public: void GetFrequencies(Int_t len, UChar_t *stream); void BuildHTable(); - Bool_t SpanTree(AliITSHNode*start, ULong_t code, UChar_t len); + Bool_t SpanTree(AliITSHuffman::AliITSHNode*start, ULong_t code, UChar_t len); void ResetHNodes(); - void Clear(); - + void ClearTable(); + protected: Int_t fSize; // size of the arrays - UChar_t *fCodeLen; //[fSize] number of bits array - ULong_t *fCode; //[fSize] coded symbols array + UChar_t *fCodeLen; //![fSize] number of bits array + ULong_t *fCode; //![fSize] coded symbols array - Short_t *fSym; //[fSize] array of input symbols + Short_t *fSym; //![fSize] array of input symbols TObjArray *fHNodes; // array of nodes Int_t fNnodes; // number of nodes - ClassDef(AliITSHTable,1) //Huffman Table object for set:ITS + ClassDef(AliITSHuffman,1) //Huffman Table object for set:ITS }; #endif