CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cond::Binary Class Reference

#include <Binary.h>

Public Member Functions

 Binary ()
 
 Binary (const void *data, size_t size)
 
 Binary (const coral::Blob &data)
 
 Binary (const Binary &rhs)
 
void copy (const std::string &source)
 
const void * data () const
 
void * data ()
 
const coral::Blob & get () const
 
Binaryoperator= (const Binary &rhs)
 
size_t size () const
 

Private Attributes

std::shared_ptr< coral::Blob > m_data
 

Detailed Description

Definition at line 15 of file Binary.h.

Constructor & Destructor Documentation

◆ Binary() [1/4]

cond::Binary::Binary ( )

Definition at line 11 of file Binary.cc.

11 : m_data(new coral::Blob(0)) {}
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38

◆ Binary() [2/4]

cond::Binary::Binary ( const void *  data,
size_t  size 
)

Definition at line 13 of file Binary.cc.

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

13  : m_data(new coral::Blob(size)) {
14  ::memcpy(m_data->startingAddress(), data, size);
15 }
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38
size_t size() const
Definition: Binary.cc:48
const void * data() const
Definition: Binary.cc:37

◆ Binary() [3/4]

cond::Binary::Binary ( const coral::Blob &  data)
explicit

Definition at line 17 of file Binary.cc.

References data(), and m_data.

17  : m_data(new coral::Blob(data.size())) {
18  ::memcpy(m_data->startingAddress(), data.startingAddress(), data.size());
19 }
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38
const void * data() const
Definition: Binary.cc:37

◆ Binary() [4/4]

cond::Binary::Binary ( const Binary rhs)

Definition at line 21 of file Binary.cc.

21 : m_data(rhs.m_data) {}
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38

Member Function Documentation

◆ copy()

void cond::Binary::copy ( const std::string &  source)

Definition at line 32 of file Binary.cc.

References source.

Referenced by SequenceTypes._TaskBase::copyAndAdd(), and cond::persistency::PAYLOAD::Table::insert().

32  {
33  m_data.reset(new coral::Blob(source.size()));
34  ::memcpy(m_data->startingAddress(), source.c_str(), source.size());
35 }
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38
static std::string const source
Definition: EdmProvDump.cc:46

◆ data() [1/2]

const void * cond::Binary::data ( ) const

Definition at line 37 of file Binary.cc.

References cond::throwException().

Referenced by data_sources.node::__str__(), data_sources.json_list::as_dicts(), data_sources.json_list::as_table(), Binary(), cond::default_deserialize(), data_sources.json_list::get_members(), and data_sources.json_list::last().

37  {
38  if (!m_data.get())
39  throwException("Binary data can't be accessed.", "Binary::data");
40  return m_data->startingAddress();
41 }
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:18
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38

◆ data() [2/2]

void * cond::Binary::data ( )

Definition at line 42 of file Binary.cc.

References cond::throwException().

Referenced by data_sources.node::__str__(), data_sources.json_list::as_dicts(), data_sources.json_list::as_table(), data_sources.json_list::get_members(), and data_sources.json_list::last().

42  {
43  if (!m_data.get())
44  throwException("Binary data can't be accessed.", "Binary::data");
45  return m_data->startingAddress();
46 }
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:18
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38

◆ get()

const coral::Blob & cond::Binary::get ( ) const

◆ operator=()

cond::Binary & cond::Binary::operator= ( const Binary rhs)

Definition at line 23 of file Binary.cc.

References m_data.

23  {
24  if (this != &rhs) {
25  m_data = rhs.m_data;
26  }
27  return *this;
28 }
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38

◆ size()

size_t cond::Binary::size ( void  ) const

Definition at line 48 of file Binary.cc.

References cond::throwException().

Referenced by ntupleDataFormat._Collection::__iter__(), ntupleDataFormat._Collection::__len__(), Binary(), cond::default_deserialize(), and cond::persistency::PAYLOAD::Table::insert().

48  {
49  if (!m_data.get())
50  throwException("Binary data can't be accessed.", "Binary::size");
51  return m_data->size();
52 }
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:18
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38

Member Data Documentation

◆ m_data

std::shared_ptr<coral::Blob> cond::Binary::m_data
private

Definition at line 38 of file Binary.h.

Referenced by Binary(), and operator=().