]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTDataInflaterHuffman.h
HLTcalo module
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataInflaterHuffman.h
1 //-*- Mode: C++ -*-
2 // $Id$
3 #ifndef ALIHLTDATAINFLATERHUFFMAN_H
4 #define ALIHLTDATAINFLATERHUFFMAN_H
5 //* This file is property of and copyright by the ALICE HLT Project        * 
6 //* ALICE Experiment at CERN, All rights reserved.                         *
7 //* See cxx source for full Copyright notice                               *
8
9 /// @file   AliHLTDataInflaterHuffman.h
10 /// @author Matthias Richter
11 /// @date   2011-09-01
12 /// @brief  Data inflater implementation for huffman encoded data
13 /// @note   
14
15 #include "AliHLTDataInflater.h"
16
17 class AliHLTHuffman;
18 class TList;
19
20 class AliHLTDataInflaterHuffman : public AliHLTDataInflater
21 {
22 public:
23   /// standard constructor
24   AliHLTDataInflaterHuffman();
25   /// destructor
26   ~AliHLTDataInflaterHuffman();
27
28   /// add a parameter definition to the configuration, return reference id
29   int AddParameterDefinition(const char* name, unsigned bitLength);
30
31   /// init list of decoders
32   int InitDecoders(TList* decoderlist);
33
34   /// overloaded from AliHLTDataInflater
35   virtual bool NextValue(AliHLTUInt64_t& value, AliHLTUInt32_t& length);
36   /// switch to next parameter
37   virtual int NextParameter() {
38     if (fHuffmanCoders.size()==0) return -1;
39     if (fLegacyMode>0) return fCurrentParameter;
40     fLegacyMode=0;
41     if ((++fCurrentParameter)>=(int)fHuffmanCoders.size()) fCurrentParameter=0;
42     return fCurrentParameter;
43   }
44
45   /// Print info
46   void Print(Option_t* option = "") const;
47   /// clear the object and reset pointer references
48   virtual void Clear(Option_t * option ="");
49
50 protected:
51 private:
52   /** copy constructor prohibited */
53   AliHLTDataInflaterHuffman(const AliHLTDataInflaterHuffman&);
54   /** assignment operator prohibited */
55   AliHLTDataInflaterHuffman& operator=(const AliHLTDataInflaterHuffman&);
56
57   /// index of the decoders in the decoder list
58   vector<AliHLTHuffman*> fHuffmanCoders; //! index of decoders
59
60   /// list of huffman coders identified by parameter name
61   TList* fHuffmanCoderList; //! list of huffman coders
62
63   /// current parameter during reading
64   int fCurrentParameter; //!
65   /// legacy mode to handle code not using NextParameter()
66   int fLegacyMode;
67   /// buffered input
68   AliHLTUInt64_t fInput; //!
69   /// valid MSBs in the buffered input
70   AliHLTUInt32_t fInputLength; //!
71
72   ClassDef(AliHLTDataInflaterHuffman, 0)
73 };
74
75 #endif //ALIHLTDATAINFLATERHUFFMAN_H