Base template class for non-void RPC results. More...
#include <rpcresult.hpp>
Public Types | |
typedef function< void(RPCResult< _T > &) | CallbackFunctionType) |
Callback function type. | |
Public Member Functions | |
RPCTypes::CallbackFunctionSubscriptionToken | addCallback (CallbackFunctionType callback) |
Adds a callback to listen method response. | |
bool | completeIfTimedOut (const chrono::steady_clock::time_point &) |
Completes the operation if it has been timed out. | |
void | completeLinkBroken () |
Completes the operation with link broken status. | |
void | doComplete (_T value, int32_t rpcresult=GenericRPCReplyMessage::RPC_RESULT_OK) |
Completes the RPC result promise. | |
_T | getValue () |
Gets the value. | |
void | removeCallback (RPCTypes::CallbackFunctionSubscriptionToken token) |
Removes callback from the callback array. | |
RPCResultImpl (RPCTypes::CommHandle handle) | |
C++ constructs - initializes the object. | |
![]() | |
RPCTypes::CommHandle | getHandle () const |
Retrieve the communication handle. | |
int32_t | getRPCCallResult () const |
Returns the low level RPC result. | |
void | invalidate () |
Invalidates the object. | |
bool | isComplete () const |
Checks whether RPC call is complete. | |
RPCResultBase () | |
C++ constructor - initialize the object. | |
bool | testIsTimedOut (const chrono::steady_clock::time_point &now) const |
Tests whether operation has timed out. | |
bool | valid () const |
Determines whether the RPC Result is still valid. | |
bool | waitComplete (int msToWait) const |
Checks whether RPC call is complete. | |
Protected Member Functions | |
void | invokeCallbacks () |
Invokes all callbacks. | |
![]() | |
void | setHandle (RPCTypes::CommHandle handle) |
Attach a handle to this object. | |
void | setTimeout (int ms) |
Sets the timeout for a RPC operation. | |
Additional Inherited Members | |
![]() | |
optional< chrono::steady_clock::time_point > | m_expires |
std::shared_future< _T > | m_future |
RPCTypes::CommHandle | m_handle |
shared_ptr< std::promise< _T > > | m_promise |
int32_t | m_rpcresult |
Base template class for non-void RPC results.
typedef function<void(RPCResult<_T>&) kanzi::connect::RPCResultImpl< _T >::CallbackFunctionType) |
Callback function type.
|
inline |
C++ constructs - initializes the object.
handle | the handle for the operation. |
|
inline |
Adds a callback to listen method response.
Invoked when response is received.
callback | pointer to function to call. |
bool kanzi::connect::RPCResultImpl< _T >::completeIfTimedOut | ( | const chrono::steady_clock::time_point & | ) |
Completes the operation if it has been timed out.
void kanzi::connect::RPCResultImpl< _T >::completeLinkBroken | ( | ) |
Completes the operation with link broken status.
|
inline |
Completes the RPC result promise.
value | complete value |
|
inline |
Gets the value.
|
inlineprotected |
Invokes all callbacks.
There can be any number of them configured for a single RPC call completion.
allow callback to get removed from callback itself. If new callback is added from callback it won't be called.
|
inline |
Removes callback from the callback array.
token | callback to remove, token returned by addCallback function. |