1 #ifndef ISPN_HOTROD_BASICTYPESPROTOSTREAMMARSHALLER_H 2 #define ISPN_HOTROD_BASICTYPESPROTOSTREAMMARSHALLER_H 11 #pragma warning(disable:4267 4244) 13 #include "infinispan/hotrod/base_types.pb.h" 27 class BasicTypesProtoStreamMarshallerHelper {
29 static void noRelease(std::vector<char>*) { }
30 static void release(std::vector<char> *buf) {
33 template <
class T>
static T unmarshall(
char *,
size_t size);
36 template <>
inline std::string BasicTypesProtoStreamMarshallerHelper::unmarshall(
char *b,
size_t size) {
37 protobuf::base_types bt;
38 bt.ParseFromArray(b,size);
42 template <>
inline int BasicTypesProtoStreamMarshallerHelper::unmarshall(
char *b,
size_t size) {
43 protobuf::base_types bt;
44 bt.ParseFromArray(b,size);
55 void marshall(
const std::string& s, std::vector<char>& b) {
56 protobuf::base_types bt;
58 b.resize(bt.ByteSize());
59 bt.SerializePartialToArray(b.data(),bt.ByteSize());
62 std::string* unmarshall(
const std::vector<char>& b) {
63 protobuf::base_types bt;
64 bt.ParseFromArray(b.data(),b.size());
65 return new std::string(bt.str());
75 void marshall(
const int& s, std::vector<char>& b) {
76 protobuf::base_types bt;
78 b.resize(bt.ByteSize());
79 bt.SerializePartialToArray(b.data(),bt.ByteSize());
82 int* unmarshall(
const std::vector<char>& b) {
83 protobuf::base_types bt;
84 bt.ParseFromArray(b.data(),b.size());
85 return new int(bt.i32());
Definition: AuthenticationConfiguration.h:10
Definition: Marshaller.h:12