Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/DAQDataFormats/cxx/include/RawSummaryDCMDataV0.h"

Inheritance diagram for daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData:

Public Member Functions

 RawSummaryDCMData (const version_t)
 
 RawSummaryDCMData (const RawSummaryDCMData &)
 The default constructor. More...
 
 ~RawSummaryDCMData ()
 Destructor. More...
 
void init ()
 
void print (std::ostream &os=std::cout) const
 
uint32_t sizeofdata () const
 
bool setBufferSource (const void *pointer)
 
daqdataformats::RawSummaryDCMDataHeadergetHeader () const
 
daqdataformats::RawSummaryDCMDataPointgetDataPoint (const uint32_t idx) const
 MicroBlock Header reference. More...
 
bool addDataPoints (const std::list< std::pair< uint64_t, uint16_t > > &dcmlist, const uint8_t type)
 

Protected Member Functions

uint32_t getPredefinedSize () const
 
 INIT_FIRST (getVersion, const, uint32_t,)
 
 INIT_CUSTOM_DELEGATE (addDataPoints, bool, const std::list< std::pair< uint64_t, uint16_t > > &, const uint8_t)
 

Protected Attributes

daqdataformats::RawSummaryDCMDataHeader_Header
 

Detailed Description

Definition at line 24 of file RawSummaryDCMDataV0.h.

Constructor & Destructor Documentation

daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::RawSummaryDCMData ( const version_t  version)

Definition at line 28 of file RawSummaryDCMDataV0.cpp.

28  :
30  ,_Header (NULL)
31 { }
#define sizeofdata_t
Definition: FunctionBind.h:30
daqdataformats::RawSummaryDCMDataHeader * _Header
const XML_Char * version
Definition: expat.h:187
daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::RawSummaryDCMData ( const RawSummaryDCMData copyin)

The default constructor.

Definition at line 34 of file RawSummaryDCMDataV0.cpp.

34  :
35  RawDAQData(copyin)
36  ,_Header (NULL)
37 { }
daqdataformats::RawSummaryDCMDataHeader * _Header
daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::~RawSummaryDCMData ( )

Destructor.

Definition at line 41 of file RawSummaryDCMDataV0.cpp.

References _Header.

41  {
42  if(_Header) delete _Header;
43 }
daqdataformats::RawSummaryDCMDataHeader * _Header

Member Function Documentation

bool daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::addDataPoints ( const std::list< std::pair< uint64_t, uint16_t > > &  dcmlist,
const uint8_t  type 
)

If buffer is internal, we need to adjust its size

Dcmdata size is the size of the header and the microslice

Add the dcmdata size

Check pointers after each read or resize buffer

Definition at line 45 of file RawSummaryDCMDataV0.cpp.

References _Header, EXECUTE_FUNCTION, parse_dependency_file_t::list, PRINT_ON_DEBUG, daqdataformats::CURRENT_FIELDS_SUB_NAMESPACE::RAWSUMMARYDCMDATAPOINT_LATEST_VERSION, daqdataformats::VERSION_NAMESPACE::CURRENT_FIELDS_SUB_NAMESPACE::RAWSUMMARYDCMDATAPOINT_SIZE, and sizeofdata().

Referenced by getHeader().

