GRPC C++  0.11.0.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions
grpc::ClientReaderWriter< R, W > Class Template Reference

#include <channel.h>

Public Member Functions

 ClientReaderWriter (Channel *channel, const RpcMethod &method, ClientContext *context)
 Blocking create a stream. More...
 
void WaitForInitialMetadata ()
 Blocking wait for initial metadata from server. More...
 
bool Read (R *msg) GRPC_OVERRIDE
 Blocking read a message and parse to msg. More...
 
bool Write (const W &msg, const WriteOptions &options) GRPC_OVERRIDE
 Blocking write msg to the stream with options. More...
 
bool WritesDone () GRPC_OVERRIDE
 Block until writes are completed. More...
 
Status Finish () GRPC_OVERRIDE
 Wait until the stream finishes, and return the final status. More...
 
- Public Member Functions inherited from grpc::ClientStreamingInterface
virtual ~ClientStreamingInterface ()
 
- Public Member Functions inherited from grpc::WriterInterface< W >
virtual ~WriterInterface ()
 
bool Write (const W &msg)
 Blocking write msg to the stream with default options. More...
 
- Public Member Functions inherited from grpc::ReaderInterface< R >
virtual ~ReaderInterface ()
 

Constructor & Destructor Documentation

template<class R , class W >
grpc::ClientReaderWriter< R, W >::ClientReaderWriter ( Channel channel,
const RpcMethod method,
ClientContext context 
)
inline

Blocking create a stream.

Member Function Documentation

template<class R , class W >
Status grpc::ClientReaderWriter< R, W >::Finish ( )
inlinevirtual

Wait until the stream finishes, and return the final status.

When the client side declares it has no more message to send, either implicitly or by calling WritesDone(), it needs to make sure there is no more message to be received from the server, either implicitly or by getting a false from a Read().

This function will return either:

  • when all incoming messages have been read and the server has returned status.
  • OR when the server has returned a non-OK status.

Implements grpc::ClientStreamingInterface.

template<class R , class W >
bool grpc::ClientReaderWriter< R, W >::Read ( R *  msg)
inlinevirtual

Blocking read a message and parse to msg.

Returns true on success.

Parameters
[out]msgThe read message.
Returns
false when there will be no more incoming messages, either because the other side has called WritesDone() or the stream has failed (or been cancelled).

Implements grpc::ReaderInterface< R >.

template<class R , class W >
void grpc::ClientReaderWriter< R, W >::WaitForInitialMetadata ( )
inlinevirtual

Blocking wait for initial metadata from server.

The received metadata can only be accessed after this call returns. Should only be called before the first read. Calling this method is optional, and if it is not called the metadata will be available in ClientContext after the first read.

Implements grpc::ClientReaderWriterInterface< W, R >.

template<class R , class W >
bool grpc::ClientReaderWriter< R, W >::Write ( const W &  msg,
const WriteOptions options 
)
inlinevirtual

Blocking write msg to the stream with options.

Parameters
msgThe message to be written to the stream.
optionsOptions affecting the write operation.
Returns
true on success, false when the stream has been closed.

Implements grpc::WriterInterface< W >.

template<class R , class W >
bool grpc::ClientReaderWriter< R, W >::WritesDone ( )
inlinevirtual

Block until writes are completed.

Returns
Whether the writes were successful.

Implements grpc::ClientReaderWriterInterface< W, R >.


The documentation for this class was generated from the following files: