1 #ifndef CondCore_CondDB_Serialization_h
2 #define CondCore_CondDB_Serialization_h
33 if (userTypeName != payloadTypeName)
35 std::string(
"Type mismatch, user type: \"" + userTypeName +
"\", target type: \"") + payloadTypeName +
"\"",
43 if (payloadTypeName != userTypeName && payloadTypeName !=
"std::string")
54 static constexpr
char const*
ARCH_LABEL =
"architecture";
56 static constexpr
char const*
TECHNOLOGY =
"boost/serialization";
67 std::pair<Binary, Binary>
ret;
71 std::ostringstream dataBuffer;
75 ret.first.copy(dataBuffer.str());
76 ret.second.copy(streamerInfo);
79 throwException(
"Serialization failed: " + em +
". Serialization info:" + streamerInfo,
"serialize");
88 const Binary& streamerInfoData) {
90 std::stringbuf sstreamerInfoBuf;
91 sstreamerInfoBuf.pubsetbuf(static_cast<char*>(const_cast<void*>(streamerInfoData.
data())), streamerInfoData.
size());
94 std::stringbuf sdataBuf;
95 sdataBuf.pubsetbuf(static_cast<char*>(const_cast<void*>(payloadData.
data())), payloadData.
size());
96 std::istream dataBuffer(&sdataBuf);
103 if (em ==
"unsupported version") {
105 ") is unable to read the payload. Data might have been serialized with an incompatible version.";
106 }
else if (em ==
"input stream error") {
107 errorMsg +=
"data size does not fit with the current class layout. The Class " +
payloadType +
108 " might have been changed with respect to the layout used in the upload.";
112 if (!streamerInfo.empty())
113 errorMsg +=
" Payload serialization info: " + streamerInfo;
120 template <
typename T>
122 const Binary& payloadData,
123 const Binary& streamerInfoData) {
124 return default_deserialize<T>(
payloadType, payloadData, streamerInfoData);
129 #define DESERIALIZE_BASE_CASE(BASETYPENAME) \
130 if (payloadType == #BASETYPENAME) { \
131 return default_deserialize<BASETYPENAME>(payloadType, payloadData, streamerInfoData); \
134 #define DESERIALIZE_POLIMORPHIC_CASE(BASETYPENAME, DERIVEDTYPENAME) \
135 if (payloadType == #DERIVEDTYPENAME) { \
136 return default_deserialize<DERIVEDTYPENAME>(payloadType, payloadData, streamerInfoData); \