diff options
author | ncteisen <ncteisen@gmail.com> | 2018-04-12 17:19:54 -0700 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2018-04-12 17:19:54 -0700 |
commit | 92c4e0fee099b797bb7355b316af6b31e9d35ed3 (patch) | |
tree | 4bfe23ef929f74de11d22f7d958a43de99b4a2cc /include | |
parent | 6d3e7f7cd4ea286ab6b22c9f3da44839fa4357e3 (diff) |
Rename ProtoBuffer helpers
Diffstat (limited to 'include')
-rw-r--r-- | include/grpcpp/impl/codegen/byte_buffer.h | 4 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/proto_buffer_reader.h | 6 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/proto_buffer_writer.h | 13 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/proto_utils.h | 7 |
4 files changed, 14 insertions, 16 deletions
diff --git a/include/grpcpp/impl/codegen/byte_buffer.h b/include/grpcpp/impl/codegen/byte_buffer.h index fda13a04e6..86c047ebe7 100644 --- a/include/grpcpp/impl/codegen/byte_buffer.h +++ b/include/grpcpp/impl/codegen/byte_buffer.h @@ -146,8 +146,8 @@ class ByteBuffer final { friend class internal::ServerStreamingHandler; template <class R> friend class internal::DeserializeFuncType; - friend class GrpcProtoBufferReader; - friend class GrpcProtoBufferWriter; + friend class ProtoBufferReader; + friend class ProtoBufferWriter; friend class internal::GrpcByteBufferPeer; grpc_byte_buffer* buffer_; diff --git a/include/grpcpp/impl/codegen/proto_buffer_reader.h b/include/grpcpp/impl/codegen/proto_buffer_reader.h index 149e05c74f..9acae476b1 100644 --- a/include/grpcpp/impl/codegen/proto_buffer_reader.h +++ b/include/grpcpp/impl/codegen/proto_buffer_reader.h @@ -43,11 +43,11 @@ extern CoreCodegenInterface* g_core_codegen_interface; /// /// Read more about ZeroCopyInputStream interface here: /// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyInputStream -class GrpcProtoBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream { +class ProtoBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream { public: /// Constructs buffer reader from \a buffer. Will set \a status() to non ok /// if \a buffer is invalid (the internal buffer has not been initialized). - explicit GrpcProtoBufferReader(ByteBuffer* buffer) + explicit ProtoBufferReader(ByteBuffer* buffer) : byte_count_(0), backup_count_(0), status_() { /// Implemented through a grpc_byte_buffer_reader which iterates /// over the slices that make up a byte buffer @@ -59,7 +59,7 @@ class GrpcProtoBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream { } } - ~GrpcProtoBufferReader() { + ~ProtoBufferReader() { if (status_.ok()) { g_core_codegen_interface->grpc_byte_buffer_reader_destroy(&reader_); } diff --git a/include/grpcpp/impl/codegen/proto_buffer_writer.h b/include/grpcpp/impl/codegen/proto_buffer_writer.h index faf99800cd..fdff4676b0 100644 --- a/include/grpcpp/impl/codegen/proto_buffer_writer.h +++ b/include/grpcpp/impl/codegen/proto_buffer_writer.h @@ -38,10 +38,10 @@ extern CoreCodegenInterface* g_core_codegen_interface; // Forward declaration for testing use only namespace internal { -class GrpcProtoBufferWriterPeer; +class ProtoBufferWriterPeer; } // namespace internal -const int kGrpcProtoBufferWriterMaxBufferLength = 1024 * 1024; +const int kProtoBufferWriterMaxBufferLength = 1024 * 1024; /// This is a specialization of the protobuf class ZeroCopyOutputStream. /// The principle is to give the proto layer one buffer of bytes at a time @@ -50,15 +50,14 @@ const int kGrpcProtoBufferWriterMaxBufferLength = 1024 * 1024; /// /// Read more about ZeroCopyOutputStream interface here: /// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyOutputStream -class GrpcProtoBufferWriter - : public ::grpc::protobuf::io::ZeroCopyOutputStream { +class ProtoBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream { public: /// Constructor for this derived class /// /// \param[out] byte_buffer A pointer to the grpc::ByteBuffer created /// \param block_size How big are the chunks to allocate at a time /// \param total_size How many total bytes are required for this proto - GrpcProtoBufferWriter(ByteBuffer* byte_buffer, int block_size, int total_size) + ProtoBufferWriter(ByteBuffer* byte_buffer, int block_size, int total_size) : block_size_(block_size), total_size_(total_size), byte_count_(0), @@ -71,7 +70,7 @@ class GrpcProtoBufferWriter slice_buffer_ = &bp->data.raw.slice_buffer; } - ~GrpcProtoBufferWriter() { + ~ProtoBufferWriter() { if (have_backup_) { g_core_codegen_interface->grpc_slice_unref(backup_slice_); } @@ -151,7 +150,7 @@ class GrpcProtoBufferWriter private: // friend for testing purposes only - friend class internal::GrpcProtoBufferWriterPeer; + friend class internal::ProtoBufferWriterPeer; const int block_size_; ///< size to alloc for each new \a grpc_slice needed const int total_size_; ///< byte size of proto being serialized int64_t byte_count_; ///< bytes written since this object was created diff --git a/include/grpcpp/impl/codegen/proto_utils.h b/include/grpcpp/impl/codegen/proto_utils.h index ec1dccaa74..d9db6de05c 100644 --- a/include/grpcpp/impl/codegen/proto_utils.h +++ b/include/grpcpp/impl/codegen/proto_utils.h @@ -60,8 +60,7 @@ Status GenericSerialize(const grpc::protobuf::Message& msg, ByteBuffer* bb, return g_core_codegen_interface->ok(); } - ProtoBufferWriter writer(bb, kGrpcProtoBufferWriterMaxBufferLength, - byte_size); + ProtoBufferWriter writer(bb, kProtoBufferWriterMaxBufferLength, byte_size); return msg.SerializeToZeroCopyStream(&writer) ? g_core_codegen_interface->ok() : Status(StatusCode::INTERNAL, "Failed to serialize message"); @@ -108,11 +107,11 @@ class SerializationTraits<T, typename std::enable_if<std::is_base_of< public: static Status Serialize(const grpc::protobuf::Message& msg, ByteBuffer* bb, bool* own_buffer) { - return GenericSerialize<GrpcProtoBufferWriter, T>(msg, bb, own_buffer); + return GenericSerialize<ProtoBufferWriter, T>(msg, bb, own_buffer); } static Status Deserialize(ByteBuffer* buffer, grpc::protobuf::Message* msg) { - return GenericDeserialize<GrpcProtoBufferReader, T>(buffer, msg); + return GenericDeserialize<ProtoBufferReader, T>(buffer, msg); } }; #endif |