Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | List of all members
ola::rpc::RpcController Class Reference

Detailed Description

A RpcController object is passed every time an RPC is invoked and is used to indicate the success or failure of the RPC.

On the client side, the controller can is used once the callback completes to check the outcome of the RPC with Failed(). If the RPC failed, a description of the error is available by calling ErrorText().

On the server side, the server can fail the RPC by calling SetFailed(...).

Public Member Functions

 RpcController (RpcSession *session=NULL)
 Create a new RpcController. More...
 
void Reset ()
 Reset the state of this controller. Does not affect the session.
 
bool Failed () const
 Check if the RPC call this controller was associated with failed. More...
 
std::string ErrorText () const
 Return the error string if the RPC failed. More...
 
void SetFailed (const std::string &reason)
 Mark this RPC as failed. More...
 
RpcSessionSession ()
 Get the session information for this RPC. More...
 

Constructor & Destructor Documentation

ola::rpc::RpcController::RpcController ( RpcSession session = NULL)
explicit

Create a new RpcController.

Parameters
sessionthe RpcSession to use. Ownership is not transferred.

Member Function Documentation

std::string ola::rpc::RpcController::ErrorText ( ) const
inline

Return the error string if the RPC failed.

Returns
the error text, or the empty string if the RPC succeeded.
bool ola::rpc::RpcController::Failed ( ) const
inline

Check if the RPC call this controller was associated with failed.

Returns
true if the RPC failed, false if the RPC succeeded.
RpcSession * ola::rpc::RpcController::Session ( )

Get the session information for this RPC.

Unless specifically provided, the session be NULL on the client side.

Returns
the RpcSession object, ownership is not transferred.
void ola::rpc::RpcController::SetFailed ( const std::string &  reason)

Mark this RPC as failed.

Parameters
reasonthe string to return in ErrorText().

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