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 Attributes
amc::Packet Class Reference

#include <AMCSpec.h>

Public Member Functions

void addPayload (const uint64_t *, unsigned int)
 
std::vector< uint64_t > block (unsigned int id) const
 
unsigned int blocks () const
 
std::unique_ptr< uint64_t[]> data ()
 
Header header (unsigned int block=0) const
 
 Packet (const uint64_t *d)
 
 Packet (unsigned int amc, unsigned int board, const std::vector< uint64_t > &load)
 
unsigned int size () const
 

Private Attributes

Header header_
 
std::vector< uint64_t > payload_
 

Detailed Description

Definition at line 57 of file AMCSpec.h.

Constructor & Destructor Documentation

amc::Packet::Packet ( const uint64_t *  d)
inline

Definition at line 59 of file AMCSpec.h.

59 : header_(d) {};
Header header_
Definition: AMCSpec.h:69
Packet::Packet ( unsigned int  amc,
unsigned int  board,
const std::vector< uint64_t > &  load 
)

Definition at line 74 of file AMCSpec.cc.

74  :
75  header_(amc, board, load.size()),
76  payload_(load)
77  {
78  }
double amc
Definition: hdecay.h:20
def load
Definition: svgfig.py:546
Header header_
Definition: AMCSpec.h:69
std::vector< uint64_t > payload_
Definition: AMCSpec.h:73

Member Function Documentation

void Packet::addPayload ( const uint64_t *  data,
unsigned int  size 
)

Definition at line 81 of file AMCSpec.cc.

References data(), payload_, and size().

82  {
83  payload_.insert(payload_.end(), data, data + size);
84  }
unsigned int size() const
Definition: AMCSpec.h:69
std::unique_ptr< uint64_t[]> data()
Definition: AMCSpec.cc:99
std::vector< uint64_t > payload_
Definition: AMCSpec.h:73
std::vector< uint64_t > Packet::block ( unsigned int  id) const

Definition at line 87 of file AMCSpec.cc.

References amc::Header::getBlocks(), header_, payload_, and amc::split_block_size.

88  {
89  if (id == 0 and id == header_.getBlocks() - 1) {
90  return payload_;
91  } else if (id == header_.getBlocks() - 1) {
92  return std::vector<uint64_t>(payload_.begin() + id * split_block_size, payload_.end());
93  } else {
94  return std::vector<uint64_t>(payload_.begin() + id * split_block_size, payload_.begin() + (id + 1) * split_block_size);
95  }
96  }
unsigned int getBlocks() const
Definition: AMCSpec.cc:52
static const unsigned int split_block_size
Definition: AMCSpec.h:13
Header header_
Definition: AMCSpec.h:69
std::vector< uint64_t > payload_
Definition: AMCSpec.h:73
unsigned int amc::Packet::blocks ( ) const
inline

Definition at line 68 of file AMCSpec.h.

References amc::Header::getBlocks(), and header_.

68 { return header_.getBlocks(); };
unsigned int getBlocks() const
Definition: AMCSpec.cc:52
Header header_
Definition: AMCSpec.h:69
std::unique_ptr< uint64_t[]> Packet::data ( )

Definition at line 99 of file AMCSpec.cc.

References i, and payload_.

Referenced by cuy.FindIssue::__init__(), and addPayload().

100  {
101  std::unique_ptr<uint64_t[]> res(new uint64_t[payload_.size()]);
102  for (unsigned int i = 0; i < payload_.size(); ++i)
103  res.get()[i] = payload_[i];
104  return res;
105  }
int i
Definition: DBlmapReader.cc:9
unsigned long long uint64_t
Definition: Time.h:15
std::vector< uint64_t > payload_
Definition: AMCSpec.h:73
Header amc::Packet::header ( unsigned int  block = 0) const
inline

Definition at line 66 of file AMCSpec.h.

References header_.

66 { return header_; };
Header header_
Definition: AMCSpec.h:69
unsigned int amc::Packet::size ( void  ) const
inline

Definition at line 69 of file AMCSpec.h.

References amc::Header::getSize(), and header_.

Referenced by addPayload().

69 { return header_.getSize(); };
unsigned int getSize() const
Definition: AMCSpec.h:32
Header header_
Definition: AMCSpec.h:69

Member Data Documentation

Header amc::Packet::header_
private

Definition at line 69 of file AMCSpec.h.

Referenced by block(), blocks(), header(), and size().

std::vector<uint64_t> amc::Packet::payload_
private

Definition at line 73 of file AMCSpec.h.

Referenced by addPayload(), block(), and data().