Kanzi Connect 3.9.10
kanzi::connect::RPCResult< _T > Class Template Reference

Wrapper for concrete RPC results.. provides limited and more convinient access. More...

#include <rpcresult.hpp>

Public Member Functions

RPCTypes::CallbackFunctionSubscriptionToken addCallback (typename RPCResultImpl< _T >::CallbackFunctionType callback)
 Add callback.
 
RPCTypes::CallbackFunctionSubscriptionToken addCallbackEx (RPCResultObserver< _T > *callback)
 Add callback.
 
bool complete (_T value, int32_t rpcresult=GenericRPCReplyMessage::RPC_RESULT_OK)
 Completes an object.
 
int32_t getRPCCallResult () const
 Retrieve low level rpc status of the method call.
 
_T getValue () const
 Return the value of a call.
 
void invalidate ()
 Releases all the referenced resources. After calling this it is not safe to access any other methods except the valid().
 
bool isComplete () const
 Check has call completed.
 
bool isLinkBroken () const
 Has the link been broken and caused the RPC call to terminate.
 
bool isTimedOut () const
 Has the request been timed out.
 
void removeCallback (RPCTypes::CallbackFunctionSubscriptionToken token)
 Remove a callback.
 
 RPCResult ()
 Default c++ constructor.
 
void setTimeout (int ms)
 Sets the timeout after which the operation is completed locally with timed-out status.
 
bool valid () const
 is object OK
 
bool waitComplete (int32_t ms) const
 Wait until complete.
 

Static Public Member Functions

static RPCResult< _T > create (RPCTypes::CommHandle handle)
 Factory function to create a pending RPC Result object with handle provided.
 

Protected Member Functions

shared_ptr< RPCResultImpl< _T > > object ()
 Gets access to contained object.
 
 RPCResult (shared_ptr< RPCResultImpl< _T > > object)
 C++ constructor - initialize the object.
 

Friends

class RPCCallStore
 
class RPCResultImpl< _T >
 

Detailed Description

template<class _T>
class kanzi::connect::RPCResult< _T >

Wrapper for concrete RPC results.. provides limited and more convinient access.

Constructor & Destructor Documentation

◆ RPCResult() [1/2]

template<class _T >
kanzi::connect::RPCResult< _T >::RPCResult ( shared_ptr< RPCResultImpl< _T > > object)
inlineprotected

C++ constructor - initialize the object.

Parameters
objectobject that implements the result.

◆ RPCResult() [2/2]

template<class _T >
kanzi::connect::RPCResult< _T >::RPCResult ( )
inline

Default c++ constructor.

Member Function Documentation

◆ addCallback()

template<class _T >
RPCTypes::CallbackFunctionSubscriptionToken kanzi::connect::RPCResult< _T >::addCallback ( typename RPCResultImpl< _T >::CallbackFunctionType callback)
inline

Add callback.

Parameters
callbackto be called when ready.
Returns
subscription handle.

◆ addCallbackEx()

template<class _T >
RPCTypes::CallbackFunctionSubscriptionToken kanzi::connect::RPCResult< _T >::addCallbackEx ( RPCResultObserver< _T > * callback)
inline

Add callback.

Parameters
callbackto be called when ready.
Returns
subscription handle.

◆ complete()

template<class _T >
bool kanzi::connect::RPCResult< _T >::complete ( _T value,
int32_t rpcresult = GenericRPCReplyMessage::RPC_RESULT_OK )
inline

Completes an object.

Normally this is not meant to be used by RPC users but completion is done internally by the Kanzi Connect framework.

Parameters
rpcresultThe RPC level completion value.
Returns
If completion is done, true. If completion has already been completed, false.

◆ create()

template<class _T >
static RPCResult< _T > kanzi::connect::RPCResult< _T >::create ( RPCTypes::CommHandle handle)
inlinestatic

Factory function to create a pending RPC Result object with handle provided.

Parameters
handlethe handle for the object.

◆ getRPCCallResult()

template<class _T >
int32_t kanzi::connect::RPCResult< _T >::getRPCCallResult ( ) const
inline

Retrieve low level rpc status of the method call.

Returns
RPC status.

◆ getValue()

template<class _T >
_T kanzi::connect::RPCResult< _T >::getValue ( ) const
inline

Return the value of a call.

Will block calling thread if remote-call is not complete yet.

Returns
value

◆ invalidate()

template<class _T >
void kanzi::connect::RPCResult< _T >::invalidate ( )
inline

Releases all the referenced resources. After calling this it is not safe to access any other methods except the valid().

◆ isComplete()

template<class _T >
bool kanzi::connect::RPCResult< _T >::isComplete ( ) const
inline

Check has call completed.

Returns
true if completed.

◆ isLinkBroken()

template<class _T >
bool kanzi::connect::RPCResult< _T >::isLinkBroken ( ) const
inline

Has the link been broken and caused the RPC call to terminate.

Returns
true if link was broken and caused the operation to fail because if that.

◆ isTimedOut()

template<class _T >
bool kanzi::connect::RPCResult< _T >::isTimedOut ( ) const
inline

Has the request been timed out.

Returns
true if timed out.

◆ object()

template<class _T >
shared_ptr< RPCResultImpl< _T > > kanzi::connect::RPCResult< _T >::object ( )
inlineprotected

Gets access to contained object.

In general there should be no need to access the object directly.

Returns
Implementation object.

◆ removeCallback()

template<class _T >
void kanzi::connect::RPCResult< _T >::removeCallback ( RPCTypes::CallbackFunctionSubscriptionToken token)
inline

Remove a callback.

Parameters
tokensubscription to remove.

◆ setTimeout()

template<class _T >
void kanzi::connect::RPCResult< _T >::setTimeout ( int ms)
inline

Sets the timeout after which the operation is completed locally with timed-out status.

Note
the timeout is not millisecond accurate but its quaranteed that the timeout is not signaled before specified amount of milliseconds has elapsed. Timeouts are in practise evaluated when ever information is received from the kanzi connect server.
Parameters
msTimeout in milliseconds.

◆ valid()

template<class _T >
bool kanzi::connect::RPCResult< _T >::valid ( ) const
inline

is object OK

Returns
true if ok.

◆ waitComplete()

template<class _T >
bool kanzi::connect::RPCResult< _T >::waitComplete ( int32_t ms) const
inline

Wait until complete.

Parameters
msmaximum amount of milliseconds to wait.
Returns
true if call became ready. false if still pending.

Friends And Related Symbol Documentation

◆ RPCCallStore

template<class _T >
friend class RPCCallStore
friend

◆ RPCResultImpl< _T >

template<class _T >
friend class RPCResultImpl< _T >
friend

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