CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Binary.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_Binary_h
2 #define CondCore_CondDB_Binary_h
3 
4 #include <string>
5 #include <memory>
6 // temporarely
7 #include <boost/shared_ptr.hpp>
8 //
9 
10 namespace coral {
11  class Blob;
12 }
13 
14 namespace cond {
15 
16  struct Nodelete {
18  void operator()( void* ptr ){}
19  };
20 
21  class Binary {
22  public:
23  Binary();
24 
25  template <typename T> explicit Binary( const T& object );
26 
27  explicit Binary( const boost::shared_ptr<void>& objectPtr );
28 
29  Binary( const void* data, size_t size );
30 
31  explicit Binary( const coral::Blob& data );
32 
33  Binary( const Binary& rhs );
34 
35  Binary& operator=( const Binary& rhs );
36 
37  const coral::Blob& get() const;
38 
39  void copy( const std::string& source );
40 
41  const void* data() const;
42 
43  void* data();
44 
45  size_t size() const;
46 
47  boost::shared_ptr<void> share() const;
48 
49  private:
50  std::shared_ptr<coral::Blob> m_data;
51  //
52  boost::shared_ptr<void> m_object;
53  };
54 
55  template <typename T> Binary::Binary( const T& object ):
56  m_object( &const_cast<T&>(object), Nodelete() ){
57  }
58 }
59 
60 #endif
61 
size_t size() const
Definition: Binary.cc:61
std::shared_ptr< coral::Blob > m_data
Definition: Binary.h:50
Binary & operator=(const Binary &rhs)
Definition: Binary.cc:34
void copy(const std::string &source)
Definition: Binary.cc:46
const void * data() const
Definition: Binary.cc:52
boost::shared_ptr< void > m_object
Definition: Binary.h:52
void operator()(void *ptr)
Definition: Binary.h:18
long double T
static std::string const source
Definition: EdmProvDump.cc:43
boost::shared_ptr< void > share() const
Definition: Binary.cc:66