00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef PEEKABOT_CLIENT_TRANSPORT_HH_INCLUDED
00012 #define PEEKABOT_CLIENT_TRANSPORT_HH_INCLUDED
00013
00014
00015 #include <boost/shared_ptr.hpp>
00016 #include <boost/weak_ptr.hpp>
00017
00018
00019 namespace peekabot
00020 {
00021 class Action;
00022
00023 namespace client
00024 {
00025 class ClientImpl;
00026
00027 class Transport
00028 {
00029 public:
00030 Transport(boost::shared_ptr<ClientImpl> client)
00031 : m_client(client) {}
00032
00033 virtual ~Transport() {}
00034
00035 virtual void dispatch_action(boost::shared_ptr<Action> action) = 0;
00036
00037 virtual void flush() = 0;
00038
00039 protected:
00040 inline boost::shared_ptr<ClientImpl> client()
00041 {
00042 return m_client.lock();
00043 }
00044
00045 inline const boost::shared_ptr<ClientImpl> client() const
00046 {
00047 return m_client.lock();
00048 }
00049
00054 void disconnected();
00055
00056 void execute_action(boost::shared_ptr<Action> action);
00057
00058 private:
00059 boost::weak_ptr<ClientImpl> m_client;
00060 };
00061 }
00062 }
00063
00064
00065 #endif // PEEKABOT_CLIENT_TRANSPORT_HH_INCLUDED