Open Lighting Architecture
Latest Git
|
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... | |
RpcSession * | Session () |
Get the session information for this RPC. More... | |
|
explicit |
Create a new RpcController.
session | the RpcSession to use. Ownership is not transferred. |
|
inline |
Return the error string if the RPC failed.
|
inline |
Check if the RPC call this controller was associated with failed.
RpcSession * ola::rpc::RpcController::Session | ( | ) |
Get the session information for this RPC.
Unless specifically provided, the session be NULL on the client side.
void ola::rpc::RpcController::SetFailed | ( | const std::string & | reason | ) |
Mark this RPC as failed.
reason | the string to return in ErrorText(). |