1 #include <framework/utilities/Stream.h>
3 #include <framework/logging/Logger.h>
9 #include <boost/algorithm/string/replace.hpp>
15 class StreamMsg :
public TMessage {
17 StreamMsg(
const void* buf,
int len) : TMessage(const_cast<void*>(buf), len)
19 this->SetBit(kIsOwner,
false);
27 TMessage::EnableSchemaEvolutionForAll();
29 TMessage msg(kMESS_OBJECT);
36 msg.SetCompressionLevel(0);
42 char* buf = msg.Buffer();
43 UInt_t len = msg.Length();
45 if (msg.CompBuffer()) {
46 B2FATAL(
"compression used, but broken thanks to ROOT");
53 const std::string& encodedStr(TBase64::Encode(buf, len).Data());
60 std::string newString(xmlString);
61 boost::replace_all(newString,
"]]>",
"]]]]><![CDATA[>");
62 return "<![CDATA[" + newString +
"]]>";
67 if (base64Data.empty())
71 const TString& data(TBase64::Decode(base64Data.c_str()));
73 StreamMsg msg(data.Data(), data.Length());
75 if (msg.What() != kMESS_OBJECT or msg.GetClass() ==
nullptr) {
78 auto* obj =
static_cast<TObject*
>(msg.ReadObjectAny(msg.GetClass()));