CMS 3D CMS Logo

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

#include <Serialization.h>

Public Member Functions

template<typename T >
RootOutputArchiveoperator<< (const T &instance)
 
 RootOutputArchive (std::ostream &destination)
 

Private Member Functions

void write (const std::type_info &sourceType, const void *sourceInstance)
 

Private Attributes

std::ostream & m_buffer
 

Detailed Description

Definition at line 41 of file Serialization.h.

Constructor & Destructor Documentation

cond::RootOutputArchive::RootOutputArchive ( std::ostream &  destination)
explicit

Definition at line 34 of file Serialization.cc.

34  :
35  m_buffer( dest ){
36 }
std::ostream & m_buffer
Definition: Serialization.h:52

Member Function Documentation

template<typename T >
RootOutputArchive & cond::RootOutputArchive::operator<< ( const T instance)
inline

Definition at line 55 of file Serialization.h.

References write().

55  {
56  write( typeid(T), &instance );
57  return *this;
58  }
static PFTauRenderPlugin instance
void write(const std::type_info &sourceType, const void *sourceInstance)
long double T
void cond::RootOutputArchive::write ( const std::type_info &  sourceType,
const void *  sourceInstance 
)
private

Definition at line 38 of file Serialization.cc.

References ora::ClassUtils::demangledName(), cond::lookUpDictionary(), and cond::throwException().

Referenced by pkg.AbstractPkg::generate(), and operator<<().

38  {
39  TClass* r_class = lookUpDictionary( sourceType );
40  if (!r_class) throwException( "No ROOT class registered for \"" + demangledName(sourceType)+"\"", "RootOutputArchive::write");
41  TBufferFile buffer(TBufferFile::kWrite);
42  buffer.InitMap();
43  buffer.StreamObject(const_cast<void*>(sourceInstance), r_class);
44  // copy the stream into the target buffer
45  m_buffer.write( static_cast<const char*>(buffer.Buffer()), buffer.Length() );
46 }
std::ostream & m_buffer
Definition: Serialization.h:52
std::string demangledName(const std::type_info &typeInfo)
Definition: ClassUtils.cc:82
TClass * lookUpDictionary(const std::type_info &sourceType)
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17

Member Data Documentation

std::ostream& cond::RootOutputArchive::m_buffer
private

Definition at line 52 of file Serialization.h.