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, Reflex::Type const &classDictionary)
 Reads an object from a Blob and fills-in the container. More...
 
 TBufferBlobStreamingService ()
 
boost::shared_ptr< coral::Blob > write (const void *addressOfInputData, Reflex::Type const &classDictionary, bool useCompression=false)
 
virtual ~TBufferBlobStreamingService ()
 
- Public Member Functions inherited from ora::IBlobStreamingService
virtual ~IBlobStreamingService ()
 Empty destructor. More...
 

Detailed Description

Definition at line 27 of file TBufferBlobStreamingService.h.

Constructor & Destructor Documentation

cond::TBufferBlobStreamingService::TBufferBlobStreamingService ( )

Definition at line 98 of file TBufferBlobStreamingService.cc.

98  {
99 }
cond::TBufferBlobStreamingService::~TBufferBlobStreamingService ( )
virtual

Definition at line 101 of file TBufferBlobStreamingService.cc.

101  {
102 }

Member Function Documentation

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.

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

148  {
149  TBufferBlobTypeInfo theType( classDictionary );
150  const void *startingAddress = blobData.startingAddress();
151  size_t size = blobData.size();
152  if (!size)
153  return;
154 
155  TBufferFile buffer(TBufferFile::kRead, size,
156  const_cast<void*>(startingAddress), kFALSE);
157 
158  buffer.InitMap();
159 
160  if (theType.m_arraySize && !theType.m_class)
161  (buffer.*primitives[theType.m_primitive].readArrayFn)(addr, theType.m_arraySize);
162  else if (theType.m_arraySize)
163  buffer.ReadFastArray(addr, theType.m_class, theType.m_arraySize);
164  else
165  buffer.StreamObject(addr, theType.m_class);
166 }
ReadArrayFn_t readArrayFn
tuple size
Write out results.
struct Primitive primitives[]
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.

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