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

#include <binary_api_connection.hpp>

Inheritance diagram for fc::binary_api_connection:
Collaboration diagram for fc::binary_api_connection:

Public Types

typedef std::vector< char > params_type
 
typedef std::vector< char > result_type
 

Public Member Functions

 binary_api_connection ()
 
virtual ~binary_api_connection ()
 
template<typename T >
api< Tget_remote_api (api_id_type api_id=0)
 
virtual result_type send_call (api_id_type api_id, string method_name, params_type args=params_type())=0
 
virtual result_type send_callback (uint64_t callback_id, params_type args=params_type())=0
 
virtual void send_notice (uint64_t callback_id, params_type args=params_type())=0
 
result_type receive_call (api_id_type api_id, const string &method_name, const params_type &args=params_type()) const
 
result_type receive_callback (uint64_t callback_id, const params_type &args=params_type()) const
 
void receive_notice (uint64_t callback_id, const params_type &args=params_type()) 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 209 of file binary_api_connection.hpp.

Member Typedef Documentation

◆ params_type

Definition at line 212 of file binary_api_connection.hpp.

◆ result_type

Definition at line 213 of file binary_api_connection.hpp.

Constructor & Destructor Documentation

◆ binary_api_connection()

fc::binary_api_connection::binary_api_connection ( )
inline

Definition at line 215 of file binary_api_connection.hpp.

215{}

◆ ~binary_api_connection()

virtual fc::binary_api_connection::~binary_api_connection ( )
inlinevirtual

Definition at line 216 of file binary_api_connection.hpp.

216{};

Member Function Documentation

◆ get_method_names()

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

Definition at line 267 of file binary_api_connection.hpp.

267{ return _local_apis[local_api_id]->get_method_names(); }

◆ get_remote_api()

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

Definition at line 220 of file binary_api_connection.hpp.

221 {
222 api<T> result;
223 result->visit( api_visitor( api_id, this->shared_from_this() ) );
224 return result;
225 }

◆ receive_call()

result_type fc::binary_api_connection::receive_call ( api_id_type api_id,
const string & method_name,
const params_type & args = params_type() ) const
inline

Definition at line 232 of file binary_api_connection.hpp.

233 {
234 FC_ASSERT( _local_apis.size() > api_id );
235 return _local_apis[api_id]->call( method_name, args );
236 }
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.

◆ receive_callback()

result_type fc::binary_api_connection::receive_callback ( uint64_t callback_id,
const params_type & args = params_type() ) const
inline

Definition at line 237 of file binary_api_connection.hpp.

238 {
239 FC_ASSERT( _local_callbacks.size() > callback_id );
240 return _local_callbacks[callback_id]( args );
241 }

◆ receive_notice()

void fc::binary_api_connection::receive_notice ( uint64_t callback_id,
const params_type & args = params_type() ) const
inline

Definition at line 242 of file binary_api_connection.hpp.

243 {
244 FC_ASSERT( _local_callbacks.size() > callback_id );
245 _local_callbacks[callback_id]( args );
246 }

◆ register_api()

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

Definition at line 249 of file binary_api_connection.hpp.

250 {
251 auto handle = a.get_handle();
252 auto itr = _handle_to_id.find(handle);
253 if( itr != _handle_to_id.end() ) return itr->second;
254
255 _local_apis.push_back( std::unique_ptr<generic_api>( new generic_api(a, shared_from_this() ) ) );
256 _handle_to_id[handle] = _local_apis.size() - 1;
257 return _local_apis.size() - 1;
258 }
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181

◆ register_callback()

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

Definition at line 261 of file binary_api_connection.hpp.

262 {
263 _local_callbacks.push_back( detail::to_generic( cb ) );
264 return _local_callbacks.size() - 1;
265 }
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 result_type fc::binary_api_connection::send_call ( api_id_type api_id,
string method_name,
params_type args = params_type() )
pure virtual

makes calls to the remote server

Implemented in fc::local_binary_api_connection.

◆ send_callback()

virtual result_type fc::binary_api_connection::send_callback ( uint64_t callback_id,
params_type args = params_type() )
pure virtual

◆ send_notice()

virtual void fc::binary_api_connection::send_notice ( uint64_t callback_id,
params_type args = params_type() )
pure virtual

Member Data Documentation

◆ closed

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

Definition at line 269 of file binary_api_connection.hpp.


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