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 Binary &rhs)
 
 Binary (const coral::Blob &data)
 
 Binary (const void *data, size_t size)
 
void copy (const std::string &source)
 
void * data ()
 
const void * data () const
 
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)) {}

◆ Binary() [2/4]

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

Definition at line 13 of file Binary.cc.

13  : m_data(new coral::Blob(size)) {
14  ::memcpy(m_data->startingAddress(), data, size);
15 }

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

◆ Binary() [3/4]

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

Definition at line 17 of file Binary.cc.

17  : m_data(new coral::Blob(data.size())) {
18  ::memcpy(m_data->startingAddress(), data.startingAddress(), data.size());
19 }

References data(), and m_data.

◆ Binary() [4/4]

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

Definition at line 21 of file Binary.cc.

21 : m_data(rhs.m_data) {}

Member Function Documentation

◆ copy()

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

Definition at line 32 of file Binary.cc.

32  {
33  m_data.reset(new coral::Blob(source.size()));
34  ::memcpy(m_data->startingAddress(), source.c_str(), source.size());
35 }

References source.

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

◆ data() [1/2]

void * cond::Binary::data ( )

Definition at line 42 of file Binary.cc.

42  {
43  if (!m_data.get())
44  throwException("Binary data can't be accessed.", "Binary::data");
45  return m_data->startingAddress();
46 }

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().

◆ data() [2/2]

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

Definition at line 37 of file Binary.cc.

37  {
38  if (!m_data.get())
39  throwException("Binary data can't be accessed.", "Binary::data");
40  return m_data->startingAddress();
41 }

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().

◆ 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.

23  {
24  if (this != &rhs) {
25  m_data = rhs.m_data;
26  }
27  return *this;
28 }

References m_data.

◆ size()

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

Definition at line 48 of file Binary.cc.

48  {
49  if (!m_data.get())
50  throwException("Binary data can't be accessed.", "Binary::size");
51  return m_data->size();
52 }

References cond::throwException().

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

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=().

cond::Binary::data
const void * data() const
Definition: Binary.cc:37
cond::Binary::size
size_t size() const
Definition: Binary.cc:48
source
static const std::string source
Definition: EdmProvDump.cc:47
cond::Binary::m_data
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38
cond::throwException
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:18