10 #include "TBufferFile.h"
17 #define PRIMITIVE(x) { \
19 reinterpret_cast<WriteArrayFn_t>( \
20 (void (TBuffer::*)(const x*, Int_t))&TBuffer::WriteFastArray), \
21 reinterpret_cast<ReadArrayFn_t>( \
22 (void (TBuffer::*)(x*, Int_t))&TBuffer::ReadFastArray) \
26 const std::type_info &
type;
31 {
return type == other; }
54 : m_arraySize(0), m_class(0), m_primitive(0)
70 const std::type_info &typeInfo = type.
typeInfo();
71 m_class = TClass::GetClass(typeInfo);
74 "No ROOT class registered for " + type.
name());
78 "Only arrays of primitive types supported. "
79 "Please to not use a Blob for this member.");
85 "Cannot handle primitive type " + type.
name());
88 "Cannot handle C++ type " + type.
name());
98 #include <boost/bind.hpp>
100 inline char * reallocInBlob( boost::shared_ptr<coral::Blob> theBlob,
char*
p,
size_t newsize,
size_t oldsize) {
102 theBlob->resize(newsize);
103 return (
char*)theBlob->startingAddress();
114 "not of actual class.");
116 boost::shared_ptr<coral::Blob> theBlob(
new coral::Blob );
121 TBufferFile buffer(TBufferFile::kWrite);
129 buffer.StreamObject(const_cast<void*>(addr), theType.
m_class);
131 Int_t
size = buffer.Length();
133 theBlob->resize(size);
135 std::memcpy(startingAddress, buffer.Buffer(),
size);
145 size_t size = blobData.size();
149 TBufferFile buffer(TBufferFile::kRead, size,
150 const_cast<void*>(startingAddress), kFALSE);
159 buffer.StreamObject(addr, theType.
m_class);
TBufferBlobTypeInfo(const edm::TypeWithDict &type)
std::size_t m_arraySize
length of the plain C array (zero otherwise)
TypeWithDict finalType() const
void read(const coral::Blob &blobData, void *addressOfContainer, edm::TypeWithDict const &classDictionary)
Reads an object from a Blob and fills-in the container.
TClass * m_class
The class as seen by the ROOT streaming services.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
TypeWithDict toType() const
unsigned int m_primitive
the primitive C++ type if m_class is unset
boost::shared_ptr< coral::Blob > write(const void *addressOfInputData, edm::TypeWithDict const &classDictionary, bool useCompression=false)
const std::type_info & type
virtual ~TBufferBlobStreamingService()
bool isFundamental() const
std::type_info const & typeInfo() const
void(TBuffer::* ReadArrayFn_t)(void *obj, Int_t n)
static const std::size_t nPrimitives
TBufferBlobStreamingService()
ReadArrayFn_t readArrayFn
size_t arrayLength() const
WriteArrayFn_t writeArrayFn
void(TBuffer::* WriteArrayFn_t)(const void *obj, Int_t n)
tuple size
Write out results.
struct Primitive primitives[]
bool operator==(const std::type_info &other) const