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" 27 void marshall(
const T& obj, std::vector<char>& b) {
28 std::vector<char> msg(obj.ByteSize());
29 obj.SerializeToArray(msg.data(),obj.ByteSize());
31 wm.set_wrappedmessagebytes(msg.data(), msg.size());
32 wm.set_wrappeddescriptorid(TypeId);
33 b.resize(wm.ByteSize());
34 wm.SerializeToArray(b.data(),wm.ByteSize());
37 T* unmarshall(
const std::vector<char>& b) {
39 wm.ParseFromArray(b.data(),b.size());
40 const std::string &wmb=wm.wrappedmessagebytes();
42 bt->ParseFromArray(wmb.data(),wmb.size());
48 template <
class T>
class ProtoStreamMarshallerHelper {
50 static void noRelease(std::vector<char>*) { }
52 static void release(std::vector<char> *buf) {
55 static T unmarshall(
char *b,
size_t size) {
57 wm.ParseFromArray(b, size);
58 const std::string &wmb=wm.wrappedmessagebytes();
60 bt.ParseFromArray(wmb.data(),wmb.size());
Definition: ProtoStreamMarshaller.h:26
Definition: AuthenticationConfiguration.h:10
Definition: Marshaller.h:12