Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fc::api_connection Class Referenceabstract

#include <api_connection.hpp>

Inheritance diagram for fc::api_connection:
Collaboration diagram for fc::api_connection:

Public Member Functions

 api_connection ()
 
virtual ~api_connection ()
 
template<typename T >
api< Tget_remote_api (api_id_type api_id=0)
 
virtual variant send_call (api_id_type api_id, string method_name, variants args=variants())=0
 
virtual variant send_callback (uint64_t callback_id, variants args=variants())=0
 
virtual void send_notice (uint64_t callback_id, variants args=variants())=0
 
variant receive_call (api_id_type api_id, const string &method_name, const variants &args=variants()) const
 
variant receive_callback (uint64_t callback_id, const variants &args=variants()) const
 
void receive_notice (uint64_t callback_id, const variants &args=variants()) const
 
template<typename Interface >
api_id_type register_api (const Interface &a)
 
template<typename Signature >
uint64_t register_callback (const std::function< Signature > &cb)
 
std::vector< std::string > get_method_names (api_id_type local_api_id=0) const
 

Public Attributes

fc::signal< void()> closed
 

Detailed Description

Definition at line 205 of file api_connection.hpp.

Constructor & Destructor Documentation

◆ api_connection()

fc::api_connection::api_connection ( )
inline

Definition at line 208 of file api_connection.hpp.

208{}

◆ ~api_connection()

virtual fc::api_connection::~api_connection ( )
inlinevirtual

Definition at line 209 of file api_connection.hpp.

209{};

Member Function Documentation

◆ get_method_names()

std::vector< std::string > fc::api_connection::get_method_names ( api_id_type local_api_id = 0) const
inline

Definition at line 260 of file api_connection.hpp.

260{ return _local_apis[local_api_id]->get_method_names(); }
Here is the caller graph for this function:

◆ get_remote_api()

template<typename T >
api< T > fc::api_connection::get_remote_api ( api_id_type api_id = 0)
inline

Definition at line 213 of file api_connection.hpp.

214 {
215 api<T> result;
216 result->visit( api_visitor( api_id, this->shared_from_this() ) );
217 return result;
218 }

◆ receive_call()

variant fc::api_connection::receive_call ( api_id_type api_id,
const string & method_name,
const variants & args = variants() ) const
inline

Definition at line 225 of file api_connection.hpp.

226 {
227 FC_ASSERT( _local_apis.size() > api_id );
228 return _local_apis[api_id]->call( method_name, args );
229 }
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
Here is the caller graph for this function:

◆ receive_callback()

variant fc::api_connection::receive_callback ( uint64_t callback_id,
const variants & args = variants() ) const
inline

Definition at line 230 of file api_connection.hpp.

231 {
232 FC_ASSERT( _local_callbacks.size() > callback_id );
233 return _local_callbacks[callback_id]( args );
234 }
Here is the caller graph for this function:

◆ receive_notice()

void fc::api_connection::receive_notice ( uint64_t callback_id,
const variants & args = variants() ) const
inline

Definition at line 235 of file api_connection.hpp.

236 {
237 FC_ASSERT( _local_callbacks.size() > callback_id );
238 _local_callbacks[callback_id]( args );
239 }
Here is the caller graph for this function:

◆ register_api()

template<typename Interface >
api_id_type fc::api_connection::register_api ( const Interface & a)
inline

Definition at line 242 of file api_connection.hpp.

243 {
244 auto handle = a.get_handle();
245 auto itr = _handle_to_id.find(handle);
246 if( itr != _handle_to_id.end() ) return itr->second;
247
248 _local_apis.push_back( std::unique_ptr<generic_api>( new generic_api(a, shared_from_this() ) ) );
249 _handle_to_id[handle] = _local_apis.size() - 1;
250 return _local_apis.size() - 1;
251 }
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
Here is the caller graph for this function:

◆ register_callback()

template<typename Signature >
uint64_t fc::api_connection::register_callback ( const std::function< Signature > & cb)
inline

Definition at line 254 of file api_connection.hpp.

255 {
256 _local_callbacks.push_back( detail::to_generic( cb ) );
257 return _local_callbacks.size() - 1;
258 }
std::function< variant(const fc::variants &)> to_generic(const std::function< R(Args...)> &f)
Here is the call graph for this function:

◆ send_call()

virtual variant fc::api_connection::send_call ( api_id_type api_id,
string method_name,
variants args = variants() )
pure virtual

◆ send_callback()

virtual variant fc::api_connection::send_callback ( uint64_t callback_id,
variants args = variants() )
pure virtual

◆ send_notice()

virtual void fc::api_connection::send_notice ( uint64_t callback_id,
variants args = variants() )
pure virtual

Member Data Documentation

◆ closed

fc::signal<void()> fc::api_connection::closed

Definition at line 262 of file api_connection.hpp.


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