MACE  1.0.0
 All Classes Namespaces Files Functions Variables Enumerations Defines
libs/rpc/include/mace/rpc/json/tcp_connection.hpp
00001 #ifndef _MACE_RPC_JSON_TCP_CONNECTION_HPP_
00002 #define _MACE_RPC_JSON_TCP_CONNECTION_HPP_
00003 #include <mace/rpc/json/connection.hpp>
00004 #include <mace/cmt/asio/tcp/socket.hpp>
00005 #include <boost/asio.hpp>
00006 
00007 namespace mace { namespace rpc { namespace json {
00008 
00009 class tcp_connection : public mace::rpc::json::connection {
00010   public:
00011       typedef boost::shared_ptr<tcp_connection> ptr;
00012       typedef boost::weak_ptr<tcp_connection>   wptr;
00013 
00017       tcp_connection( const mace::cmt::asio::tcp::socket::ptr& sock,
00018                       mace::cmt::thread* t = &mace::cmt::thread::current() );
00019 
00020 
00021       tcp_connection( const std::string& host, uint16_t port, mace::cmt::thread* t = &mace::cmt::thread::current() );
00022       virtual ~tcp_connection();
00023 
00024   protected:
00025       friend class tcp_connection_private;
00026       virtual void send( const rpc::json::value& msg );
00027 
00028       class tcp_connection_private* my;
00029 };
00030 
00031 } } } // namespace mace::rpc::json
00032 
00033 #endif //_MACE_RPC_TCP_CONNECTION_HPP_