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 
12  m_data( new coral::Blob(0) ){
13 }
14 
15 cond::Binary::Binary( const void* data, size_t size ):
16  m_data( new coral::Blob( size ) ){
17  ::memcpy( m_data->startingAddress(), data, size );
18 }
19 
20 cond::Binary::Binary( const coral::Blob& data ):
21  m_data( new coral::Blob(data.size()) ){
22  ::memcpy( m_data->startingAddress(), data.startingAddress(), data.size() );
23 }
24 
26  m_data( rhs.m_data ){
27 }
28 
30  if( this != &rhs ) {
31  m_data = rhs.m_data;
32  }
33  return *this;
34 }
35 
36 const coral::Blob& cond::Binary::get() const {
37  return *m_data;
38 }
39 
41  m_data.reset( new coral::Blob( source.size() ) );
42  ::memcpy( m_data->startingAddress(), source.c_str(), source.size() );
43 }
44 
45 const void* cond::Binary::data() const {
46  if(!m_data.get()) throwException( "Binary data can't be accessed.","Binary::data");
47  return m_data->startingAddress();
48 }
50  if(!m_data.get()) throwException( "Binary data can't be accessed.","Binary::data");
51  return m_data->startingAddress();
52 }
53 
54 size_t cond::Binary::size() const {
55  if(!m_data.get()) throwException( "Binary data can't be accessed.","Binary::size");
56  return m_data->size();
57 }
58 
59 
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:21
size_t size() const
Definition: Binary.cc:54
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:38
Binary & operator=(const Binary &rhs)
Definition: Binary.cc:29
void copy(const std::string &source)
Definition: Binary.cc:40
Definition: Binary.h:9
const void * data() const
Definition: Binary.cc:45
const coral::Blob & get() const
Definition: Binary.cc:36
static std::string const source
Definition: EdmProvDump.cc:44