BitShares-Core  7.0.1
BitShares blockchain node software and command-line wallet software
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
fc::api< Interface, Transform > Class Template Reference

#include <api.hpp>

Public Types

typedef vtable< Interface, Transform > vtable_type
 

Public Member Functions

 api ()
 
template<typename T >
 api (const T &p)
 
 api (const api &cpy)
 
virtual ~api ()
 
virtual uint64_t get_handle () const override
 
virtual api_id_type register_api (api_connection &conn) const override
 
vtable_typeoperator* () const
 
vtable_typeoperator-> () const
 

Protected Attributes

std::shared_ptr< vtable_type_vtable
 
std::shared_ptr< boost::any > _data
 

Friends

bool operator== (const api &a, const api &b)
 
bool operator!= (const api &a, const api &b)
 

Detailed Description

template<typename Interface, typename Transform = identity_member_with_optionals>
class fc::api< Interface, Transform >

Definition at line 120 of file api.hpp.

Member Typedef Documentation

◆ vtable_type

template<typename Interface , typename Transform = identity_member_with_optionals>
typedef vtable<Interface,Transform> fc::api< Interface, Transform >::vtable_type

Definition at line 147 of file api.hpp.

Constructor & Destructor Documentation

◆ api() [1/3]

template<typename Interface , typename Transform = identity_member_with_optionals>
fc::api< Interface, Transform >::api ( )
inline

Definition at line 149 of file api.hpp.

◆ api() [2/3]

template<typename Interface , typename Transform = identity_member_with_optionals>
template<typename T >
fc::api< Interface, Transform >::api ( const T &  p)
inline

T is anything with pointer semantics

Definition at line 153 of file api.hpp.

◆ api() [3/3]

template<typename Interface , typename Transform = identity_member_with_optionals>
fc::api< Interface, Transform >::api ( const api< Interface, Transform > &  cpy)
inline

Definition at line 163 of file api.hpp.

◆ ~api()

template<typename Interface , typename Transform = identity_member_with_optionals>
virtual fc::api< Interface, Transform >::~api ( )
inlinevirtual

Definition at line 164 of file api.hpp.

Member Function Documentation

◆ get_handle()

template<typename Interface , typename Transform = identity_member_with_optionals>
virtual uint64_t fc::api< Interface, Transform >::get_handle ( ) const
inlineoverridevirtual

Definition at line 168 of file api.hpp.

◆ operator*()

template<typename Interface , typename Transform = identity_member_with_optionals>
vtable_type& fc::api< Interface, Transform >::operator* ( ) const
inline

Definition at line 171 of file api.hpp.

◆ operator->()

template<typename Interface , typename Transform = identity_member_with_optionals>
vtable_type* fc::api< Interface, Transform >::operator-> ( ) const
inline

Definition at line 172 of file api.hpp.

◆ register_api()

template<typename Interface , typename Transform >
api_id_type fc::api< Interface, Transform >::register_api ( api_connection conn) const
overridevirtual

It is slightly unclean tight coupling to have this method in the api class. It breaks encapsulation by requiring an api class method to have a pointer to an api_connection. The reason this is necessary is we have a goal of being able to call register_api() on an api<T> through its base class api_base. But register_api() must know the template parameters!

The only reasonable way to achieve the goal is to implement register_api() as a method in api<T> (which obviously knows the template parameter T), then make the implementation accessible through the base class (by making it a pure virtual method in the base class which is overridden by the subclass's implementation).

Definition at line 508 of file api_connection.hpp.

Friends And Related Function Documentation

◆ operator!=

template<typename Interface , typename Transform = identity_member_with_optionals>
bool operator!= ( const api< Interface, Transform > &  a,
const api< Interface, Transform > &  b 
)
friend

Definition at line 167 of file api.hpp.

◆ operator==

template<typename Interface , typename Transform = identity_member_with_optionals>
bool operator== ( const api< Interface, Transform > &  a,
const api< Interface, Transform > &  b 
)
friend

Definition at line 166 of file api.hpp.

Member Data Documentation

◆ _data

template<typename Interface , typename Transform = identity_member_with_optionals>
std::shared_ptr<boost::any> fc::api< Interface, Transform >::_data
protected

Definition at line 176 of file api.hpp.

◆ _vtable

template<typename Interface , typename Transform = identity_member_with_optionals>
std::shared_ptr<vtable_type> fc::api< Interface, Transform >::_vtable
protected

Definition at line 175 of file api.hpp.


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