Gossip 1.1
Public Member Functions | List of all members
gossip::client::GossipClient::Result< T > Class Template Reference

Wrapper return value. More...

#include <GossipClient.h>

Public Member Functions

 Result (bool suc, std::string error_text, T value={})
 
bool isSucceed () const
 
std::string errorText () const
 
value () const
 

Detailed Description

template<class T>
class gossip::client::GossipClient::Result< T >

Wrapper return value.

Class Result contains rpc status and rpc result. User can identify why an operation is failed.

Template Parameters
TThe type of rpc result

Constructor & Destructor Documentation

◆ Result()

template<class T >
gossip::client::GossipClient::Result< T >::Result ( bool  suc,
std::string  error_text,
value = {} 
)
inlineexplicit

Constructor of Result. If an operation succeed, error_text will be empty. Otherwise, value will be empty.

Parameters
sucIs operation succeeded
error_textIf operation failed, its failed reason
valueIf operation succeeded, its returned value
Note
error_text and value shouldn't be both empty or not empty.

Member Function Documentation

◆ errorText()

template<class T >
std::string gossip::client::GossipClient::Result< T >::errorText ( ) const
inline

Get the failed reason of operation.

Returns
Failed reason

◆ isSucceed()

template<class T >
bool gossip::client::GossipClient::Result< T >::isSucceed ( ) const
inline

Check is operation succeeded.

Returns
Operation status

◆ value()

template<class T >
T gossip::client::GossipClient::Result< T >::value ( ) const
inline

Get the result of operation.

Returns
Operation result

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