Open Lighting Architecture  0.9.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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.
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.
std::string ErrorText () const
 Return the error string if the RPC failed.
void SetFailed (const std::string &reason)
 Mark this RPC as failed.
RpcSessionSession ()
 Get the session infomation for this RPC.

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 infomation for this RPC.

Unless specfically 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: