CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
DaqData< Format > Class Template Reference

#include <DaqData.h>

Public Member Functions

char * Buffer () const
 
 DaqData (std::vector< unsigned int > &v)
 
 DaqData (const unsigned char *ptr, int sizeinbytes)
 
 DaqData (const DaqData &a)
 
unsigned int getValue (int indfield, int indobj=0) const
 
int Nobjects () const
 
int Size () const
 
 ~DaqData ()
 

Private Member Functions

void compressObject (const unsigned char *ptr, std::vector< unsigned int >::iterator &vit, int &bitsalreadyfilled)
 
void uncompressObject (const unsigned char *ptr, std::vector< unsigned int > &objdata, int &bitsalreadyfilled)
 

Private Attributes

unsigned char * buffer_
 
std::map< int, std::vector
< unsigned int > > 
data_
 
int nobjects_
 
int size_
 

Detailed Description

template<class Format>
class DaqData< Format >

This is the basic class accomplishing raw data formatting/unformatting.

1) Creation of a buffer of bytes representing the raw data

the user must create a DaqData object providing as input the data in the form of a vector of unsigned integers. The input data are all the values necessary to specify one (or more) object of the given format, which is the templated type. In case more than one object of the same given format should be put in the buffer, then the values of the second object must follow in the vector those of the first object and so on. DaqData will then compress these values in a bitstream according to the desired format. The bitstream is always aligned to the byte. The user, after successful compression, can request the pointer to the beginning of the buffer of bytes that represent the raw data (method Buffer() ) and the length of this buffer (method Size() ).

2) Interpretation of a buffer of bytes representing the raw data

the user must create a DaqData object providing as input a pointer to a buffer of bytes and the length in bytes of this buffer. DaqData will then extract the values (unsigned integers) present in the buffer according to a proper format, which is again the templated type. After successful uncompression of the buffer, the user can request the number of objects of the given format that were present in the buffer ( method Nobjects() ) and retrieve the individual values characterizing these objects ( method getValue() ).

WARNING: at the moment the interpretation of a buffer of bytes proceeds through the constructor of DaqData. This operation implies more than one copy of the data, which is not the most efficient way of accomplishing the task. In a future version of DaqData, more efficient methods will be made available.

Author
G. Bruno - CERN, EP Division

Definition at line 54 of file DaqData.h.

Constructor & Destructor Documentation

template<class Format >
DaqData< Format >::DaqData ( std::vector< unsigned int > &  v)
inline

Definition at line 58 of file DaqData.h.

References DaqData< Format >::buffer_, DaqData< Format >::compressObject(), gather_cfg::cout, DaqData< Format >::data_, i, mergeVDriftHistosByStation::name, DaqData< Format >::nobjects_, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::s, DaqData< Format >::size_, and AlCaHLTBitMon_QueryRunRegistry::string.

