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

#include <api_connection.hpp>

Public Member Functions

template<typename Api >
 generic_api (const Api &a, const std::shared_ptr< fc::api_connection > &c)
 
 generic_api (const generic_api &cpy)=delete
 
variant call (const string &name, const variants &args)
 
variant call (uint32_t method_id, const variants &args)
 
std::weak_ptr< fc::api_connectionget_connection ()
 
std::vector< std::string > get_method_names () const
 
template<typename Api >
 generic_api (const Api &a, const std::shared_ptr< fc::binary_api_connection > &c)
 
 generic_api (const generic_api &cpy)=delete
 
vector< char > call (const string &name, const vector< char > &args)
 
vector< char > call (uint32_t method_id, const vector< char > &args)
 
std::weak_ptr< fc::binary_api_connectionget_connection ()
 
std::vector< std::string > get_method_names () const
 

Friends

struct api_visitor
 

Detailed Description

Definition at line 97 of file binary_api_connection.hpp.

Constructor & Destructor Documentation

◆ generic_api() [1/4]

template<typename Api >
fc::generic_api::generic_api ( const Api & a,
const std::shared_ptr< fc::api_connection > & c )

Definition at line 372 of file api_connection.hpp.

373 :_api_connection(c),_api(a)
374 {
375 boost::any_cast<const Api&>(a)->visit( api_visitor( *this, c ) );
376 }
friend struct api_visitor
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181

◆ generic_api() [2/4]

fc::generic_api::generic_api ( const generic_api & cpy)
delete

◆ generic_api() [3/4]

template<typename Api >
fc::generic_api::generic_api ( const Api & a,
const std::shared_ptr< fc::binary_api_connection > & c )

Definition at line 379 of file binary_api_connection.hpp.

380 :_binary_api_connection(c),_api(a)
381 {
382 boost::any_cast<const Api&>(a)->visit( api_visitor( *this, c ) );
383 }

◆ generic_api() [4/4]

fc::generic_api::generic_api ( const generic_api & cpy)
delete

Member Function Documentation

◆ call() [1/4]

variant fc::generic_api::call ( const string & name,
const variants & args )
inline

Definition at line 104 of file api_connection.hpp.

105 {
106 auto itr = _by_name.find(name);
107 FC_ASSERT( itr != _by_name.end(), "no method with name '${name}'", ("name",name)("api",_by_name) );
108 return call( itr->second, args );
109 }
std::string name
variant call(const string &name, const variants &args)
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ call() [2/4]

vector< char > fc::generic_api::call ( const string & name,
const vector< char > & args )
inline

Definition at line 105 of file binary_api_connection.hpp.

106 {
107 auto itr = _by_name.find(name);
108 FC_ASSERT( itr != _by_name.end(), "no method with name '${name}'", ("name",name)("api",_by_name) );
109 return call( itr->second, args );
110 }
Here is the call graph for this function:

◆ call() [3/4]

variant fc::generic_api::call ( uint32_t method_id,
const variants & args )
inline

Definition at line 111 of file api_connection.hpp.

112 {
113 FC_ASSERT( method_id < _methods.size() );
114 return _methods[method_id](args);
115 }

◆ call() [4/4]

vector< char > fc::generic_api::call ( uint32_t method_id,
const vector< char > & args )
inline

Definition at line 112 of file binary_api_connection.hpp.

113 {
114 FC_ASSERT( method_id < _methods.size() );
115 return _methods[method_id](args);
116 }

◆ get_connection() [1/2]

std::weak_ptr< fc::api_connection > fc::generic_api::get_connection ( )
inline

Definition at line 117 of file api_connection.hpp.

118 {
119 return _api_connection;
120 }

◆ get_connection() [2/2]

std::weak_ptr< fc::binary_api_connection > fc::generic_api::get_connection ( )
inline

Definition at line 118 of file binary_api_connection.hpp.

119 {
120 return _binary_api_connection;
121 }

◆ get_method_names() [1/2]

std::vector< std::string > fc::generic_api::get_method_names ( ) const
inline

Definition at line 122 of file api_connection.hpp.

123 {
124 std::vector<std::string> result;
125 result.reserve( _by_name.size() );
126 for( auto& m : _by_name ) result.push_back(m.first);
127 return result;
128 }

◆ get_method_names() [2/2]

std::vector< std::string > fc::generic_api::get_method_names ( ) const
inline

Definition at line 123 of file binary_api_connection.hpp.

124 {
125 std::vector<std::string> result;
126 result.reserve( _by_name.size() );
127 for( auto& m : _by_name ) result.push_back(m.first);
128 return result;
129 }

Friends And Related Symbol Documentation

◆ api_visitor

api_visitor
friend

Definition at line 131 of file api_connection.hpp.


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