]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/comp/AliHLTTPCCompModelDeflater.h
coding conventions and compilation warnings and work on adaptive TPC data compression...
[u/mrichter/AliRoot.git] / HLT / TPCLib / comp / AliHLTTPCCompModelDeflater.h
1 // XEmacs -*-C++-*-
2 // $Id$
3
4 #ifndef ALIHLTTPCCOMPMODELDEFLATER_H
5 #define ALIHLTTPCCOMPMODELDEFLATER_H
6 //* This file is property of and copyright by the ALICE HLT Project        * 
7 //* ALICE Experiment at CERN, All rights reserved.                         *
8 //* See cxx source for full Copyright notice                               *
9
10 /** @file   AliHLTTPCCompModelDeflater.h
11     @author Timm Steinbeck
12     @date   
13     @brief  Declaration of a compressor class for TPC track data. */
14
15 #include "AliHLTTPCTrackArray.h"
16 #include "AliHLTTPCTrackletDataFormat.h"
17 #include "AliHLTTPCClusterDataFormat.h"
18 #include "AliHLTLogging.h"
19 #include "AliHLTTPCModels.h"
20
21 /**
22  * @class AliHLTTPCCompModelDeflater
23  * @brief A HLT TPC track compressor. 
24  *
25  * A class that can compress HLT TPC track model data
26  */
27 class AliHLTTPCCompModelDeflater: public AliHLTLogging
28     {
29     public:
30       /** standard constructor */
31       AliHLTTPCCompModelDeflater();
32       /** standard destructor */
33       virtual ~AliHLTTPCCompModelDeflater();
34
35       /** function to write shape */
36       void WriteShape( bool write=true )
37       {
38         fWriteShape = write;
39       }
40
41       /** function to compress tracks
42        * @param inData     AliHLTUInt8_t* pointer to input data
43        * @param inputSize  UInt_t const& input size
44        * @param output     AliHLTUInt8_t* pointer to output data
45        * @param outputSize UInt_t& output size
46        * @return zero upon success
47       */
48         int CompressTracks( AliHLTUInt8_t* inData, UInt_t const& inputSize, AliHLTUInt8_t* output, UInt_t& outputSize );
49
50       /** function to compress remaining clusters
51        * @param inData     AliHLTUInt8_t* pointer to input data
52        * @param inputSize  UInt_t const& input size
53        * @param output     AliHLTUInt8_t* pointer to output data
54        * @param outputSize UInt_t& output size
55        * @return zero upon success
56        */
57         int CompressRemainingClusters( AliHLTUInt8_t* inData, UInt_t const& inputSize, AliHLTUInt8_t* output, UInt_t& outputSize );
58
59     protected:
60
61       /** member variable to write shape */
62       bool fWriteShape; // member variable to write shape 
63       
64       /** function to initialise bit data output
65        * @param output AliHLTUInt8_t* pointer to output data
66        * @param outputSize UInt_t output size
67        */
68       void InitBitDataOutput( AliHLTUInt8_t* output, UInt_t outputSize );
69       
70       /** function to close bit data output */
71       void CloseBitDataOutput()
72       {
73         Pad8Bits();
74       }
75       
76       /** function to get current byte output position
77        * @return unsigned long value for current byte output position
78        */
79       unsigned long GetCurrentByteOutputPosition() const
80       {
81         return (unsigned long)( fBitDataCurrentOutput - fBitDataCurrentOutputStart );
82       }
83
84       /** function to get current bit output position
85        * @return unsigned long value for current bit output position
86        */
87       unsigned GetCurrentBitOutputPosition() const
88       {
89         return fBitDataCurrentPosInWord;
90       }
91
92       /** function to get current output byte
93        * @param offset Int_t (set to zero if not specified explicitly)
94        * @return AliHLTUInt8_t value for current output byte
95        */
96       AliHLTUInt8_t GetCurrentOutputByte( Int_t offset=0 ) const;
97       
98       /** function to get bit data output size bytes
99        * @return UInt_t value of bit data output size bytes
100        */
101       UInt_t GetBitDataOutputSizeBytes() const
102       {
103         return fBitDataCurrentOutput-fBitDataCurrentOutputStart;
104       }
105       
106       /** function for output bit
107        * @param value  AliHLTUInt32_t const & input
108        * @return boolean (output bit)
109        */
110       bool OutputBit( AliHLTUInt32_t const & value );
111
112       /** function to output bits 
113        * @param value     AliHLTUInt64_t const &
114        * @param bitCount  UInt_t const &
115        * @return zero upon success
116        */
117       bool OutputBits( AliHLTUInt64_t const & value, UInt_t const & bitCount );
118
119       /** function pad 8 bits */
120       void Pad8Bits();
121
122       /** function to output bytes
123        * @param data  AliHLTUInt8_t const *
124        * @param byteCount UInt_t const &
125        * @return boolean (output bytes)
126        */
127       bool OutputBytes( AliHLTUInt8_t const * data, UInt_t const & byteCount );      
128     private:
129       /** copy constructor prohibited */
130       AliHLTTPCCompModelDeflater(const AliHLTTPCCompModelDeflater&);
131       /** assignment operator prohibited */
132       AliHLTTPCCompModelDeflater& operator=(const AliHLTTPCCompModelDeflater&);
133       
134       /** member variable for bit data current word */
135       AliHLTUInt8_t fBitDataCurrentWord; // member variable for bit data current word
136       /** member variable for bit data current position in word */
137       UInt_t fBitDataCurrentPosInWord; // member variable for bit data current position in word
138       /** member variable for bit data current output */
139       AliHLTUInt8_t *fBitDataCurrentOutput; // member variable for bit data current output
140       /** member variable for bit data current output start */
141       AliHLTUInt8_t *fBitDataCurrentOutputStart; // member variable for bit data current output start
142       /** member variable for bit data current output end */
143       AliHLTUInt8_t *fBitDataCurrentOutputEnd; // member variable for bit data current output end 
144       
145       ClassDef(AliHLTTPCCompModelDeflater, 0);      
146
147     };
148 #endif