1 #ifndef CondCore_CondDB_Serialization_h
2 #define CondCore_CondDB_Serialization_h
23 #include <boost/shared_ptr.hpp>
34 if( userTypeName != payloadTypeName )
51 void write(
const std::type_info& sourceType,
const void* sourceInstance);
59 write(
typeid(
T), &instance );
66 RootInputArchive( std::istream& binaryData, std::istream& binaryStreamerInfo );
74 void read(
const std::type_info& destinationType,
void* destinationInstance);
83 read(
typeid(
T), &instance );
92 template <
typename T> std::pair<Binary,Binary>
serialize(
const T& payload,
bool packingOnly =
false ){
93 std::pair<Binary,Binary>
ret;
96 std::ostringstream dataBuffer;
97 std::ostringstream streamerInfoBuffer;
101 ret.first.copy( dataBuffer.str() );
102 ret.second.copy( streamerInfoBuffer.str() );
105 ret.first =
Binary( payload );
113 const Binary& payloadData,
114 const Binary& streamerInfoData,
115 bool unpackingOnly =
false){
117 boost::shared_ptr<T> payload;
118 if( !unpackingOnly ){
119 std::stringbuf sdataBuf;
120 sdataBuf.pubsetbuf( static_cast<char*>(const_cast<void*>(payloadData.
data())), payloadData.
size() );
121 std::stringbuf sstreamerInfoBuf;
122 sstreamerInfoBuf.pubsetbuf( static_cast<char*>(const_cast<void*>(streamerInfoData.
data())), streamerInfoData.
size() );
124 std::istream dataBuffer( &sdataBuf );
125 std::istream streamerInfoBuffer( &sstreamerInfoBuf );
127 payload.reset( createPayload<T>(payloadType) );
eos::portable_oarchive OutputArchive
boost::shared_ptr< void > makeShared() const
static PFTauRenderPlugin instance
cond::serialization::InputArchive CondInputArchive
eos::portable_iarchive InputArchive
std::ostream & m_streamerInfoBuffer
RootOutputArchive(std::ostream &dataDest, std::ostream &streamerInfoDest)
std::string demangledName(const std::type_info &typeInfo)
void write(const std::type_info &sourceType, const void *sourceInstance)
T * createPayload(const std::string &payloadTypeName)
ora::Object oraObject() const
const void * data() const
RootOutputArchive & operator<<(const T &instance)
cond::serialization::OutputArchive CondOutputArchive
void throwException(std::string const &message, std::string const &methodName)
boost::shared_ptr< T > deserialize(const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData, bool unpackingOnly=false)
std::pair< Binary, Binary > serialize(const T &payload, bool packingOnly=false)
std::ostream & m_dataBuffer