GRPC C++  1.66.0
Public Member Functions | Friends
grpc::ServerReaderWriter< W, R > Class Template Referencefinal

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

#include <sync_stream.h>

Public Member Functions

void SendInitialMetadata () override
 See the ServerStreamingInterface.SendInitialMetadata method for semantics. 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
 Block to read a message and parse to msg. More...
 
bool Write (const W &msg, grpc::WriteOptions options) override
 Block to write msg to the stream with WriteOptions options. More...
 
- Public Member Functions inherited from grpc::internal::ServerStreamingInterface
virtual ~ServerStreamingInterface ()
 
- Public Member Functions inherited from grpc::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::internal::ReaderInterface< R >
virtual ~ReaderInterface ()
 

Friends

class internal::TemplatedBidiStreamingHandler< ServerReaderWriter< W, R >, false >
 

Detailed Description

template<class W, class R>
class grpc::ServerReaderWriter< W, R >

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

Member Function Documentation

◆ NextMessageSize()

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

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

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

◆ Read()

template<class W , class R >
bool grpc::ServerReaderWriter< W, R >::Read ( R *  msg)
inlineoverridevirtual

Block to read a message and parse to msg.

Returns true on success. This is thread-safe with respect to Write or \WritesDone methods on the same stream. It should not be called concurrently with another Read on the same stream as the order of delivery will not be defined.

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::internal::ReaderInterface< R >.

◆ SendInitialMetadata()

template<class W , class R >
void grpc::ServerReaderWriter< W, R >::SendInitialMetadata ( )
inlineoverridevirtual

See the ServerStreamingInterface.SendInitialMetadata method for semantics.

Note that initial metadata will be affected by the ServerContext associated with this call.

Implements grpc::internal::ServerStreamingInterface.

◆ Write()

template<class W , class R >
bool grpc::ServerReaderWriter< 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::internal::WriterInterface< W >.

Friends And Related Function Documentation

◆ internal::TemplatedBidiStreamingHandler< ServerReaderWriter< W, R >, false >

template<class W , class R >
friend class internal::TemplatedBidiStreamingHandler< ServerReaderWriter< W, R >, false >
friend

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