58  : size_(0), buffer_(0), nobjects_(0) {
59 
60  try {
61 
62  if (v.size() == 0) throw string("DaqData: empty input data vector provided: ");
63 
64  int Nfields = Format::getNumberOfFields();
65  if (v.size()%Nfields != 0) throw string("DaqData: ERROR. You must provide a number of input values compatibles with the requested format: ");
66 
67 
68  int ObjSize = Format::getFieldLastBit(Nfields-1)+1;
69  nobjects_ = v.size()/Nfields;
70  // cout<<"Going to create "<<nobjects_<< " objects of type "<<typeid(Format).name()<<endl;
71 
72 
73  size_ = (int) ceil(((double)(ObjSize*nobjects_))/8);
74  buffer_= new char[size_];
75  // cout<<"The buffer will be "<<size_ <<" bytes long"<<endl;
76 
77  std::vector<unsigned int>::iterator vit = v.begin();
78  char * p = buffer_;
79  int bitsalreadyfilled = 0;
80 
81  int Totbytes=1;
82 
83  for(int i=0; i<nobjects_; i++) {
84 
85  //additional bytes necessary to accomodate the current object
86  int Nbytes = (int) ceil((double)(Format::getFieldLastBit(Nfields-1)+1-8+bitsalreadyfilled)/8);
87 
88  if ((Totbytes+=Nbytes) > size_) throw string("Exceeded allocated buffer size");
89 
90  compressObject(p, vit, bitsalreadyfilled);
91 
92  // cout<<"Successfully compressed object "<< i <<endl;
93 
94  data_.insert(std::pair< int, std::vector<unsigned int> >(i,std::vector<unsigned int>(vit-Nfields,vit) ));
95 
96  //the second term is necessary in the case the last byte has been fully used
97  p+=(Nbytes+(8-bitsalreadyfilled)/8) ;
98  Totbytes+=(8-bitsalreadyfilled)/8 ;
99  }
100  if(bitsalreadyfilled==0) Totbytes--;
101 
102  /*
103  cout << "Compression successful. "<< Totbytes<<" bytes compressed in total"<< endl;
104  cout<< "Buffer pointer: "<<hex<< buffer_<< dec << "Size of buffer= "<< size_<<endl;
105  for(int i=0; i<nobjects_; i++) {
106  cout << "Object # "<< i << " fields: " <<endl;
107  for(int j=0; j<Format::getNumberOfFields(); j++) cout << getValue(j,i) <<endl;
108  }
109  */
110 
111  }
112 
113  catch (std::string s){
114 
115  cout<<"DaqData - Exception caught: " << s <<endl;
116  cout<<"Object compression failed! No data has been constructed for format: "<< string(typeid(Format).name())<<endl;
117 
118  }
119 
120  }
int i
Definition: DBlmapReader.cc:9
int nobjects_
Definition: DaqData.h:479
int size_
Definition: DaqData.h:477
std::map< int, std::vector< unsigned int > > data_
Definition: DaqData.h:475
tuple cout
Definition: gather_cfg.py:145
unsigned char * buffer_
Definition: DaqData.h:478
void compressObject(const unsigned char *ptr, std::vector< unsigned int >::iterator &vit, int &bitsalreadyfilled)
Definition: DaqData.h:373
template<class Format >
DaqData< Format >::DaqData ( const unsigned char *  ptr,
int  sizeinbytes 
)
inline

Definition at line 123 of file DaqData.h.

References gather_cfg::cout, DaqData< Format >::data_, i, mergeVDriftHistosByStation::name, DaqData< Format >::nobjects_, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and DaqData< Format >::uncompressObject().

