MIRA
Public Types | Public Member Functions | Public Attributes | List of all members
RPCClient::PendingResponse< Backend, R > Struct Template Reference

PendingResponse template class. More...

#include <rpc/RPCClient.h>

Inheritance diagram for RPCClient::PendingResponse< Backend, R >:
Inheritance graph
[legend]

Public Types

typedef Backend::ClientResponse Response
 

Public Member Functions

 PendingResponse ()
 
virtual void handleResponse (void *responsePtr)
 Handles the response by calling getReturn() of the RPCResponse backend. More...
 
virtual void handleServiceRemoved ()
 Handles the service being removed before a response is received. More...
 
virtual int getBackendTypeId () const
 Returns the (non portable) type id of the used backend. More...
 

Public Attributes

boost::promise< R > promise
 The boost::promise object that is used for generating and setting the RPCFuture. More...
 
int backendTypeId
 

Detailed Description

template<typename Backend, typename R>
struct mira::RPCClient::PendingResponse< Backend, R >

PendingResponse template class.

This class has to be a template, since we must handle different response types (e.g. Binary responses, JSON responses, etc) with different return value types (e.g. void, float, etc.). The return types depend on the rpc method that is called. Hence, for each rpc call an PendingResponse object with the matching types is created in the call() method below. This PendingResponse object is responsible for handling the response that is returned by the RPCServer after the call was invoked and processed. The PendingResponse object also holds the boost::promise object that is used to generate the RPCFuture and that is used to set the return value in the handleResponse method.

Member Typedef Documentation

◆ Response

typedef Backend::ClientResponse Response

Constructor & Destructor Documentation

◆ PendingResponse()

PendingResponse ( )
inline

Member Function Documentation

◆ handleResponse()

virtual void handleResponse ( void *  responsePtr)
inlinevirtual

Handles the response by calling getReturn() of the RPCResponse backend.

The getReturn() method will set the value to the promise object (which communicates with the RPCFuture)

Implements RPCClient::PendingResponseBase.

◆ handleServiceRemoved()

virtual void handleServiceRemoved ( )
inlinevirtual

Handles the service being removed before a response is received.

Implements RPCClient::PendingResponseBase.

◆ getBackendTypeId()

virtual int getBackendTypeId ( ) const
inlinevirtual

Returns the (non portable) type id of the used backend.

It is used by RPCClient::handleResponse() for type checking where it is compared with the type of the actually received response.

Implements RPCClient::PendingResponseBase.

Member Data Documentation

◆ promise

boost::promise<R> promise

The boost::promise object that is used for generating and setting the RPCFuture.

◆ backendTypeId

int backendTypeId

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