Rev 1601 | Rev 1939 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1601 | Rev 1642 | ||
|---|---|---|---|
| Line 42... | Line 42... | ||
| 42 | { |
42 | { |
| 43 | public: |
43 | public: |
| 44 | typedef boost::shared_ptr<Manager> Pointer; |
44 | typedef boost::shared_ptr<Manager> Pointer; |
| 45 | 45 | ||
| 46 | typedef boost::signals2::signal<void(ClientId, ServerId, ClientState)> SignalOnNewState; |
46 | typedef boost::signals2::signal<void(ClientId, ServerId, ClientState)> SignalOnNewState; |
| 47 | typedef boost::signals2::signal<void(ClientId, ServerId, |
47 | typedef boost::signals2::signal<void(ClientId, ServerId, common::Byteset)> SignalOnNewData; |
| 48 | 48 | ||
| 49 | virtual ~Manager(); |
49 | virtual ~Manager(); |
| 50 | 50 | ||
| 51 | static Pointer Instance(); |
51 | static Pointer Instance(); |
| 52 | static void Create(); |
52 | static void Create(); |
| 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, common::Byteset data); |
| 64 | void SendTo(ClientId client_id, |
64 | void SendTo(ClientId client_id, common::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 74... | Line 74... | ||
| 74 | SignalOnNewData signal_on_new_data_; |
74 | SignalOnNewData signal_on_new_data_; |
| 75 | 75 | ||
| 76 | Manager(); |
76 | Manager(); |
| 77 | 77 | ||
| 78 | void SlotOnNewState(ClientId client_id, ServerId server_id, ClientState client_state); |
78 | void SlotOnNewState(ClientId client_id, ServerId server_id, ClientState client_state); |
| 79 | void SlotOnNewData(ClientId client_id, ServerId server_id, |
79 | void SlotOnNewData(ClientId client_id, ServerId server_id, common::Byteset data); |
| 80 | 80 | ||
| 81 | void StopServerHandler(ServerId server_id); |
81 | void StopServerHandler(ServerId server_id); |
| 82 | void DisconnectHandler(ClientId client_id); |
82 | void DisconnectHandler(ClientId client_id); |
| 83 | 83 | ||
| 84 | void SendToAllHandler(ServerId server_id, |
84 | void SendToAllHandler(ServerId server_id, common::Byteset data); |
| 85 | void SendToHandler(ClientId client_id, |
85 | void SendToHandler(ClientId client_id, common::Byteset data); |
| 86 | 86 | ||
| 87 | ClientId GetFreeClientId(); |
87 | ClientId GetFreeClientId(); |
| 88 | ServerId GetFreeServerId(); |
88 | ServerId GetFreeServerId(); |
| 89 | }; |
89 | }; |
| 90 | 90 | ||