CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:18
size_t size() const
Definition: Binary.cc:48
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38
Binary & operator=(const Binary &rhs)
Definition: Binary.cc:23
void copy(const std::string &source)
Definition: Binary.cc:32
const void * data() const
Definition: Binary.cc:37
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const coral::Blob & get() const
Definition: Binary.cc:30
static std::string const source
Definition: EdmProvDump.cc:46
tuple size
Write out results.