]>
Commit | Line | Data |
---|---|---|
9409b4b1 | 1 | // $Id$ |
2 | ||
3 | //************************************************************************** | |
4 | //* This file is property of and copyright by the ALICE HLT Project * | |
5 | //* ALICE Experiment at CERN, All rights reserved. * | |
6 | //* * | |
7 | //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
8 | //* for The ALICE HLT Project. * | |
9 | //* * | |
10 | //* Permission to use, copy, modify and distribute this software and its * | |
11 | //* documentation strictly for non-commercial purposes is hereby granted * | |
12 | //* without fee, provided that the above copyright notice appears in all * | |
13 | //* copies and that both the copyright notice and this permission notice * | |
14 | //* appear in the supporting documentation. The authors make no claims * | |
15 | //* about the suitability of this software for any purpose. It is * | |
16 | //* provided "as is" without express or implied warranty. * | |
17 | //************************************************************************** | |
18 | ||
19 | /// @file AliHLTDataInflaterSimple.cxx | |
20 | /// @author Matthias Richter | |
21 | /// @date 2011-09-01 | |
22 | /// @brief Data inflater implementation for format of AliHLTDataDeflaterSimple | |
23 | /// @note | |
24 | ||
25 | #include "AliHLTDataInflaterSimple.h" | |
26 | ||
27 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
28 | ClassImp(AliHLTDataInflaterSimple) | |
29 | ||
30 | AliHLTDataInflaterSimple::AliHLTDataInflaterSimple() | |
31 | : AliHLTDataInflater() | |
32 | , fParameterDefinitions() | |
33 | , fCurrentParameter(-1) | |
34 | { | |
35 | // see header file for class documentation | |
36 | // or | |
37 | // refer to README to build package | |
38 | // or | |
39 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
40 | } | |
41 | ||
42 | AliHLTDataInflaterSimple::~AliHLTDataInflaterSimple() | |
43 | { | |
44 | // destructor | |
45 | } | |
46 | ||
47 | int AliHLTDataInflaterSimple::AddParameterDefinition(const char* name, int bitLength, int reducedBitLength) | |
48 | { | |
49 | /// add a parameter definition to the configuration, return reference id | |
50 | fParameterDefinitions.push_back(AliHLTDataDeflaterSimple::AliHLTDataDeflaterParameter(name, bitLength, reducedBitLength)); | |
51 | return fParameterDefinitions.size()-1; | |
52 | } | |
53 | ||
54 | bool AliHLTDataInflaterSimple::NextValue(AliHLTUInt64_t& value, AliHLTUInt32_t& length) | |
55 | { | |
56 | /// overloaded from AliHLTDataInflater | |
57 | /// functions reads the sequence of parameters as defined by the decoder | |
58 | /// list, than it starts at the first parameter again | |
59 | value=0; | |
60 | length=0; | |
61 | if (fParameterDefinitions.size()==0) return false; | |
62 | if ((++fCurrentParameter)>=(int)fParameterDefinitions.size()) fCurrentParameter=0; | |
63 | const AliHLTDataDeflaterSimple::AliHLTDataDeflaterParameter& parameter | |
64 | =fParameterDefinitions[fCurrentParameter]; | |
65 | ||
66 | AliHLTUInt8_t switchBit=0; | |
67 | if (!InputBit(switchBit)) | |
68 | return false; | |
69 | int readlength=switchBit?parameter.GetBitLength():parameter.GetReducedBitLength(); | |
70 | if (!InputBits(value, readlength)) | |
71 | return false; | |
72 | length=parameter.GetBitLength(); | |
73 | ||
74 | return true; | |
75 | } |