#include <TBufferBlobStreamingService.h>
Public Member Functions | |
void | read (const coral::Blob &blobData, void *addressOfContainer, Reflex::Type const &classDictionary) |
Reads an object from a Blob and fills-in the container. | |
TBufferBlobStreamingService () | |
boost::shared_ptr< coral::Blob > | write (const void *addressOfInputData, Reflex::Type const &classDictionary, bool useCompression=false) |
virtual | ~TBufferBlobStreamingService () |
Definition at line 27 of file TBufferBlobStreamingService.h.
cond::TBufferBlobStreamingService::TBufferBlobStreamingService | ( | ) |
Definition at line 98 of file TBufferBlobStreamingService.cc.
{ }
cond::TBufferBlobStreamingService::~TBufferBlobStreamingService | ( | ) | [virtual] |
Definition at line 101 of file TBufferBlobStreamingService.cc.
{ }
void cond::TBufferBlobStreamingService::read | ( | const coral::Blob & | blobData, |
void * | addressOfContainer, | ||
Reflex::Type const & | classDictionary | ||
) | [virtual] |
Reads an object from a Blob and fills-in the container.
Implements ora::IBlobStreamingService.
Definition at line 146 of file TBufferBlobStreamingService.cc.
References cond::TBufferBlobTypeInfo::m_arraySize, cond::TBufferBlobTypeInfo::m_class, cond::TBufferBlobTypeInfo::m_primitive, primitives, Primitive::readArrayFn, and findQualityFiles::size.
{ TBufferBlobTypeInfo theType( classDictionary ); const void *startingAddress = blobData.startingAddress(); size_t size = blobData.size(); if (!size) return; TBufferFile buffer(TBufferFile::kRead, size, const_cast<void*>(startingAddress), kFALSE); buffer.InitMap(); if (theType.m_arraySize && !theType.m_class) (buffer.*primitives[theType.m_primitive].readArrayFn)(addr, theType.m_arraySize); else if (theType.m_arraySize) buffer.ReadFastArray(addr, theType.m_class, theType.m_arraySize); else buffer.StreamObject(addr, theType.m_class); }
boost::shared_ptr< coral::Blob > cond::TBufferBlobStreamingService::write | ( | const void * | addressOfInputData, |
Reflex::Type const & | classDictionary, | ||
bool | useCompression = false |
||
) | [virtual] |
Implements ora::IBlobStreamingService.
Definition at line 114 of file TBufferBlobStreamingService.cc.
References cond::TBufferBlobTypeInfo::m_arraySize, cond::TBufferBlobTypeInfo::m_class, cond::TBufferBlobTypeInfo::m_primitive, primitives, findQualityFiles::size, and Primitive::writeArrayFn.
{ TBufferBlobTypeInfo theType( classDictionary ); if (theType.m_class && theType.m_class->GetActualClass(addr) != theType.m_class) throw cond::Exception("TBufferBlobWriter::write object to stream is " "not of actual class."); boost::shared_ptr<coral::Blob> theBlob( new coral::Blob ); //theBlob->resize(1024); // with new root... // TBufferFile buffer(TBufferFile::kWrite, theBlob->size(), theBlob->startingAddress(), kFALSE, boost::bind(reallocInBlob, theBlob,_1,_2,_3)); TBufferFile buffer(TBufferFile::kWrite); buffer.InitMap(); if (theType.m_arraySize && !theType.m_class) (buffer.*primitives[theType.m_primitive].writeArrayFn)(addr, theType.m_arraySize); else if (theType.m_arraySize) buffer.WriteFastArray(const_cast<void*>(addr), theType.m_class, theType.m_arraySize); else buffer.StreamObject(const_cast<void*>(addr), theType.m_class); Int_t size = buffer.Length(); theBlob->resize(size); void *startingAddress = theBlob->startingAddress(); std::memcpy(startingAddress, buffer.Buffer(), size); return theBlob; }