Rev 1595 | Rev 1598 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1595 | Rev 1596 | ||
|---|---|---|---|
| Line 43... | Line 43... | ||
| 43 | { |
43 | { |
| 44 | public: |
44 | public: |
| 45 | typedef boost::shared_ptr<Manager> Pointer; |
45 | typedef boost::shared_ptr<Manager> Pointer; |
| 46 | 46 | ||
| 47 | typedef boost::signals2::signal<void(ClientId, ServerId, ClientState)> SignalOnNewState; |
47 | typedef boost::signals2::signal<void(ClientId, ServerId, ClientState)> SignalOnNewState; |
| 48 | typedef boost::signals2::signal<void(ClientId, ServerId, |
48 | typedef boost::signals2::signal<void(ClientId, ServerId, type::Byteset)> SignalOnNewData; |
| 49 | 49 | ||
| 50 | virtual ~Manager(); |
50 | virtual ~Manager(); |
| 51 | 51 | ||
| 52 | static Pointer Instance(); |
52 | static Pointer Instance(); |
| 53 | static void Delete(); |
53 | static void Delete(); |
| Line 58... | Line 58... | ||
| 58 | ClientId Connect(Protocol protocol, std::string address, unsigned int port_or_baud); |
58 | ClientId Connect(Protocol protocol, std::string address, unsigned int port_or_baud); |
| 59 | 59 | ||
| 60 | void StopServer(ServerId server_id); |
60 | void StopServer(ServerId server_id); |
| 61 | void Disconnect(ClientId client_id); |
61 | void Disconnect(ClientId client_id); |
| 62 | 62 | ||
| 63 | void SendToAll(ServerId server_id, |
63 | void SendToAll(ServerId server_id, type::Byteset data); |
| 64 | void SendTo(ClientId client_id, |
64 | void SendTo(ClientId client_id, type::Byteset data); |
| 65 | 65 | ||
| 66 | private: |
66 | private: |
| 67 | typedef std::map<ClientId, Client::Pointer> ClientList; |
67 | typedef std::map<ClientId, Client::Pointer> ClientList; |
| 68 | 68 | ||
| 69 | static Pointer instance_; |
69 | static Pointer instance_; |
| Line 79... | Line 79... | ||
| 79 | SignalOnNewData signal_on_new_data_; |
79 | SignalOnNewData signal_on_new_data_; |
| 80 | 80 | ||
| 81 | Manager(); |
81 | Manager(); |
| 82 | 82 | ||
| 83 | void SlotOnNewState(ClientId client_id, ServerId server_id, ClientState client_state); |
83 | void SlotOnNewState(ClientId client_id, ServerId server_id, ClientState client_state); |
| 84 | void SlotOnNewData(ClientId client_id, ServerId server_id, |
84 | void SlotOnNewData(ClientId client_id, ServerId server_id, type::Byteset data); |
| 85 | 85 | ||
| 86 | void StopServerHandler(ServerId server_id); |
86 | void StopServerHandler(ServerId server_id); |
| 87 | void DisconnectHandler(ClientId client_id); |
87 | void DisconnectHandler(ClientId client_id); |
| 88 | 88 | ||
| 89 | void SendToAllHandler(ServerId server_id, |
89 | void SendToAllHandler(ServerId server_id, type::Byteset data); |
| 90 | void SendToHandler(ClientId client_id, |
90 | void SendToHandler(ClientId client_id, type::Byteset data); |
| 91 | 91 | ||
| 92 | ClientId GetFreeClientId(); |
92 | ClientId GetFreeClientId(); |
| 93 | ServerId GetFreeServerId(); |
93 | ServerId GetFreeServerId(); |
| 94 | }; |
94 | }; |
| 95 | 95 | ||