Open Lighting Architecture: ola::rpc::RpcController Class Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
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.
RpcSession * | Session ()
| Get the session information for this RPC.

## Constructor & Destructor Documentation

## ◆ RpcController()

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

Create a new RpcController.

Parameters

  session | the RpcSession to use. Ownership is not transferred.

## Member Function Documentation

## ◆ ErrorText()

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.

## ◆ Failed()

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.

## ◆ Session()

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.

## ◆ SetFailed()

void ola::rpc::RpcController::SetFailed | ( | const std::string & | reason | ) |

Mark this RPC as failed.

Parameters

  reason | the string to return in ErrorText().

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

- common/rpc/RpcController.h
- common/rpc/RpcController.cpp