Kanzi Connect  3.9.8
Kanzi Connect C++ API
kanzi::connect::RPCResultImpl< void > Class Template Reference

RPC Function result for void return value. More...

#include <rpcresult.hpp>

Inheritance diagram for kanzi::connect::RPCResultImpl< void >:
kanzi::connect::RPCResultBase< void >

Public Types

typedef function< void(RPCResult< void > &)> CallbackFunctionType
 Callback type. More...
 

Public Member Functions

RPCTypes::CallbackFunctionSubscriptionToken addCallback (CallbackFunctionType callback)
 Add callback. More...
 
bool completeIfTimedOut (const chrono::steady_clock::time_point &now)
 Completes the operation if it has been timed out. More...
 
void completeLinkBroken ()
 Completes RPC with link broken status. More...
 
void doComplete (int32_t rpcresult=GenericRPCReplyMessage::RPC_RESULT_OK)
 Completes the RPC result promise. More...
 
void getValue ()
 Gets the value. More...
 
void removeCallback (RPCTypes::CallbackFunctionSubscriptionToken token)
 Removes callback from the callback array. More...
 
 RPCResultImpl (RPCTypes::CommHandle handle)
 C++ constructs - initializes the object. More...
 
- Public Member Functions inherited from kanzi::connect::RPCResultBase< void >
RPCTypes::CommHandle getHandle () const
 Retrieve the communication handle. More...
 
int32_t getRPCCallResult () const
 Returns the low level RPC result. More...
 
void invalidate ()
 Invalidates the object. More...
 
bool isComplete () const
 Checks whether RPC call is complete. More...
 
 RPCResultBase ()
 C++ constructor - initialize the object. More...
 
bool testIsTimedOut (const chrono::steady_clock::time_point &now) const
 Tests whether operation has timed out. More...
 
bool valid () const
 Determines whether the RPC Result is still valid. More...
 
bool waitComplete (int msToWait) const
 Checks whether RPC call is complete. More...
 

Protected Member Functions

void invokeCallbacks ()
 Invokes all callbacks. More...
 
- Protected Member Functions inherited from kanzi::connect::RPCResultBase< void >
void setHandle (RPCTypes::CommHandle handle)
 Attach a handle to this object. More...
 
void setTimeout (int ms)
 Sets the timeout for a RPC operation. More...
 

Additional Inherited Members

- Protected Attributes inherited from kanzi::connect::RPCResultBase< void >
optional< chrono::steady_clock::time_point > m_expires
 
std::shared_future< void > m_future
 
RPCTypes::CommHandle m_handle
 
shared_ptr< std::promise< void > > m_promise
 
int32_t m_rpcresult
 

Detailed Description

template<>
class kanzi::connect::RPCResultImpl< void >

RPC Function result for void return value.

Member Typedef Documentation

◆ CallbackFunctionType

typedef function<void(RPCResult<void>&)> kanzi::connect::RPCResultImpl< void >::CallbackFunctionType

Callback type.

Constructor & Destructor Documentation

◆ RPCResultImpl()

C++ constructs - initializes the object.

Parameters
handlethe handle for the operation.

Member Function Documentation

◆ addCallback()

Add callback.

Parameters
callbackto be called when value is available.
Returns
subscription that can be used to cancel the request.

◆ completeIfTimedOut()

bool kanzi::connect::RPCResultImpl< void >::completeIfTimedOut ( const chrono::steady_clock::time_point &  now)
inline

Completes the operation if it has been timed out.

Returns
true if timed out

◆ completeLinkBroken()

void kanzi::connect::RPCResultImpl< void >::completeLinkBroken ( )
inline

Completes RPC with link broken status.

◆ doComplete()

void kanzi::connect::RPCResultImpl< void >::doComplete ( int32_t  rpcresult = GenericRPCReplyMessage::RPC_RESULT_OK)
inline

Completes the RPC result promise.

Parameters
rpcresultlow level rpc return value.

◆ getValue()

void kanzi::connect::RPCResultImpl< void >::getValue ( )
inline

Gets the value.

Note
can be called only once.

◆ invokeCallbacks()

void kanzi::connect::RPCResultImpl< void >::invokeCallbacks ( )
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.

◆ removeCallback()

void kanzi::connect::RPCResultImpl< void >::removeCallback ( RPCTypes::CallbackFunctionSubscriptionToken  token)
inline

Removes callback from the callback array.

Parameters
tokencallback to remove, token returned by addCallback function.

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