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")
67 std::pair<Binary, Binary>
ret;
71 std::ostringstream dataBuffer;
72 CondOutputArchive oa(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);
97 CondInputArchive ia(dataBuffer);
98 payload.reset(createPayload<T>(payloadType));
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); \ eos::portable_oarchive OutputArchive
std::pair< Binary, Binary > serialize(const T &payload)
static char const * CMSSW_VERSION_LABEL
static std::string techVersion()
ret
prodAgent to be discontinued
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::unique_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
static char const * ARCH_LABEL
std::unique_ptr< T > deserialize(const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)