cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
msgpack_rpc::messages::CallResult Class Reference

Class of results of methods. More...

#include <msgpack_rpc/messages/call_result.h>

Collaboration diagram for msgpack_rpc::messages::CallResult:

Public Member Functions

 CallResult (CallResult &&) noexcept=default
 Move constructor.
 CallResult (const CallResult &)=default
 Copy constructor.
 ~CallResult ()=default
 Destructor.
template<typename T>
error_as () const
 Get the error.
bool is_error () const noexcept
 Check whether this object has an error.
bool is_success () const noexcept
 Check whether this object has a successful result.
msgpack::object object () const noexcept
 Get the internal object in msgpack library.
CallResultoperator= (CallResult &&) noexcept=default
 Move assignment operator.
CallResultoperator= (const CallResult &)=default
 Copy assignment operator.
template<typename T>
result_as () const
 Get the result.
std::shared_ptr< msgpack::zone > zone () const noexcept
 Get the internal zone in msgpack library.

Static Public Member Functions

static CallResult create_error (msgpack::object object, std::shared_ptr< msgpack::zone > zone)
 Create an error result.
static CallResult create_result (msgpack::object object, std::shared_ptr< msgpack::zone > zone)
 Create an successful result.

Private Member Functions

 CallResult (bool is_error, msgpack::object object, std::shared_ptr< msgpack::zone > zone)
 Constructor.

Private Attributes

bool is_error_
 Whether this is an error.
msgpack::object object_
 Object in msgpack library.
std::shared_ptr< msgpack::zone > zone_
 Zone in msgpack library.

Detailed Description

Class of results of methods.

Definition at line 35 of file call_result.h.

Constructor & Destructor Documentation

◆ CallResult()

msgpack_rpc::messages::CallResult::CallResult ( bool is_error,
msgpack::object object,
std::shared_ptr< msgpack::zone > zone )
inlineprivate

Constructor.

Parameters
[in]is_errorWhether this is an error.
[in]objectObject in msgpack library.
[in]zoneZone in msgpack library.

Definition at line 170 of file call_result.h.

Member Function Documentation

◆ create_error()

CallResult msgpack_rpc::messages::CallResult::create_error ( msgpack::object object,
std::shared_ptr< msgpack::zone > zone )
inlinestaticnodiscard

Create an error result.

Parameters
[in]objectObject in msgpack library.
[in]zoneZone in msgpack library.
Returns
Result.

Definition at line 57 of file call_result.h.

◆ create_result()

CallResult msgpack_rpc::messages::CallResult::create_result ( msgpack::object object,
std::shared_ptr< msgpack::zone > zone )
inlinestaticnodiscard

Create an successful result.

Parameters
[in]objectObject in msgpack library.
[in]zoneZone in msgpack library.
Returns
Result.

Definition at line 44 of file call_result.h.

◆ error_as()

template<typename T>
T msgpack_rpc::messages::CallResult::error_as ( ) const
inlinenodiscard

Get the error.

Template Parameters
TType.
Returns
Error.

Definition at line 84 of file call_result.h.

◆ is_error()

bool msgpack_rpc::messages::CallResult::is_error ( ) const
inlinenodiscardnoexcept

Check whether this object has an error.

Returns
Whether this object has an error.

Definition at line 68 of file call_result.h.

◆ is_success()

bool msgpack_rpc::messages::CallResult::is_success ( ) const
inlinenodiscardnoexcept

Check whether this object has a successful result.

Returns
Whether this object has an successful result.

Definition at line 75 of file call_result.h.

◆ object()

msgpack::object msgpack_rpc::messages::CallResult::object ( ) const
inlinenodiscardnoexcept

Get the internal object in msgpack library.

Returns
Object.

Definition at line 122 of file call_result.h.

◆ operator=() [1/2]

CallResult & msgpack_rpc::messages::CallResult::operator= ( CallResult && )
defaultnoexcept

Move assignment operator.

Returns
This.

◆ operator=() [2/2]

CallResult & msgpack_rpc::messages::CallResult::operator= ( const CallResult & )
default

Copy assignment operator.

Returns
This.

◆ result_as()

template<typename T>
T msgpack_rpc::messages::CallResult::result_as ( ) const
inlinenodiscard

Get the result.

Template Parameters
TType.
Returns
Result.

Definition at line 104 of file call_result.h.

◆ zone()

std::shared_ptr< msgpack::zone > msgpack_rpc::messages::CallResult::zone ( ) const
inlinenodiscardnoexcept

Get the internal zone in msgpack library.

Returns
Zone.

Definition at line 129 of file call_result.h.

Member Data Documentation

◆ is_error_

bool msgpack_rpc::messages::CallResult::is_error_
private

Whether this is an error.

Definition at line 175 of file call_result.h.

◆ object_

msgpack::object msgpack_rpc::messages::CallResult::object_
private

Object in msgpack library.

Definition at line 178 of file call_result.h.

◆ zone_

std::shared_ptr<msgpack::zone> msgpack_rpc::messages::CallResult::zone_
private

Zone in msgpack library.

Definition at line 181 of file call_result.h.


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