CMS 3D CMS Logo

Public Member Functions | Private Attributes

EOFRecordBuilder Class Reference

#include <EOFRecordBuilder.h>

List of all members.

Public Member Functions

 EOFRecordBuilder (uint32 run, uint32 events, uint32 statusCode, const std::vector< uint32 > &hltStats, uint64 first_event_offset, uint64 last_event_offset)
uint8recAddress () const
uint32 size () const

Private Attributes

std::vector< uint8buf_

Detailed Description

Definition at line 10 of file EOFRecordBuilder.h.


Constructor & Destructor Documentation

EOFRecordBuilder::EOFRecordBuilder ( uint32  run,
uint32  events,
uint32  statusCode,
const std::vector< uint32 > &  hltStats,
uint64  first_event_offset,
uint64  last_event_offset 
)

Bring the Pos at enof of Message

pos - &buf_ gives legth of message

Code is 4 for EOF

Definition at line 8 of file EOFRecordBuilder.cc.

References buf_, lhef::cc::convert(), Header::EOFRECORD, EOFRecordHeader::events_, h, EOFRecordHeader::header_, i, pos, EOFRecordHeader::run_, EOFRecordHeader::status_code_, and v.

{
  uint32 buf_size = 1 + ((sizeof(uint32)) * 8)+ ((sizeof(uint32)) * hltStats.size());
  buf_.resize(buf_size);

  uint8* pos = (uint8*)&buf_[0];
  EOFRecordHeader* h = (EOFRecordHeader*)pos;
  convert(run,h->run_);
  convert(statusCode,h->status_code_);
  convert(events,h->events_);
  pos +=  sizeof(EOFRecordHeader);

  for(unsigned int i = 0; i < hltStats.size(); ++i) {
    char_uint32 v;
    convert(hltStats.at(i),  v);
    memcpy(pos, v, sizeof(char_uint32));
    pos += sizeof(char_uint32); 
  }

  char_uint64 v;
  convert(first_event_offset, v);
  memcpy(pos, v, sizeof(char_uint64));
  pos += sizeof(char_uint64);
  
  convert(last_event_offset, v);
  memcpy(pos, v, sizeof(char_uint64));
  pos += sizeof(char_uint64);  
  uint32 calculatedSize = (uint8*)pos - (uint8*)&buf_[0];
  assert(calculatedSize == buf_.size());
  new (&h->header_) Header(Header::EOFRECORD, calculatedSize);
}

Member Function Documentation

uint8* EOFRecordBuilder::recAddress ( ) const [inline]

Definition at line 20 of file EOFRecordBuilder.h.

References buf_.

{ return (uint8*) &buf_[0]; }
uint32 EOFRecordBuilder::size ( void  ) const [inline]

Definition at line 21 of file EOFRecordBuilder.h.

References buf_.

{return (uint32) buf_.size(); }

Member Data Documentation

std::vector<uint8> EOFRecordBuilder::buf_ [private]

Definition at line 24 of file EOFRecordBuilder.h.

Referenced by EOFRecordBuilder(), recAddress(), and size().