]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTDataInflaterSimple.cxx
minor coverity defects: assignment operators corrected
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataInflaterSimple.cxx
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   , fLegacyMode(-1)
35 {
36   // see header file for class documentation
37   // or
38   // refer to README to build package
39   // or
40   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
41 }
42
43 AliHLTDataInflaterSimple::~AliHLTDataInflaterSimple()
44 {
45   // destructor
46 }
47
48 int AliHLTDataInflaterSimple::AddParameterDefinition(const char* name, int bitLength, int reducedBitLength)
49 {
50   /// add a parameter definition to the configuration, return reference id
51   fParameterDefinitions.push_back(AliHLTDataDeflaterSimple::AliHLTDataDeflaterParameter(name, bitLength, reducedBitLength));
52   return fParameterDefinitions.size()-1;
53 }
54
55 bool AliHLTDataInflaterSimple::NextValue(AliHLTUInt64_t& value, AliHLTUInt32_t& length)
56 {
57   /// overloaded from AliHLTDataInflater
58   /// functions reads the sequence of parameters as defined by the decoder
59   /// list, than it starts at the first parameter again
60   value=0;
61   length=0;
62   if (fLegacyMode!=0) {
63   if ((++fCurrentParameter)>=(int)fParameterDefinitions.size()) fCurrentParameter=0;
64   fLegacyMode=1;
65   }
66   if (fParameterDefinitions.size()==0 || fCurrentParameter<0) return false;
67   const AliHLTDataDeflaterSimple::AliHLTDataDeflaterParameter& parameter
68     =fParameterDefinitions[fCurrentParameter];
69
70   AliHLTUInt8_t switchBit=0;
71   if (!InputBit(switchBit))
72     return false;
73   int readlength=switchBit?parameter.GetBitLength():parameter.GetReducedBitLength();
74   if (!InputBits(value, readlength))
75     return false;
76   length=parameter.GetBitLength();
77
78   return true;
79 }