124  : size_(0), buffer_(0), nobjects_(0) {
125 
126 
127  try {
128 
129  if (sizeinbytes==0) throw std::string("Buffer size is zero");
130 
131  int Nfields = Format::getNumberOfFields();
132  int ObjSize = Format::getFieldLastBit(Nfields-1)+1;
133  nobjects_ = (sizeinbytes*8)/ObjSize;
134 
135  // cout<<"Going to create "<<nobjects_<< " objects of type "<<typeid(Format).name()<<endl;
136  // cout<<"The buffer will be "<<size_ <<" bytes long"<<endl;
137 
138  if ((sizeinbytes*8)%ObjSize != 0) {
139  cout<<"DaqData: there will be " << (sizeinbytes*8)%ObjSize <<" meaningless bits at the end of the buffer"<<endl;
140  }
141 
142  // buffer_ = new char[sizeinbytes];
143  // memmove(buffer_,ptr,sizeinbytes);
144 
145  // char * p = buffer_;
146 
147  const unsigned char * p = ptr;
148  int bitsalreadyfilled = 0;
149 
150  int Totbytes=1;
151 
152  for(int i=0; i<nobjects_; i++) {
153 
154  std::vector<unsigned int> objdata;
155  objdata.reserve(Nfields);
156 
157  //additional bytes necessary to accomodate the current object
158  int Nbytes = (int) ceil((double)(Format::getFieldLastBit(Nfields-1)+1-8+bitsalreadyfilled)/8);
159 
160 
161  if ((Totbytes+=Nbytes) > sizeinbytes) throw std::string("Exceeded allocated buffer size");
162 
163 
164  uncompressObject(p, objdata, bitsalreadyfilled);
165 
166  // cout<<"Successfully uncompressed object "<< i <<endl;
167  data_.insert(std::pair< int, std::vector<unsigned int> >(i,objdata) );
168 
169  //the second term is necessary in the case the last byte has been fully used
170  p+= (Nbytes + (8-bitsalreadyfilled)/8);
171  Totbytes+= (8-bitsalreadyfilled)/8;
172 
173  }
174 
175  if(bitsalreadyfilled==0) Totbytes--;
176 
177  /*
178  cout << "Uncompression succeeded. "<< Totbytes<<" bytes uncompressed in total"<< endl;
179  cout<< "Buffer pointer: "<<hex<< buffer_<< dec<< "Size of buffer= "<< size_<<endl;
180 
181  for(int i=0; i<nobjects_; i++) {
182  cout << "Object # "<< i << " fields: " <<endl;
183  for(int j=0; j<Format::getNumberOfFields(); j++) cout << getValue(j,i) <<endl;
184  }
185  */
186 
187  }
188  catch (std::string s){
189 
190  std::cout<<"DaqData - Exception caught: " << s <<std::endl;
191  std::cout<<"Object uncompression failed! No data has been constructed for format: "<<std::string(typeid(Format).name())<<endl;
192 
193  }
194 
195  }
int i
Definition: DBlmapReader.cc:9
int nobjects_
Definition: DaqData.h:479
int size_
Definition: DaqData.h:477
void uncompressObject(const unsigned char *ptr, std::vector< unsigned int > &objdata, int &bitsalreadyfilled)
Definition: DaqData.h:251
std::map< int, std::vector< unsigned int > > data_
Definition: DaqData.h:475
tuple cout
Definition: gather_cfg.py:145
unsigned char * buffer_
Definition: DaqData.h:478
template<class Format >
DaqData< Format >::DaqData ( const DaqData< Format > &  a)
inline

Definition at line 198 of file DaqData.h.

References DaqData< Format >::Buffer(), DaqData< Format >::buffer_, DaqData< Format >::data_, DaqData< Format >::getValue(), i, j, DaqData< Format >::Nobjects(), DaqData< Format >::nobjects_, DaqData< Format >::Size(), and DaqData< Format >::size_.

198  {
199 
200  size_ = a.Size();
201  buffer_ = new char[size_];
202  memmove(buffer_,a.Buffer(),size_);
203  nobjects_ = a.Nobjects();
204 
205  for(int i=0; i<nobjects_; i++) {
206  std::vector<unsigned int> vec;
207  for(int j=0; j<Format::getNumberOfFields(); j++) vec.push_back(a.getValue(j,i));
208  data_.insert(std::pair< int, std::vector<unsigned int> >(i, vec));
209  }
210 
211  }
int Nobjects() const
Definition: DaqData.h:226
int i
Definition: DBlmapReader.cc:9
int Size() const
Definition: DaqData.h:224
int nobjects_
Definition: DaqData.h:479
int size_
Definition: DaqData.h:477
int j
Definition: DBlmapReader.cc:9
char * Buffer() const
Definition: DaqData.h:222
std::map< int, std::vector< unsigned int > > data_
Definition: DaqData.h:475
unsigned char * buffer_
Definition: DaqData.h:478
unsigned int getValue(int indfield, int indobj=0) const
Definition: DaqData.h:234
template<class Format >
DaqData< Format >::~DaqData ( )
inline

Definition at line 214 of file DaqData.h.

References DaqData< Format >::buffer_.

214  {
215 
216  // cout<<"Deleting DaqData of type "<<typeid(Format).name()<<endl;
217  if (buffer_!=0) delete [] buffer_;
218 
219  };
unsigned char * buffer_
Definition: DaqData.h:478

Member Function Documentation

template<class Format >
char* DaqData< Format >::Buffer ( ) const
inline

Definition at line 222 of file DaqData.h.

References DaqData< Format >::buffer_.

Referenced by DaqData< Format >::DaqData().