46  {
47  const uint32_t new_sizeofdata = EXECUTE_FUNCTION(sizeofdata)() + list.size() * summarydcmdatapoint::RAWSUMMARYDCMDATAPOINT_SIZE;
48  PRINT_ON_DEBUG(__PRETTY_FUNCTION__ << ": list.size()=" << list.size() << ", new_sizeofdata=" << new_sizeofdata << " 000000000000");
49  /// If buffer is internal, we need to adjust its size
50  if(_shouldBufferBeInternal) {
51  /// Dcmdata size is the size of the header and the microslice
52 
53  /// Add the dcmdata size
54  resizeInternalBuffer(new_sizeofdata);
55 
56  /// Check pointers after each read or resize buffer
57  checkBufferInternalness();
58  }// end of adjusting the internal buffer size
59 
60  PRINT_ON_DEBUG(__PRETTY_FUNCTION__ << ": list.size()=" << list.size() << ", new_sizeofdata=" << new_sizeofdata << " 1111111111111");
61  std::list<std::pair<uint64_t, uint16_t> >::const_iterator ii = list.begin(), ee=list.end();
62  for(; ii != ee; ++ii) {
63  //std::cout << "RawSummaryDCMDataV0::addDataPoints: first:0x" << std::hex << (unsigned long long)(*ii).first <<", second:" << (unsigned)(*ii).second << ", type: " << (unsigned)type << std::endl;
65  newPoint.setTimeStamp((*ii).first);
66  newPoint.setDCMID((*ii).second);
67  newPoint.setDataType(type);
68  readDataGeneral(newPoint.getBuffer(), newPoint.sizeofdata(), EXECUTE_FUNCTION(sizeofdata)());
69  checkBufferInternalness();
70  _Header->advanceNumEntries();
71  PRINT_ON_DEBUG(__PRETTY_FUNCTION__ << ": list.size()=" << list.size() << ", new_sizeofdata=" << new_sizeofdata << " 2222222222222");
72  }
73  return true;
74 
75  }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
daqdataformats::RawSummaryDCMDataHeader * _Header
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
daqdataformats::RawSummaryDCMDataPoint * daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::getDataPoint ( const uint32_t  idx) const

MicroBlock Header reference.

Definition at line 159 of file RawSummaryDCMDataV0.cpp.

References _Header, compare_h5_caf::idx, and RAWBUFF32.

Referenced by getHeader().

160  {
161  if(_Header->getNumEntries() - 1 < idx) return NULL;
162  void* pointer = (void*)&RAWBUFF32[_Header->sizeofdata() + 3*idx];
163  return new daqdataformats::RawSummaryDCMDataPoint(pointer, 0);
164  }
daqdataformats::RawSummaryDCMDataHeader * _Header
#define RAWBUFF32
Definition: RawDAQData.h:16
daqdataformats::RawSummaryDCMDataHeader* daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::getHeader ( ) const
inline

Definition at line 39 of file RawSummaryDCMDataV0.h.

References _Header, addDataPoints(), febshutoff_auto::dcmlist, getDataPoint(), compare_h5_caf::idx, and parse_dependency_file_t::list.

39 {return _Header;} //! MicroBlock Header reference
daqdataformats::RawSummaryDCMDataHeader * _Header
uint32_t daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::getPredefinedSize ( ) const
inlineprotected
void daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::init ( )

This is needed for the formats with variable size If buffer is internal, need to resize it

Check pointers after each read or resize buffer

Definition at line 116 of file RawSummaryDCMDataV0.cpp.

References _Header.

Referenced by demo.App::__init__(), testem0.App::__init__(), Lesson1.App::__init__(), and ExN03.App::__init__().

116  {
117 
118  /// This is needed for the formats with variable size
119  /// If buffer is internal, need to resize it
120  if(_shouldBufferBeInternal){
121  resizeInternalBuffer(_Header->sizeofdata());
122  /// Check pointers after each read or resize buffer
123  checkBufferInternalness();
124  }
125 
126  _Header->init();
127  }
daqdataformats::RawSummaryDCMDataHeader * _Header
daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::INIT_CUSTOM_DELEGATE ( addDataPoints  ,
bool  ,
const std::list< std::pair< uint64_t, uint16_t > > &  ,
const uint8_t   
)
protected

Referenced by getPredefinedSize().

daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::INIT_FIRST ( getVersion  ,
const  ,
uint32_t   
)
protected

Referenced by getPredefinedSize().

void daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::print ( std::ostream &  os = std::cout) const

