1#ifndef ISPN_HOTROD_PROTOSTREAMMARSHALLER_H
2#define ISPN_HOTROD_PROTOSTREAMMARSHALLER_H
11#pragma warning(disable:4267 4244)
13#include "infinispan/hotrod/message-wrapping.pb.h"
18using namespace org::infinispan::protostream;
27 void marshall(
const T& obj, std::vector<char>& b) {
28#if GOOGLE_PROTOBUF_VERSION < 3004001
29 std::vector<char> msg(obj.ByteSize());
30 obj.SerializeToArray(msg.data(),obj.ByteSize());
32 std::vector<char> msg(obj.ByteSizeLong());
33 obj.SerializeToArray(msg.data(),obj.ByteSizeLong());
36 wm.set_wrappedmessagebytes(msg.data(), msg.size());
37 wm.set_wrappeddescriptorid(TypeId);
38#if GOOGLE_PROTOBUF_VERSION < 3004001
39 b.resize(wm.ByteSize());
40 wm.SerializeToArray(b.data(),wm.ByteSize());
42 b.resize(wm.ByteSizeLong());
43 wm.SerializeToArray(b.data(),wm.ByteSizeLong());
47 T* unmarshall(
const std::vector<char>& b) {
49 wm.ParseFromArray(b.data(),b.size());
50 const std::string &wmb=wm.wrappedmessagebytes();
52 bt->ParseFromArray(wmb.data(),wmb.size());
58template <
class T>
class ProtoStreamMarshallerHelper {
60 static void noRelease(std::vector<char>*) { }
62 static void release(std::vector<char> *buf) {
65 static T unmarshall(
char *b,
size_t size) {
67 wm.ParseFromArray(b, size);
68 const std::string &wmb=wm.wrappedmessagebytes();
70 bt.ParseFromArray(wmb.data(),wmb.size());
Definition: Marshaller.h:13
Definition: ProtoStreamMarshaller.h:26
Definition: AuthenticationConfiguration.h:10