MACE
1.0.0
|
00001 #ifndef _MACE_RPC_JSON_CLIENT_BASE_HPP 00002 #define _MACE_RPC_JSON_CLIENT_BASE_HPP 00003 #include <mace/rpc/json/connection.hpp> 00004 #include <mace/rpc/json/named_parameters.hpp> 00005 00006 namespace mace { namespace rpc { namespace json { 00007 00008 class client_base { 00009 public: 00010 client_base( const mace::rpc::json::connection::ptr& c ) 00011 :m_con(c){} 00012 00013 client_base( const std::string& host, uint16_t port ); 00014 client_base(){} 00015 00016 client_base( const client_base& c ) 00017 :m_con(c.m_con){ slog("this: %2% copy %1%", m_con.get(), this ); } 00018 00019 template<typename R, typename ParamSeq> 00020 inline mace::cmt::future<R> call_fused( const std::string& method, const ParamSeq& param ) { 00021 //slog( "this: %1% m_con: %2% ", this, m_con.get() ); 00022 return m_con->call_fused<R,ParamSeq>( method, param ); 00023 } 00024 00025 template<typename ParamSeq> 00026 inline void notice_fused( const std::string& method, const ParamSeq& param ) { 00027 m_con->notice_fused( method, param ); 00028 } 00029 00030 mace::rpc::json::connection::ptr get_connection()const { return m_con; } 00031 00032 protected: 00033 mace::rpc::json::connection::ptr m_con; 00034 }; 00035 00036 }}} // namespace mace::rpc::json 00037 #endif // _MACE_RPC_CLIENT_BASE_HPP