Line data Source code
1 : //**************************************************************************
2 : //* This file is property of and copyright by the ALICE HLT Project *
3 : //* ALICE Experiment at CERN, All rights reserved. *
4 : //* *
5 : //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
6 : //* for The ALICE HLT Project. *
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 AliHLTDataInflaterSimple.cxx
18 : /// @author Matthias Richter
19 : /// @date 2011-09-01
20 : /// @brief Data inflater implementation for format of AliHLTDataDeflaterSimple
21 : /// @note
22 :
23 : #include "AliHLTDataInflaterSimple.h"
24 :
25 : /** ROOT macro for the implementation of ROOT specific class methods */
26 126 : ClassImp(AliHLTDataInflaterSimple)
27 :
28 : AliHLTDataInflaterSimple::AliHLTDataInflaterSimple()
29 0 : : AliHLTDataInflater()
30 0 : , fParameterDefinitions()
31 0 : , fCurrentParameter(-1)
32 0 : , fLegacyMode(-1)
33 0 : {
34 : // constructur, see header file for class documentation
35 0 : }
36 :
37 : AliHLTDataInflaterSimple::~AliHLTDataInflaterSimple()
38 0 : {
39 : // destructor
40 0 : }
41 :
42 : int AliHLTDataInflaterSimple::AddParameterDefinition(const char* name, int bitLength, int reducedBitLength)
43 : {
44 : /// add a parameter definition to the configuration, return reference id
45 0 : fParameterDefinitions.push_back(AliHLTDataDeflaterSimple::AliHLTDataDeflaterParameter(name, bitLength, reducedBitLength));
46 0 : return fParameterDefinitions.size()-1;
47 0 : }
48 :
49 : bool AliHLTDataInflaterSimple::NextValue(AliHLTUInt64_t& value, AliHLTUInt32_t& length)
50 : {
51 : /// overloaded from AliHLTDataInflater
52 : /// functions reads the sequence of parameters as defined by the decoder
53 : /// list, than it starts at the first parameter again
54 0 : value=0;
55 0 : length=0;
56 0 : if (fLegacyMode!=0) {
57 0 : if ((++fCurrentParameter)>=(int)fParameterDefinitions.size()) fCurrentParameter=0;
58 0 : fLegacyMode=1;
59 0 : }
60 0 : if (fParameterDefinitions.size()==0 || fCurrentParameter<0) return false;
61 : const AliHLTDataDeflaterSimple::AliHLTDataDeflaterParameter& parameter
62 0 : =fParameterDefinitions[fCurrentParameter];
63 :
64 0 : AliHLTUInt8_t switchBit=0;
65 0 : if (!InputBit(switchBit))
66 0 : return false;
67 0 : int readlength=switchBit?parameter.GetBitLength():parameter.GetReducedBitLength();
68 0 : if (!GetBits(value, readlength))
69 0 : return false;
70 0 : length=parameter.GetBitLength();
71 :
72 0 : return true;
73 0 : }
|