CMS 3D CMS Logo

Binary.cc
Go to the documentation of this file.
3 //
4 #include "CoralBase/Blob.h"
5 //
6 #include <cstring>
7 
8 #include <openssl/sha.h>
9 #include <cstring>
10 
11 cond::Binary::Binary() : m_data(new coral::Blob(0)) {}
12 
13 cond::Binary::Binary(const void* data, size_t size) : m_data(new coral::Blob(size)) {
14  ::memcpy(m_data->startingAddress(), data, size);
15 }
16 
17 cond::Binary::Binary(const coral::Blob& data) : m_data(new coral::Blob(data.size())) {
18  ::memcpy(m_data->startingAddress(), data.startingAddress(), data.size());
19 }
20 
21 cond::Binary::Binary(const Binary& rhs) : m_data(rhs.m_data) {}
22 
24  if (this != &rhs) {
25  m_data = rhs.m_data;
26  }
27  return *this;
28 }
29 
30 const coral::Blob& cond::Binary::get() const { return *m_data; }
31 
33  m_data.reset(new coral::Blob(source.size()));
34  ::memcpy(m_data->startingAddress(), source.c_str(), source.size());
35 }
36 
37 const void* cond::Binary::data() const {
38  if (!m_data.get())
39  throwException("Binary data can't be accessed.", "Binary::data");
40  return m_data->startingAddress();
41 }
43  if (!m_data.get())
44  throwException("Binary data can't be accessed.", "Binary::data");
45  return m_data->startingAddress();
46 }
47 
48 size_t cond::Binary::size() const {
49  if (!m_data.get())
50  throwException("Binary data can't be accessed.", "Binary::size");
51  return m_data->size();
52 }
size
Write out results.
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
size_t size() const
Definition: Binary.cc:48
Binary & operator=(const Binary &rhs)
Definition: Binary.cc:23
void copy(const std::string &source)
Definition: Binary.cc:32
Definition: Binary.h:9
const void * data() const
Definition: Binary.cc:37
const coral::Blob & get() const
Definition: Binary.cc:30
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
static std::string const source
Definition: EdmProvDump.cc:49