8 #ifndef ROOTSERIALIZER_H
9 #define ROOTSERIALIZER_H
11 #include <FairMQMessage.h>
12 #include <TClonesArray.h>
35 TMessage* tm =
new TMessage(kMESS_OBJECT);
36 tm->WriteObject(input);
38 tm->Buffer(), tm->BufferSize(), [](
void*,
void* tmsg) {
delete static_cast<TMessage*
>(tmsg); }, tm);
42 void Serialize(FairMQMessage& msg,
const std::unique_ptr<T>& input)
44 TMessage* tm =
new TMessage(kMESS_OBJECT);
45 tm->WriteObject(input.get());
47 tm->Buffer(), tm->BufferSize(), [](
void*,
void* tmsg) {
delete static_cast<TMessage*
>(tmsg); }, tm);
55 output =
static_cast<T*
>(tm.ReadObjectAny(tm.GetClass()));
59 void Deserialize(FairMQMessage& msg, std::unique_ptr<T>& output)
62 output.reset(static_cast<T*>(tm.ReadObjectAny(tm.GetClass())));
FairTMessage(void *buf, Int_t len)
virtual ~RootSerializer()=default
void Serialize(FairMQMessage &msg, const std::unique_ptr< T > &input)
void Serialize(FairMQMessage &msg, T *input)
void Deserialize(FairMQMessage &msg, T *&output)
void Deserialize(FairMQMessage &msg, std::unique_ptr< T > &output)