222 {return buffer_;}
unsigned char * buffer_
Definition: DaqData.h:478
template<class Format >
void DaqData< Format >::compressObject ( const unsigned char *  ptr,
std::vector< unsigned int >::iterator &  vit,
int &  bitsalreadyfilled 
)
inlineprivate

Definition at line 373 of file DaqData.h.

References funct::pow(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DaqData< Format >::DaqData().

373  {
374 
375  int Nfields = Format::getNumberOfFields();
376 
377  int bitstoaccomodate=Format::getFieldLastBit(0)+1; // of current field
378 
379  if (*vit > pow(2.,bitstoaccomodate)-1) throw string("The value is too large to fit in the field ");
380 
381  int ifield = 0;
382 
383  //Lower all bits but those already filled
384  *ptr &= 0xff + 1 - (unsigned int)pow(2.,8-bitsalreadyfilled);
385 
386  while (ifield < Nfields) {
387 
388 
389  if(bitstoaccomodate > 8 - bitsalreadyfilled ) {
390 
391  // cout<<"Field cannot be compressed from what left in current byte"<<endl;
392  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
393 
394  *ptr += (((*vit) >> (bitstoaccomodate - (8 - bitsalreadyfilled))) & 0xff);
395  // cout<< "value: "<< hex << *vit <<" - " << dec << *vit<< endl;
396  // cout<< "byte: "<< hex << (unsigned int)(*ptr) <<" - "<< dec << (unsigned int)(*ptr) << endl;
397 
398 
399  bitstoaccomodate -= (8-bitsalreadyfilled);
400  bitsalreadyfilled = 0;
401  ptr++;
402  *ptr &= 0xff + 1 - (unsigned int)pow(2.,8-bitsalreadyfilled);
403 
404  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
405 
406  }
407 
408  else if(bitstoaccomodate < (8 - bitsalreadyfilled) && bitstoaccomodate >0){
409 
410  // cout<<"Field can be compressed in the current byte, which will not be completely filled"<<endl;
411 
412  *ptr += ( (((*vit) << 8-bitstoaccomodate) & 0xff) >> (bitsalreadyfilled) );
413 
414  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
415  // cout<< "value: "<< hex << *vit <<" - " << dec << *vit<< endl;
416  // cout<< "byte: "<< hex << (unsigned int)(*ptr) <<" - "<< dec << (unsigned int)(*ptr) << endl;
417 
418  vit++;
419  bitsalreadyfilled+=bitstoaccomodate;
420 
421  // cout<<"Field completed"<<endl;
422 
423  if(ifield==Nfields-1) return;
424 
425  // cout<<"Compressing new Field"<<endl;
426 
427  ifield++;
428  bitstoaccomodate=Format::getFieldLastBit(ifield)-Format::getFieldLastBit(ifield-1);
429  if (*vit > pow(2.,bitstoaccomodate)-1) throw string("The value is too large to fit in the field ");
430 
431  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
432 
433  }
434 
435  else if(bitstoaccomodate == (8 - bitsalreadyfilled) && bitstoaccomodate >0){
436 
437  // cout<<"Field can be compressed in the current byte, which will be completely filled"<<endl;
438 
439 
440  *ptr += ( (((*vit) << 8-bitstoaccomodate) & 0xff) >> (bitsalreadyfilled) );
441 
442  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
443  // cout<< "value: "<< hex << *vit <<" - " << dec << *vit<< endl;
444  // cout<< "byte: "<< hex << (unsigned int)(*ptr) <<" - "<< dec << (unsigned int)(*ptr) << endl;
445 
446  vit++;
447  bitsalreadyfilled=0;
448 
449  // cout<<"Field completed"<<endl;
450 
451  if(ifield==Nfields-1) return;
452 
453  // cout<<"Compressing new Field"<<endl;
454 
455  ptr++;
456  *ptr &= 0xff + 1 - (unsigned int)pow(2.,8-bitsalreadyfilled);
457 
458  ifield++;
459  bitstoaccomodate=Format::getFieldLastBit(ifield)-Format::getFieldLastBit(ifield-1);
460 
461  if (*vit > pow(2.,bitstoaccomodate)-1) throw string("The value is too large to fit in the field ");
462 
463  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
464 
465  }
466  else throw string(" unexpected situation during compression");
467 
468  } //end of cycle over fields
469 
470  }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
template<class Format >
unsigned int DaqData< Format >::getValue ( int  indfield,
int  indobj = 0 
) const
inline

Definition at line 234 of file DaqData.h.

References gather_cfg::cout, DaqData< Format >::data_, and DaqData< Format >::nobjects_.

Referenced by DaqData< Format >::DaqData().

234  {
235 
236  if (indobj<nobjects_ && indfield < Format::getNumberOfFields()) {
237  std::map < int, std::vector<unsigned int> >::const_iterator it = data_.find(indobj);
238  if (it != data_.end()) return ((*it).second)[indfield];
239  else {
240  cout<<"DaqData - Strange: object should exist but was not found "<<endl;
241  return 0;
242  }
243  }
244  else cout<<"DaqData - Non existent field or object"<<endl;
245  return 0;
246 
247  }
int nobjects_
Definition: DaqData.h:479
std::map< int, std::vector< unsigned int > > data_
Definition: DaqData.h:475
tuple cout
Definition: gather_cfg.py:145
template<class Format >
int DaqData< Format >::Nobjects ( ) const
inline

Definition at line 226 of file DaqData.h.

References DaqData< Format >::nobjects_.

Referenced by DaqData< Format >::DaqData().

226  {
227  return nobjects_;
228  /* cout<<"Nobjects()"<<endl;
229  int Nfields = Format::getNumberOfFields();
230  return size_/(Format::getFieldLastBit(Nfields-1)+1);
231  */
232  }
int nobjects_
Definition: DaqData.h:479
template<class Format >
int DaqData< Format >::Size ( ) const
inline

Definition at line 224 of file DaqData.h.

References DaqData< Format >::size_.

Referenced by DaqData< Format >::DaqData().

224 {return size_;}
int size_
Definition: DaqData.h:477
template<class Format >
void DaqData< Format >::uncompressObject ( const unsigned char *  ptr,
std::vector< unsigned int > &  objdata,
int &  bitsalreadyfilled 
)
inlineprivate

Definition at line 251 of file DaqData.h.

References AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

Referenced by DaqData< Format >::DaqData().

253  {
254 
255  int Nfields = Format::getNumberOfFields();
256 
257  int bitstoaccomodate=Format::getFieldLastBit(0)+1; // of current field
258 
259  int ifield = 0;
260  unsigned int value = 0;
261 
262  while (ifield < Nfields) {
263 
264  if(bitstoaccomodate > 8 - bitsalreadyfilled ) {
265 
266  // cout<<"can't complete value from current byte"<<endl;
267  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
268 
269  //1)The syntax below could be faster.
270  // To be checked as soon as time available(check started with prog test4.C) .
271  //2)check if all cast to unsigned int are really necessary(done, they are not).
272  //3)Instead of using pow(2,1;2;3;4;5..), a faster enum could be used
273  //Lower all bits but those not yet read
274  //value += ( (*ptr & ((unsigned int)pow(2.,8-bitsalreadyfilled)-1)) << bitstoaccomodate + bitsalreadyfilled - 8 ) ;
275  // if(bitstoaccomodate > 8) value += ( ((((unsigned int)(*ptr)) << bitsalreadyfilled) & 0xff) << (bitstoaccomodate - 8) );
276  // else value += ( ((((unsigned int)(*ptr)) << bitsalreadyfilled) & 0xff) >> (8 - bitstoaccomodate) );
277 
278 
279  if(bitstoaccomodate > 8) value += ( ( (*ptr << bitsalreadyfilled) & 0xff ) << (bitstoaccomodate - 8) );
280  else value += ( ( (*ptr << bitsalreadyfilled) & 0xff) >> (8 - bitstoaccomodate) );
281 
282 
283  // cout<< "value: "<< hex << value << " - " << dec << value<< endl;
284  // cout<< "byte: "<< hex << (unsigned int)(*ptr) << " - " << dec << (unsigned int)(*ptr) << endl;
285 
286 
287  ptr++;
288  bitstoaccomodate -= (8-bitsalreadyfilled);
289  bitsalreadyfilled = 0;
290 
291  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
292 
293  }
294 
295  else if(bitstoaccomodate < (8 - bitsalreadyfilled) && bitstoaccomodate >0){
296  // cout<<"value can be completed from current byte, which still contain info"<<endl;
297 
298  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
299 
300  //1)The syntax below could be faster.
301  // To be checked as soon as time available.
302  //2)check if all cast to unsigned int are really necessary.
303  //3)Instead of using pow(2,1;2;3;4;5..), a faster enum could be used
304  //Lower all bits but those not yet read
305  //value += (*ptr & ((unsigned int)pow(2.,8-bitsalreadyfilled)-1)) >> (8 - bitstoaccomodate - bitsalreadyfilled);
306 
307  value += ( ( (*ptr << bitsalreadyfilled) & 0xff ) >> (8 - bitstoaccomodate) ) ;
308 
309  // cout<< "value: "<< hex << value << " - " << dec << value<< endl;
310  // cout<< "byte: "<< hex << (unsigned int)(*ptr) << " - " << dec << (unsigned int)(*ptr) << endl;
311 
312 
313  objdata.push_back(value);
314  value = 0;
315  bitsalreadyfilled+=bitstoaccomodate;
316 
317  // cout<<"Field completed"<<endl;
318 
319  if(ifield==Nfields-1) return;
320 
321  // cout<<"Uncompressing new Field"<<endl;
322 
323  ifield++;
324  bitstoaccomodate=Format::getFieldLastBit(ifield)-Format::getFieldLastBit(ifield-1);
325 
326  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
327 
328  }
329 
330  else if(bitstoaccomodate == (8 - bitsalreadyfilled) && bitstoaccomodate >0){
331  // cout<<"value can be completed from what left in current byte"<<endl;
332  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
333 
334  //1)The syntax below could be faster.
335  // To be checked as soon as time available.
336  //2)check if all cast to unsigned int are really necessary.
337  //3)Instead of using pow(2,1;2;3;4;5..), a faster enum could be used
338  //Lower all bits but those not yet read
339  // value += *ptr & ((unsigned int)pow(2.,8-bitsalreadyfilled)-1);
340 
341  value += ( ( (*ptr << bitsalreadyfilled) & 0xff ) >> (8 - bitstoaccomodate) ) ;
342 
343  // cout<< "value: "<< hex << value << " - " << dec << value<< endl;
344  // cout<< "byte: "<< hex << (unsigned int)(*ptr) << " - " << dec << (unsigned int)(*ptr) << endl;
345 
346 
347  objdata.push_back(value);
348  value = 0;
349  bitsalreadyfilled=0;
350 
351  // cout<<"Field completed"<<endl;
352 
353  if(ifield==Nfields-1) return;
354 
355  // cout<<"Uncompressing new Field"<<endl;
356 
357  ptr++;
358  ifield++;
359  bitstoaccomodate=Format::getFieldLastBit(ifield)-Format::getFieldLastBit(ifield-1);
360 
361  // cout <<"bitstoaccomodate= "<<bitstoaccomodate<<" bitsalreadyfilled= "<<bitsalreadyfilled<<" ifield="<< ifield<<" Nfields="<<Nfields<<endl;
362 
363  }
364  else throw std::string(" unexpected situation during uncompression");
365 
366  } //end of cycle over fields
367 
368  }

Member Data Documentation

template<class Format >
unsigned char* DaqData< Format >::buffer_
private
template<class Format >
std::map< int, std::vector<unsigned int> > DaqData< Format >::data_
private

Definition at line 475 of file DaqData.h.

Referenced by DaqData< Format >::DaqData(), and DaqData< Format >::getValue().

template<class Format >
int DaqData< Format >::nobjects_
private
template<class Format >
int DaqData< Format >::size_
private

Definition at line 477 of file DaqData.h.

Referenced by DaqData< Format >::DaqData(), and DaqData< Format >::Size().