From 613d6fe997c8744f76f23a5819f6613ec3b288c2 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 13 Mar 2015 18:36:39 +0100 Subject: [PATCH] Moving ZeroCopyOutputStream to grpc++/config.h. --- include/grpc++/config.h | 14 ++++++++++++++ src/compiler/config.h | 3 --- src/cpp/proto/proto_utils.cc | 5 ++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 327ed7a549a..fd7672784b0 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -52,12 +52,26 @@ #define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message #endif +#ifndef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM +#include +#define GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ::google::protobuf::io::ZeroCopyOutputStream +#define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ::google::protobuf::io::ZeroCopyInputStream +#endif + + namespace grpc { typedef GRPC_CUSTOM_STRING string; namespace protobuf { + typedef GRPC_CUSTOM_MESSAGE Message; + +namespace io { +typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream; +typedef GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream; +} // namespace io + } // namespace protobuf } // namespace grpc diff --git a/src/compiler/config.h b/src/compiler/config.h index dc8803ceab5..e81de8d6c8f 100644 --- a/src/compiler/config.h +++ b/src/compiler/config.h @@ -54,12 +54,10 @@ #ifndef GRPC_CUSTOM_PRINTER #include #include -#include #include #define GRPC_CUSTOM_PRINTER ::google::protobuf::io::Printer #define GRPC_CUSTOM_CODEDOUTPUTSTREAM ::google::protobuf::io::CodedOutputStream #define GRPC_CUSTOM_STRINGOUTPUTSTREAM ::google::protobuf::io::StringOutputStream -#define GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ::google::protobuf::io::ZeroCopyOutputStream #endif #ifndef GRPC_CUSTOM_PLUGINMAIN @@ -85,7 +83,6 @@ namespace io { typedef GRPC_CUSTOM_PRINTER Printer; typedef GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream; typedef GRPC_CUSTOM_STRINGOUTPUTSTREAM StringOutputStream; -typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream; } // namespace io } // namespace protobuf } // namespace grpc diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index e4e51bfebf5..acd204bf9b6 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -39,12 +39,11 @@ #include #include #include -#include const int kMaxBufferLength = 8192; class GrpcBufferWriter GRPC_FINAL - : public ::google::protobuf::io::ZeroCopyOutputStream { + : public ::grpc::protobuf::io::ZeroCopyOutputStream { public: explicit GrpcBufferWriter(grpc_byte_buffer **bp, int block_size = kMaxBufferLength) @@ -97,7 +96,7 @@ class GrpcBufferWriter GRPC_FINAL }; class GrpcBufferReader GRPC_FINAL - : public ::google::protobuf::io::ZeroCopyInputStream { + : public ::grpc::protobuf::io::ZeroCopyInputStream { public: explicit GrpcBufferReader(grpc_byte_buffer *buffer) : byte_count_(0), backup_count_(0) {