1 #ifndef CondCore_CondDB_Serialization_h 2 #define CondCore_CondDB_Serialization_h 32 if( userTypeName != payloadTypeName )
40 if( payloadTypeName != userTypeName && payloadTypeName !=
"std::string" )
63 std::pair<Binary,Binary> ret;
67 std::ostringstream dataBuffer;
68 CondOutputArchive oa( dataBuffer );
71 ret.first.copy( dataBuffer.str() );
72 ret.second.copy( streamerInfo );
75 throwException(
"Serialization failed: "+em+
". Serialization info:"+streamerInfo,
"serialize");
83 const Binary& streamerInfoData ){
85 std::stringbuf sstreamerInfoBuf;
86 sstreamerInfoBuf.pubsetbuf( static_cast<char*>(const_cast<void*>(streamerInfoData.
data())), streamerInfoData.
size() );
89 std::stringbuf sdataBuf;
90 sdataBuf.pubsetbuf( static_cast<char*>(const_cast<void*>(payloadData.
data())), payloadData.
size() );
91 std::istream dataBuffer( &sdataBuf );
92 CondInputArchive ia( dataBuffer );
93 payload.reset( createPayload<T>(payloadType) );
98 if( em ==
"unsupported version" ) {
100 ") is unable to read the payload. Data might have been serialized with an incompatible version.";
101 }
else if( em ==
"input stream error" ) {
102 errorMsg +=
"data size does not fit with the current class layout. The Class "+payloadType+
" might have been changed with respect to the layout used in the upload.";
106 if( !streamerInfo.empty() ) errorMsg +=
" Payload serialization info: "+streamerInfo;
114 const Binary& payloadData,
115 const Binary& streamerInfoData ){
116 return default_deserialize<T>(
payloadType, payloadData, streamerInfoData );
121 #define DESERIALIZE_BASE_CASE( BASETYPENAME ) \ 122 if( payloadType == #BASETYPENAME ){ \ 123 return default_deserialize<BASETYPENAME>( payloadType, payloadData, streamerInfoData ); \ 126 #define DESERIALIZE_POLIMORPHIC_CASE( BASETYPENAME, DERIVEDTYPENAME ) \ 127 if( payloadType == #DERIVEDTYPENAME ){ \ 128 return std::dynamic_pointer_cast<BASETYPENAME>( default_deserialize<DERIVEDTYPENAME>( payloadType, payloadData, streamerInfoData ) ); \ eos::portable_oarchive OutputArchive
static char const * CMSSW_VERSION_LABEL
static std::string techVersion()
std::pair< Binary, Binary > serialize(const T &payload)
static char const * TECH_LABEL
cond::serialization::InputArchive CondInputArchive
eos::portable_iarchive InputArchive
void throwException(const std::string &message, const std::string &methodName)
T * createPayload(const std::string &payloadTypeName)
std::shared_ptr< T > default_deserialize(const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
static char const * TECHNOLOGY
static char const * TECH_VERSION_LABEL
const void * data() const
static std::string jsonString()
cond::serialization::OutputArchive CondOutputArchive
std::shared_ptr< T > deserialize(const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
static char const * ARCH_LABEL