MACE  1.0.0
 All Classes Namespaces Files Functions Variables Enumerations Defines
libs/rpc/include/mace/rpc/json/http_client.hpp
00001 #ifndef _MACE_RPC_JSON_HTTP_CLIENT_HPP_
00002 #define _MACE_RPC_JSON_HTTP_CLIENT_HPP_
00003 #include <mace/stub/ptr.hpp>
00004 #include <mace/rpc/json/client_interface.hpp>
00005 #include <mace/rpc/json/http_client_base.hpp>
00006 #include <mace/rpc/json/http_connection.hpp>
00007 
00008 namespace mace { namespace rpc {  namespace json {
00009 
00018   template<typename InterfaceType>
00019   class http_client : public mace::stub::ptr<InterfaceType, mace::rpc::json::client_interface>, 
00020                       public http_client_base {
00021     public:
00022       typedef boost::shared_ptr<http_client>   ptr;
00023 
00024       http_client( const std::string& url )
00025       :http_client_base( url ) {
00026          mace::rpc::json::client_interface::set( *this );
00027       }
00028 
00029       http_client( const http_client& c ):http_client_base(c) {
00030         mace::rpc::json::client_interface::set( *this );
00031       }
00032 
00033       bool operator!()const { return !m_con; }
00034   };
00035 
00036 } } } // mace::rpc::json
00037 
00038 #endif