Rev 1592 | Rev 1595 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1592 | Rev 1593 | ||
|---|---|---|---|
| Line 21... | Line 21... | ||
| 21 | #ifndef NET_CLIENT_H |
21 | #ifndef NET_CLIENT_H |
| 22 | #define NET_CLIENT_H |
22 | #define NET_CLIENT_H |
| 23 | 23 | ||
| 24 | #include <boost/asio.hpp> |
24 | #include <boost/asio.hpp> |
| 25 | #include <boost/signals2.hpp> |
25 | #include <boost/signals2.hpp> |
| 26 | #include <boost/ |
26 | #include <boost/shared_ptr.hpp> |
| 27 | #include <boost/array.hpp> |
27 | #include <boost/array.hpp> |
| 28 | 28 | ||
| 29 | #include "Types.h" |
29 | #include "Types.h" |
| 30 | 30 | ||
| 31 | namespace atom { |
31 | namespace atom { |
| Line 34... | Line 34... | ||
| 34 | class Client |
34 | class Client |
| 35 | { |
35 | { |
| 36 | public: |
36 | public: |
| 37 | typedef boost::shared_ptr<Client> Pointer; |
37 | typedef boost::shared_ptr<Client> Pointer; |
| 38 | 38 | ||
| 39 | typedef boost::signals2::signal<void(ClientId, ClientState)> SignalOnNewState; |
39 | typedef boost::signals2::signal<void(ClientId, ServerId, ClientState)> SignalOnNewState; |
| 40 | typedef boost::signals2::signal<void(ClientId, |
40 | typedef boost::signals2::signal<void(ClientId, ServerId, Buffer)> SignalOnNewData; |
| 41 | 41 | ||
| 42 | Client(boost::asio::io_service& io_service, ClientId id, ServerId server_id); |
42 | Client(boost::asio::io_service& io_service, ClientId id, ServerId server_id); |
| 43 | virtual ~Client(); |
43 | virtual ~Client(); |
| 44 | 44 | ||
| 45 | void ConnectSlots(const SignalOnNewState::slot_type& slot_on_new_state, const SignalOnNewData::slot_type& slot_on_new_data); |
45 | void ConnectSlots(const SignalOnNewState::slot_type& slot_on_new_state, const SignalOnNewData::slot_type& slot_on_new_data); |
| Line 58... | Line 58... | ||
| 58 | void ReadHandler(const boost::system::error_code& error, size_t size); |
58 | void ReadHandler(const boost::system::error_code& error, size_t size); |
| 59 | 59 | ||
| 60 | SignalOnNewState signal_on_new_state_; |
60 | SignalOnNewState signal_on_new_state_; |
| 61 | 61 | ||
| 62 | private: |
62 | private: |
| 63 | ClientId |
63 | ClientId id_; |
| 64 | ServerId server_id_; |
64 | ServerId server_id_; |
| 65 | 65 | ||
| 66 | SignalOnNewData signal_on_new_data_; |
66 | SignalOnNewData signal_on_new_data_; |
| 67 | }; |
67 | }; |
| 68 | 68 | ||