Moving ZeroCopyOutputStream to grpc++/config.h.

pull/1032/head
Nicolas "Pixel" Noble 10 years ago
parent d446eb86fa
commit 613d6fe997
  1. 14
      include/grpc++/config.h
  2. 3
      src/compiler/config.h
  3. 5
      src/cpp/proto/proto_utils.cc

@ -52,12 +52,26 @@
#define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message #define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message
#endif #endif
#ifndef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM
#include <google/protobuf/io/zero_copy_stream.h>
#define GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ::google::protobuf::io::ZeroCopyOutputStream
#define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ::google::protobuf::io::ZeroCopyInputStream
#endif
namespace grpc { namespace grpc {
typedef GRPC_CUSTOM_STRING string; typedef GRPC_CUSTOM_STRING string;
namespace protobuf { namespace protobuf {
typedef GRPC_CUSTOM_MESSAGE Message; typedef GRPC_CUSTOM_MESSAGE Message;
namespace io {
typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream;
typedef GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream;
} // namespace io
} // namespace protobuf } // namespace protobuf
} // namespace grpc } // namespace grpc

@ -54,12 +54,10 @@
#ifndef GRPC_CUSTOM_PRINTER #ifndef GRPC_CUSTOM_PRINTER
#include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/printer.h> #include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h> #include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#define GRPC_CUSTOM_PRINTER ::google::protobuf::io::Printer #define GRPC_CUSTOM_PRINTER ::google::protobuf::io::Printer
#define GRPC_CUSTOM_CODEDOUTPUTSTREAM ::google::protobuf::io::CodedOutputStream #define GRPC_CUSTOM_CODEDOUTPUTSTREAM ::google::protobuf::io::CodedOutputStream
#define GRPC_CUSTOM_STRINGOUTPUTSTREAM ::google::protobuf::io::StringOutputStream #define GRPC_CUSTOM_STRINGOUTPUTSTREAM ::google::protobuf::io::StringOutputStream
#define GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ::google::protobuf::io::ZeroCopyOutputStream
#endif #endif
#ifndef GRPC_CUSTOM_PLUGINMAIN #ifndef GRPC_CUSTOM_PLUGINMAIN
@ -85,7 +83,6 @@ namespace io {
typedef GRPC_CUSTOM_PRINTER Printer; typedef GRPC_CUSTOM_PRINTER Printer;
typedef GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream; typedef GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream;
typedef GRPC_CUSTOM_STRINGOUTPUTSTREAM StringOutputStream; typedef GRPC_CUSTOM_STRINGOUTPUTSTREAM StringOutputStream;
typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream;
} // namespace io } // namespace io
} // namespace protobuf } // namespace protobuf
} // namespace grpc } // namespace grpc

@ -39,12 +39,11 @@
#include <grpc/support/slice.h> #include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h> #include <grpc/support/slice_buffer.h>
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
#include <google/protobuf/io/zero_copy_stream.h>
const int kMaxBufferLength = 8192; const int kMaxBufferLength = 8192;
class GrpcBufferWriter GRPC_FINAL class GrpcBufferWriter GRPC_FINAL
: public ::google::protobuf::io::ZeroCopyOutputStream { : public ::grpc::protobuf::io::ZeroCopyOutputStream {
public: public:
explicit GrpcBufferWriter(grpc_byte_buffer **bp, explicit GrpcBufferWriter(grpc_byte_buffer **bp,
int block_size = kMaxBufferLength) int block_size = kMaxBufferLength)
@ -97,7 +96,7 @@ class GrpcBufferWriter GRPC_FINAL
}; };
class GrpcBufferReader GRPC_FINAL class GrpcBufferReader GRPC_FINAL
: public ::google::protobuf::io::ZeroCopyInputStream { : public ::grpc::protobuf::io::ZeroCopyInputStream {
public: public:
explicit GrpcBufferReader(grpc_byte_buffer *buffer) explicit GrpcBufferReader(grpc_byte_buffer *buffer)
: byte_count_(0), backup_count_(0) { : byte_count_(0), backup_count_(0) {

Loading…
Cancel
Save