Tinman  1.0
network.h
Go to the documentation of this file.
1 #ifndef NETWORK_H
2 #define NETWORK_H
3 #include <Ice/Ice.h>
4 #include "tinmanI.h"
5 #include "car.h"
6 
7 using namespace Ice;
8 
9 class Session;
10 
12  protected:
14  public:
15  typedef std::shared_ptr<ControllerObserver> shared;
16  std::pair<std::string, int> socket_;
17 
19  virtual ~ControllerObserver();
20 
21  virtual void notify(Tinman::Action action) = 0;
22  virtual Ice::AsyncResultPtr login(std::shared_ptr<Session> session) = 0;
23  virtual Tinman::LoginInfo complete_login(Ice::AsyncResultPtr async_result) = 0;
24  virtual Ice::AsyncResultPtr next_race(std::string nickname) = 0;
25  virtual void disconnect() = 0;
26 };
27 
28 class Adapter: public ControllerObserver {
29  Ice::CommunicatorPtr communicator_;
30  Tinman::LoginInfo login_info_;
31  Tinman::AuthoritativeServerPrx dgram_auth_server_, auth_server_;
33 
34  public:
35  typedef std::shared_ptr<Adapter> shared;
36 
37  Adapter(Car::shared car);
38  virtual ~Adapter();
39 
40  void notify(Tinman::Action action);
41  Ice::AsyncResultPtr login(std::shared_ptr<Session> session);
42  Tinman::LoginInfo complete_login(Ice::AsyncResultPtr async_result);
43  Ice::AsyncResultPtr next_race(std::string nickname);
44  void notify(Tinman::Snapshot snapshot);
45  void disconnect();
46 
47  private:
48  std::string get_endpoint();
49 };
50 #endif
std::pair< std::string, int > socket_
Definition: network.h:16
std::shared_ptr< Adapter > shared
Definition: network.h:35
int seq_number_
Definition: network.h:13
Tinman::AuthoritativeServerPrx dgram_auth_server_
Definition: network.h:31
Definition: network.h:11
std::shared_ptr< Car > shared
Definition: car.h:44
Definition: network.h:28
Car::shared car_
Definition: network.h:32
std::shared_ptr< ControllerObserver > shared
Definition: network.h:15
Definition: session.h:30
Ice::CommunicatorPtr communicator_
Definition: network.h:29
Tinman::LoginInfo login_info_
Definition: network.h:30