Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:21

0001 #include "CondCore/CondDB/interface/Binary.h"
0002 #include "CondCore/CondDB/interface/Exception.h"
0003 //
0004 #include "CoralBase/Blob.h"
0005 //
0006 #include <cstring>
0007 
0008 #include <openssl/sha.h>
0009 #include <cstring>
0010 
0011 cond::Binary::Binary() : m_data(new coral::Blob(0)) {}
0012 
0013 cond::Binary::Binary(const void* data, size_t size) : m_data(new coral::Blob(size)) {
0014   ::memcpy(m_data->startingAddress(), data, size);
0015 }
0016 
0017 cond::Binary::Binary(const coral::Blob& data) : m_data(new coral::Blob(data.size())) {
0018   ::memcpy(m_data->startingAddress(), data.startingAddress(), data.size());
0019 }
0020 
0021 cond::Binary::Binary(const Binary& rhs) : m_data(rhs.m_data) {}
0022 
0023 cond::Binary& cond::Binary::operator=(const Binary& rhs) {
0024   if (this != &rhs) {
0025     m_data = rhs.m_data;
0026   }
0027   return *this;
0028 }
0029 
0030 const coral::Blob& cond::Binary::get() const { return *m_data; }
0031 
0032 void cond::Binary::copy(const std::string& source) {
0033   m_data.reset(new coral::Blob(source.size()));
0034   ::memcpy(m_data->startingAddress(), source.c_str(), source.size());
0035 }
0036 
0037 const void* cond::Binary::data() const {
0038   if (!m_data.get())
0039     throwException("Binary data can't be accessed.", "Binary::data");
0040   return m_data->startingAddress();
0041 }
0042 void* cond::Binary::data() {
0043   if (!m_data.get())
0044     throwException("Binary data can't be accessed.", "Binary::data");
0045   return m_data->startingAddress();
0046 }
0047 
0048 size_t cond::Binary::size() const {
0049   if (!m_data.get())
0050     throwException("Binary data can't be accessed.", "Binary::size");
0051   return m_data->size();
0052 }