CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
cond::TBufferBlobStreamingService Class Reference

#include <TBufferBlobStreamingService.h>

Inheritance diagram for cond::TBufferBlobStreamingService:
ora::IBlobStreamingService

Public Member Functions

void read (const coral::Blob &blobData, void *addressOfContainer, edm::TypeWithDict const &classDictionary)
 Reads an object from a Blob and fills-in the container. More...
 
 TBufferBlobStreamingService ()
 
boost::shared_ptr< coral::Blob > write (const void *addressOfInputData, edm::TypeWithDict const &classDictionary, bool useCompression=false)
 
virtual ~TBufferBlobStreamingService ()
 
- Public Member Functions inherited from ora::IBlobStreamingService
virtual ~IBlobStreamingService ()
 Empty destructor. More...
 

Detailed Description

Definition at line 29 of file TBufferBlobStreamingService.h.

Constructor & Destructor Documentation

cond::TBufferBlobStreamingService::TBufferBlobStreamingService ( )

Definition at line 92 of file TBufferBlobStreamingService.cc.

92  {
93 }
cond::TBufferBlobStreamingService::~TBufferBlobStreamingService ( )
virtual

Definition at line 95 of file TBufferBlobStreamingService.cc.

95  {
96 }

Member Function Documentation

void cond::TBufferBlobStreamingService::read ( const coral::Blob &  blobData,
void *  addressOfContainer,
edm::TypeWithDict const &  classDictionary 
)
virtual

Reads an object from a Blob and fills-in the container.

Implements ora::IBlobStreamingService.

Definition at line 140 of file TBufferBlobStreamingService.cc.

References cond::TBufferBlobTypeInfo::m_arraySize, cond::TBufferBlobTypeInfo::m_class, cond::TBufferBlobTypeInfo::m_primitive, primitives, Primitive::readArrayFn, findQualityFiles::size, and reco::formula::startingAddress().

Referenced by Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), and Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches().

142  {
143  TBufferBlobTypeInfo theType( classDictionary );
144  const void *startingAddress = blobData.startingAddress();
145  size_t size = blobData.size();
146  if (!size)
147  return;
148 
149  TBufferFile buffer(TBufferFile::kRead, size,
150  const_cast<void*>(startingAddress), kFALSE);
151 
152  buffer.InitMap();
153 
154  if (theType.m_arraySize && !theType.m_class)
155  (buffer.*primitives[theType.m_primitive].readArrayFn)(addr, theType.m_arraySize);
156  else if (theType.m_arraySize)
157  buffer.ReadFastArray(addr, theType.m_class, theType.m_arraySize);
158  else
159  buffer.StreamObject(addr, theType.m_class);
160 }
double const * startingAddress(ArrayAdaptor const &iV)
ReadArrayFn_t readArrayFn
tuple size
Write out results.
struct Primitive primitives[]
boost::shared_ptr< coral::Blob > cond::TBufferBlobStreamingService::write ( const void *  addressOfInputData,
edm::TypeWithDict const &  classDictionary,
bool  useCompression = false 
)
virtual

Implements ora::IBlobStreamingService.

Definition at line 108 of file TBufferBlobStreamingService.cc.

References cond::TBufferBlobTypeInfo::m_arraySize, cond::TBufferBlobTypeInfo::m_class, cond::TBufferBlobTypeInfo::m_primitive, primitives, findQualityFiles::size, reco::formula::startingAddress(), and Primitive::writeArrayFn.

Referenced by pkg.AbstractPkg::generate().

110  {
111  TBufferBlobTypeInfo theType( classDictionary );
112  if (theType.m_class && theType.m_class->GetActualClass(addr) != theType.m_class)
113  throw cond::Exception("TBufferBlobWriter::write object to stream is "
114  "not of actual class.");
115 
116  boost::shared_ptr<coral::Blob> theBlob( new coral::Blob );
117  //theBlob->resize(1024);
118 
119  // with new root...
120  // TBufferFile buffer(TBufferFile::kWrite, theBlob->size(), theBlob->startingAddress(), kFALSE, boost::bind(reallocInBlob, theBlob,_1,_2,_3));
121  TBufferFile buffer(TBufferFile::kWrite);
122  buffer.InitMap();
123 
124  if (theType.m_arraySize && !theType.m_class)
125  (buffer.*primitives[theType.m_primitive].writeArrayFn)(addr, theType.m_arraySize);
126  else if (theType.m_arraySize)
127  buffer.WriteFastArray(const_cast<void*>(addr), theType.m_class, theType.m_arraySize);
128  else
129  buffer.StreamObject(const_cast<void*>(addr), theType.m_class);
130 
131  Int_t size = buffer.Length();
132 
133  theBlob->resize(size);
134  void *startingAddress = theBlob->startingAddress();
135  std::memcpy(startingAddress, buffer.Buffer(), size);
136 
137  return theBlob;
138 }
double const * startingAddress(ArrayAdaptor const &iV)
WriteArrayFn_t writeArrayFn
tuple size
Write out results.
struct Primitive primitives[]