added Huffman compression stuff for ALTRO data (Jenny)
[u/mrichter/AliRoot.git] / HLT / comp / AliHLTCOMPHuffmanData.cxx
1 //-*- Mode: C++ -*-
2 /**************************************************************************
3  * This file is property of and copyright by the ALICE HLT Project        * 
4  * All rights reserved.                                                   *
5  *                                                                        *
6  * Primary Author: Jenny Wagner  (jwagner@cern.ch)                        *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          * 
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 /** @file   ALIHLTCOMPHuffmanData.cxx
18     @author Jenny Wagner
19     @date   29-08-2007
20 */
21
22 #include "AliHLTCOMPHuffmanData.h"
23 #include "AliHLTStdIncludes.h"
24
25 #if __GNUC__ >= 3
26 using namespace std;
27 #endif
28
29 ClassImp(AliHLTCOMPHuffmanData)
30
31 /** construction without any arguments (used for isolated tests) */
32 AliHLTCOMPHuffmanData::AliHLTCOMPHuffmanData()
33 {
34   // see header file for class documentation
35   // or
36   // refer to README to build package
37   // or
38   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
39 }
40
41 /** HuffmanData destructor  */
42 AliHLTCOMPHuffmanData::~AliHLTCOMPHuffmanData()
43 {
44   /* destructor, see header file for class documentation */
45 }
46
47 /** get data from OCDB and write them into instance of HuffmanData */
48 void AliHLTCOMPHuffmanData::InitHuffmanData(AliHLTCOMPHuffmanOccurrenceData::AliHLTCOMPHuffmanData_t* occurrencetable, AliHLTCOMPHuffmanCodeData::AliHLTCOMPHuffmanCode_t* codetable)
49 {
50   // see header file for class documentation
51   for(Int_t ii = 0; ii < TIMEBINS; ii++)
52     {
53       fOccurrenceTable[ii].SetHuffmanOccurrenceData(occurrencetable[ii]);
54       
55       fCodeTable[ii].SetHuffmanCodeData(codetable[ii]);
56     }
57 }
58
59 AliHLTCOMPHuffmanOccurrenceData::AliHLTCOMPHuffmanData_t* AliHLTCOMPHuffmanData::GetOccurrenceTable(AliHLTCOMPHuffmanOccurrenceData::AliHLTCOMPHuffmanData_t* occurrencetable) 
60 {
61   // see header file for class documentation
62   for (Int_t ii = 0; ii < TIMEBINS; ii++)
63     {
64       fOccurrenceTable[ii].GetHuffmanOccurrenceData(&(occurrencetable[ii]));
65     }
66
67   return occurrencetable;
68   
69 }
70
71 AliHLTCOMPHuffmanCodeData::AliHLTCOMPHuffmanCode_t* AliHLTCOMPHuffmanData::GetCodeTable(AliHLTCOMPHuffmanCodeData::AliHLTCOMPHuffmanCode_t* codetable)
72 {
73   // see header file for class documentation
74   for (Int_t ii = 0; ii < TIMEBINS; ii++)
75     {
76       fCodeTable[ii].GetHuffmanCodeData(&(codetable[ii]));
77     }
78
79   return codetable;
80 }