From e0705e2dc258e0679e249f488f3ac7a59d34e762 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 19 Aug 2016 15:13:43 -0700 Subject: Add ServerReaderWriterInterface --- include/grpc++/impl/codegen/sync_stream.h | 36 +++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'include/grpc++') diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index b2b972760d..36518abb78 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -64,6 +64,14 @@ class ClientStreamingInterface { virtual Status Finish() = 0; }; +/// Common interface for all synchronous server side streaming. +class ServerStreamingInterface { + public: + virtual ~ServerStreamingInterface() {} + + virtual void SendInitialMetadata() = 0; +}; + /// An interface that yields a sequence of messages of type \a R. template class ReaderInterface { @@ -336,12 +344,17 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface { Call call_; }; +/// Server-side interface for streaming reads of message of type \a R. +template +class ServerReaderInterface : public ServerStreamingInterface, + public ReaderInterface {}; + template -class ServerReader GRPC_FINAL : public ReaderInterface { +class ServerReader GRPC_FINAL : public ServerReaderInterface { public: ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} - void SendInitialMetadata() { + void SendInitialMetadata() GRPC_OVERRIDE { GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); CallOpSet ops; @@ -367,12 +380,17 @@ class ServerReader GRPC_FINAL : public ReaderInterface { ServerContext* const ctx_; }; +/// Server-side interface for streaming writes of message of type \a W. template -class ServerWriter GRPC_FINAL : public WriterInterface { +class ServerWriterInterface : public ServerStreamingInterface, + public WriterInterface {}; + +template +class ServerWriter GRPC_FINAL : public ServerWriterInterface { public: ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} - void SendInitialMetadata() { + void SendInitialMetadata() GRPC_OVERRIDE { GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); CallOpSet ops; @@ -411,12 +429,16 @@ class ServerWriter GRPC_FINAL : public WriterInterface { /// Server-side interface for bi-directional streaming. template -class ServerReaderWriter GRPC_FINAL : public WriterInterface, - public ReaderInterface { +class ServerReaderWriterInterface : public ServerStreamingInterface, + public WriterInterface, + public ReaderInterface {}; + +template +class ServerReaderWriter GRPC_FINAL : public ServerReaderWriterInterface { public: ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} - void SendInitialMetadata() { + void SendInitialMetadata() GRPC_OVERRIDE { GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); CallOpSet ops; -- cgit v1.2.3 From 59e835d43189722e9e84db12ea067001c521c98d Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 19 Aug 2016 15:23:23 -0700 Subject: Add comments --- include/grpc++/impl/codegen/sync_stream.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/grpc++') diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index 36518abb78..7601ceae92 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -69,6 +69,7 @@ class ServerStreamingInterface { public: virtual ~ServerStreamingInterface() {} + /// Blocking send initial metadata to client. virtual void SendInitialMetadata() = 0; }; -- cgit v1.2.3 From bb04734eecc84eb7a2acde8e8ba77e5ae2cbe4fd Mon Sep 17 00:00:00 2001 From: Takuto Ikuta Date: Mon, 4 Jul 2016 13:12:59 +0900 Subject: Fix a typo --- include/grpc++/impl/codegen/client_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/grpc++') diff --git a/include/grpc++/impl/codegen/client_context.h b/include/grpc++/impl/codegen/client_context.h index 012bcc2bbe..fb10a3be1a 100644 --- a/include/grpc++/impl/codegen/client_context.h +++ b/include/grpc++/impl/codegen/client_context.h @@ -271,7 +271,7 @@ class ClientContext { /// Set \a algorithm to be the compression algorithm used for the client call. /// - /// \param algorith The compression algorithm used for the client call. + /// \param algorithm The compression algorithm used for the client call. void set_compression_algorithm(grpc_compression_algorithm algorithm); /// Return the peer uri in a string. -- cgit v1.2.3 From c0080b7c92c1692ffa4acf101b9815ef3a05a810 Mon Sep 17 00:00:00 2001 From: Takuto Ikuta Date: Wed, 24 Aug 2016 16:53:23 +0900 Subject: remove docstring for not existing argument --- include/grpc++/create_channel.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/grpc++') diff --git a/include/grpc++/create_channel.h b/include/grpc++/create_channel.h index e9ccb51503..0537695ed2 100644 --- a/include/grpc++/create_channel.h +++ b/include/grpc++/create_channel.h @@ -48,7 +48,6 @@ namespace grpc { /// \param target The URI of the endpoint to connect to. /// \param creds Credentials to use for the created channel. If it does not hold /// an object or is invalid, a lame channel is returned. -/// \param args Options for channel creation. std::shared_ptr CreateChannel( const grpc::string& target, const std::shared_ptr& creds); -- cgit v1.2.3