diff options
Diffstat (limited to 'include/grpc++/impl/proto_utils.h')
-rw-r--r-- | include/grpc++/impl/proto_utils.h | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/include/grpc++/impl/proto_utils.h b/include/grpc++/impl/proto_utils.h index 283e33486d..9124001e20 100644 --- a/include/grpc++/impl/proto_utils.h +++ b/include/grpc++/impl/proto_utils.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,43 +34,6 @@ #ifndef GRPC_INTERNAL_CPP_PROTO_PROTO_UTILS_H #define GRPC_INTERNAL_CPP_PROTO_PROTO_UTILS_H -#include <type_traits> - -#include <grpc/grpc.h> -#include <grpc++/impl/serialization_traits.h> -#include <grpc++/support/config_protobuf.h> -#include <grpc++/support/status.h> - -namespace grpc { - -// Serialize the msg into a buffer created inside the function. The caller -// should destroy the returned buffer when done with it. If serialization fails, -// false is returned and buffer is left unchanged. -Status SerializeProto(const grpc::protobuf::Message& msg, - grpc_byte_buffer** buffer); - -// The caller keeps ownership of buffer and msg. -Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, - int max_message_size); - -template <class T> -class SerializationTraits<T, typename std::enable_if<std::is_base_of< - grpc::protobuf::Message, T>::value>::type> { - public: - static Status Serialize(const grpc::protobuf::Message& msg, - grpc_byte_buffer** buffer, bool* own_buffer) { - *own_buffer = true; - return SerializeProto(msg, buffer); - } - static Status Deserialize(grpc_byte_buffer* buffer, - grpc::protobuf::Message* msg, - int max_message_size) { - auto status = DeserializeProto(buffer, msg, max_message_size); - grpc_byte_buffer_destroy(buffer); - return status; - } -}; - -} // namespace grpc +#include <grpc++/impl/codegen/proto_utils.h> #endif // GRPC_INTERNAL_CPP_PROTO_PROTO_UTILS_H |