]>
Commit | Line | Data |
---|---|---|
6a1b3945 | 1 | //-*- Mode: C++ -*- |
2 | // $Id$ | |
3 | #ifndef ALIHLTDATADEFLATERHUFFMAN_H | |
4 | #define ALIHLTDATADEFLATERHUFFMAN_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 AliHLTDataDeflaterHuffman.h | |
10 | /// @author Thorsten Kollegger, Matthias Richter | |
11 | /// @date 2011-08-10 | |
12 | /// @brief Data deflater class using huffman coding | |
13 | ||
14 | #include "AliHLTDataDeflater.h" | |
15 | #include "AliHLTHuffman.h" | |
16 | #include <vector> | |
17 | #include <string> | |
18 | #include <sstream> | |
19 | ||
20 | /** | |
21 | * @class AliHLTDataDeflaterHuffman | |
22 | * Deflater implementation using standard huffman code. | |
23 | * | |
24 | * @ingroup alihlt_base | |
25 | */ | |
26 | class AliHLTDataDeflaterHuffman : public AliHLTDataDeflater | |
27 | { | |
28 | public: | |
29 | /// standard constructor | |
30 | AliHLTDataDeflaterHuffman(bool bTrainingMode=false); | |
31 | /// destructor | |
32 | ~AliHLTDataDeflaterHuffman(); | |
33 | ||
34 | /// add a parameter definition to the configuration, return reference id | |
a3c3f7e9 | 35 | int AddParameterDefinition(const char* name, unsigned bitLength, unsigned refLength=0); |
6a1b3945 | 36 | |
37 | /// init list of decoders | |
38 | int InitDecoders(TList* decoderlist); | |
39 | ||
40 | /// inherited from AliHLTDataDeflater: write bit pattern according to configuration | |
41 | virtual bool OutputParameterBits( int parameterId, AliHLTUInt64_t const & value ); | |
42 | ||
43 | /// add a parameter definition for huffman training | |
44 | int AddTrainingParameter(const char* name, unsigned bitLength); | |
45 | ||
46 | /// add a training value for the specified parameter | |
47 | bool AddTrainingValue( int memberId, AliHLTUInt64_t const & value ); | |
48 | ||
49 | /// generate huffman trees for all parameters and return list | |
50 | const TList* GenerateHuffmanTree(); | |
51 | ||
52 | const TList* GetList() const {return fHuffmanCoderList;} | |
53 | ||
54 | /// clear the object and reset pointer references | |
55 | virtual void Clear(Option_t * /*option*/ =""); | |
56 | ||
57 | /// print info | |
58 | virtual void Print(Option_t *option="") const; | |
59 | ||
60 | /// print info | |
61 | virtual void Print(ostream& out, Option_t *option="") const; | |
62 | ||
63 | /// find object: 'DeflaterConfiguration' | |
64 | virtual TObject *FindObject(const char *name) const; | |
65 | ||
66 | /// save data according to option | |
67 | virtual void SaveAs(const char *filename="",Option_t *option="") const; | |
68 | ||
69 | /// DataDeflaterHuffman version (ID) is 2 | |
70 | virtual int GetDeflaterVersion() const {return 2;} | |
71 | ||
72 | /// check if in training mode | |
73 | bool IsTrainingMode() const {return fTrainingMode;} | |
74 | ||
75 | protected: | |
76 | private: | |
77 | /// copy constructor prohibited | |
78 | AliHLTDataDeflaterHuffman(const AliHLTDataDeflaterHuffman&); | |
79 | /// assigment operator prohibited | |
80 | AliHLTDataDeflaterHuffman& operator=(const AliHLTDataDeflaterHuffman&); | |
81 | ||
a3c3f7e9 | 82 | /// parameter length reference for calculation of ratio |
83 | vector<unsigned> fReferenceLength; | |
6a1b3945 | 84 | /// index of the decoders in the decoder list |
85 | vector<AliHLTHuffman*> fHuffmanCoders; //! index of decoders | |
86 | ||
87 | /// list of huffman coders identified by parameter name | |
88 | TList* fHuffmanCoderList; //! list of huffman coders | |
89 | ||
90 | bool fTrainingMode; //! indicate training mode | |
91 | ||
92 | ClassDef(AliHLTDataDeflaterHuffman, 0) | |
93 | }; | |
94 | ||
95 | ostream& operator<<(ostream &out, const AliHLTDataDeflaterHuffman& me); | |
96 | ||
97 | #endif |