Definition at line 133 of file RawSummaryDCMDataV0.cpp.

References _Header, samweb_client.client::_version, EXECUTE_FUNCTION, novadaq::HexUtils::format(), MECModelEnuComparisons::i, and sizeofdata().

133  {
134 
135  const uint32_t size_of_data = EXECUTE_FUNCTION(sizeofdata)();
136 
137  os<<boost::format("\n---SummaryDCMData---------------------------------------------(size=%u, version=%u)\n")
138  % size_of_data % _version;
139 
140  printBuffer(os);
141 
142  for(uint32_t i = 0; i < size_of_data; ++i){
143  os<<" ";
144  printWord(i, false, os);
145  os<<"\n";
146  }
147 
148  _Header->print(os);
149  printBinary(_Buffer, _Header->sizeofdata(), os);
150 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
daqdataformats::RawSummaryDCMDataHeader * _Header
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
bool daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::setBufferSource ( const void pointer)

If Header is already defined, then set its buffer source Otherwise, need to construct it

Construct header

< version of the MicroBlockHeader equals the version of the MicroBlock

If buffer is internal, resize it to header size plus one, so that we can assige the start of the MicroSlice buffer

Check pointers after each read or resize buffer

Definition at line 77 of file RawSummaryDCMDataV0.cpp.

References _Header, samweb_client.client::_version, om::cout, EXECUTE_ON_DEBUG, PRINT_ON_DEBUG, sizeofdata(), and sizeofdata_t.

77  {
78 
79  PRINT_ON_DEBUG(__PRETTY_FUNCTION__<<" initial size of internal buffer"<<_InternalBuffer.size());
80 
81  _Buffer = (void*)pointer;
82 
83  _shouldBufferBeInternal = isInternalBuffer();
84 
85  /// If Header is already defined, then set its buffer source
86  /// Otherwise, need to construct it
87  if(_Header) {
88  return _Header->setBufferSource(pointer);
89  }
90  PRINT_ON_DEBUG(__PRETTY_FUNCTION__<<" step0 size of internal buffer "<<_InternalBuffer.size()<<" 000000000000000000000000000000000000000000000000000\n");
91 
92  /// Construct header
93  _Header = new daqdataformats::RawSummaryDCMDataHeader(_Buffer, _version); ///< version of the MicroBlockHeader equals the version of the MicroBlock
94 
95  /// If buffer is internal, resize it to header size plus one,
96  /// so that we can assige the start of the MicroSlice buffer
97  if(_shouldBufferBeInternal){
98  resizeInternalBuffer(_Header->sizeofdata() + 0);
99  /// Check pointers after each read or resize buffer
100  checkBufferInternalness();
101  }
102 
103  PRINT_ON_DEBUG(__PRETTY_FUNCTION__<<" step1 size of internal buffer "<<_InternalBuffer.size()<<" 1111111111111111111111111111111111111111111111111111\n");
104 
106  if(_function_sizeofdata)std::cout<<"sizeofdata before binding "<<sizeofdata()<<"\n";
107  else std::cout<<"sizeofdata is not bound\n"
108  );
109 
110  _function_sizeofdata = (sizeofdata_t) &version0::RawSummaryDCMData::sizeofdata;
111 
112  PRINT_ON_DEBUG("sizeofdata after binding "<<sizeofdata());
113  return true;
114  }
#define sizeofdata_t
Definition: FunctionBind.h:30
#define EXECUTE_ON_DEBUG(x)
Debugging macros.
Definition: RawDAQData.h:34
daqdataformats::RawSummaryDCMDataHeader * _Header
OStream cout
Definition: OStream.cxx:6
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
uint32_t daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::sizeofdata ( ) const

Member Data Documentation

daqdataformats::RawSummaryDCMDataHeader* daqdataformats::VERSION_NAMESPACE::RawSummaryDCMData::_Header
protected

The documentation for this class was generated from the following files: