GRPC C++  1.24.0
Public Member Functions | Friends
grpc_impl::ClientReaderWriter< W, R > Class Template Reference

Synchronous (blocking) client-side API for bi-directional streaming RPCs, where the outgoing message stream coming from the client has messages of type W, and the incoming messages stream coming from the server has messages of type R. More...

#include <channel_interface.h>

Public Member Functions

void WaitForInitialMetadata () override
 Block waiting to read initial metadata from the server. More...
 
bool NextMessageSize (uint32_t *sz) override
 Get an upper bound on the next message size available for reading on this stream. More...
 
bool Read (R *msg) override
 See the ReaderInterface.Read method for semantics. More...
 
bool Write (const W &msg, ::grpc::WriteOptions options) override
 Block to write msg to the stream with WriteOptions options. More...
 
bool WritesDone () override
 Half close writing from the client. More...
 
::grpc::Status Finish () override
 See the ClientStreamingInterface.Finish method for semantics. More...
 
- Public Member Functions inherited from grpc_impl::internal::ClientStreamingInterface
virtual ~ClientStreamingInterface ()
 
- Public Member Functions inherited from grpc_impl::internal::WriterInterface< W >
virtual ~WriterInterface ()
 
bool Write (const W &msg)
 Block to write msg to the stream with default write options. More...
 
void WriteLast (const W &msg, ::grpc::WriteOptions options)
 Write msg and coalesce it with the writing of trailing metadata, using WriteOptions options. More...
 
- Public Member Functions inherited from grpc_impl::internal::ReaderInterface< R >
virtual ~ReaderInterface ()
 

Friends

class internal::ClientReaderWriterFactory< W, R >
 

Detailed Description

template<class W, class R>
class grpc_impl::ClientReaderWriter< W, R >

Synchronous (blocking) client-side API for bi-directional streaming RPCs, where the outgoing message stream coming from the client has messages of type W, and the incoming messages stream coming from the server has messages of type R.

Member Function Documentation

◆ Finish()

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

See the ClientStreamingInterface.Finish method for semantics.

Side effect:

  • the ClientContext associated with this call is updated with possible trailing metadata sent from the server.

Implements grpc_impl::internal::ClientStreamingInterface.

◆ NextMessageSize()

template<class W, class R>
bool grpc_impl::ClientReaderWriter< W, R >::NextMessageSize ( uint32_t *  sz)
inlineoverridevirtual

Get an upper bound on the next message size available for reading on this stream.

Implements grpc_impl::internal::ReaderInterface< R >.

◆ Read()

template<class W, class R>
bool grpc_impl::ClientReaderWriter< W, R >::Read ( R *  msg)
inlineoverridevirtual

See the ReaderInterface.Read method for semantics.

Side effect: Also receives initial metadata if not already received (updates the ClientContext associated with this call in that case).

Implements grpc_impl::internal::ReaderInterface< R >.

◆ WaitForInitialMetadata()

template<class W, class R>
void grpc_impl::ClientReaderWriter< W, R >::WaitForInitialMetadata ( )
inlineoverridevirtual

Block waiting to read initial metadata from the server.

This call is optional, but if it is used, it cannot be used concurrently with or after the Finish method.

Once complete, the initial metadata read from the server will be accessible through the ClientContext used to construct this object.

Implements grpc_impl::ClientReaderWriterInterface< W, R >.

◆ Write()

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

Block to write msg to the stream with WriteOptions options.

This is thread-safe with respect to ReaderInterface::Read

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

Implements grpc_impl::internal::WriterInterface< W >.

◆ WritesDone()

template<class W, class R>
bool grpc_impl::ClientReaderWriter< W, R >::WritesDone ( )
inlineoverridevirtual

Half close writing from the client.

(signal that the stream of messages coming from the clinet is complete). Blocks until currently-pending writes are completed. Thread-safe with respect to ReaderInterface::Read

Returns
Whether the writes were successful.

Implements grpc_impl::ClientReaderWriterInterface< W, R >.

Friends And Related Function Documentation

◆ internal::ClientReaderWriterFactory< W, R >

template<class W, class R>
friend class internal::ClientReaderWriterFactory< W, R >
friend

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