Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fc::detail::any_api Class Reference

#include <api_connection.hpp>

Inheritance diagram for fc::detail::any_api:
Collaboration diagram for fc::detail::any_api:

Public Member Functions

 any_api (api_id_type api_id, const std::shared_ptr< fc::api_connection > &con)
 
virtual uint64_t get_handle () const override
 
virtual api_id_type register_api (api_connection &conn) const override
 
 any_api (api_id_type api_id, const std::shared_ptr< fc::binary_api_connection > &con)
 
virtual uint64_t get_handle () const override
 
virtual api_id_type register_api (binary_api_connection &conn) const override
 
- Public Member Functions inherited from fc::api_base
 api_base ()
 
virtual ~api_base ()
 
template<typename T >
api< T, identity_memberas ()
 
template<typename T >
api< Tas ()
 

Public Attributes

api_id_type _api_id
 
std::weak_ptr< fc::api_connection_api_connection
 
std::weak_ptr< fc::binary_api_connection_binary_api_connection
 

Detailed Description

If api<T> is returned from a remote method, the API is eagerly bound to api<T> of the correct type in api_visitor::from_variant(). This binding [1] needs a reference to the api_connection, which is made available to from_variant() as a parameter.

However, in the case of a remote method which returns api_base which can subsequently be cast by the caller with as<T>, we need to keep track of the connection because the binding is done later (when the client code actually calls as<T>).

[1] The binding actually happens in get_remote_api().

If api<T> is returned from a remote method, the API is eagerly bound to api<T> of the correct type in api_visitor::from_variant(). This binding [1] needs a reference to the binary_api_connection, which is made available to from_variant() as a parameter.

However, in the case of a remote method which returns api_base which can subsequently be cast by the caller with as<T>, we need to keep track of the connection because the binding is done later (when the client code actually calls as<T>).

[1] The binding actually happens in get_remote_api().

Definition at line 79 of file binary_api_connection.hpp.

Constructor & Destructor Documentation

◆ any_api() [1/2]

fc::detail::any_api::any_api ( api_id_type api_id,
const std::shared_ptr< fc::api_connection > & con )
inline

Definition at line 81 of file api_connection.hpp.

82 : _api_id(api_id), _api_connection(con) {}
std::weak_ptr< fc::api_connection > _api_connection

◆ any_api() [2/2]

fc::detail::any_api::any_api ( api_id_type api_id,
const std::shared_ptr< fc::binary_api_connection > & con )
inline

Definition at line 82 of file binary_api_connection.hpp.

83 : _api_id(api_id), _binary_api_connection(con) {}
std::weak_ptr< fc::binary_api_connection > _binary_api_connection

Member Function Documentation

◆ get_handle() [1/2]

virtual uint64_t fc::detail::any_api::get_handle ( ) const
inlineoverridevirtual

Implements fc::api_base.

Definition at line 84 of file api_connection.hpp.

85 { return _api_id; }

◆ get_handle() [2/2]

virtual uint64_t fc::detail::any_api::get_handle ( ) const
inlineoverridevirtual

Implements fc::api_base.

Definition at line 85 of file binary_api_connection.hpp.

86 { return _api_id; }

◆ register_api() [1/2]

virtual api_id_type fc::detail::any_api::register_api ( api_connection & conn) const
inlineoverridevirtual

Implements fc::api_base.

Definition at line 87 of file api_connection.hpp.

88 { FC_ASSERT( false ); return api_id_type(); }
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
uint32_t api_id_type
Definition api.hpp:46

◆ register_api() [2/2]

virtual api_id_type fc::detail::any_api::register_api ( binary_api_connection & conn) const
inlineoverridevirtual

Definition at line 88 of file binary_api_connection.hpp.

89 { FC_ASSERT( false ); return api_id_type(); }

Member Data Documentation

◆ _api_connection

std::weak_ptr<fc::api_connection> fc::detail::any_api::_api_connection

Definition at line 91 of file api_connection.hpp.

◆ _api_id

api_id_type fc::detail::any_api::_api_id

Definition at line 90 of file api_connection.hpp.

◆ _binary_api_connection

std::weak_ptr<fc::binary_api_connection> fc::detail::any_api::_binary_api_connection

Definition at line 92 of file binary_api_connection.hpp.


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