The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
syncmp_handler.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 #ifndef SYNCMP_HANDLER_HPP_INCLUDED
15 #define SYNCMP_HANDLER_HPP_INCLUDED
16 
17 #include<vector>
18 /*
19  Automaticly registrates itself in the registry in the constructor.
20 */
22 {
23 public:
25  virtual void pull_remote_choice() = 0;
26  virtual void send_user_choice() = 0;
27  virtual ~syncmp_handler();
28 };
29 
31 {
32 public:
33  //called by get_user_choice while waiting for a remote user choice.
34  static void pull_remote_choice();
35  //called when get_user_choice was called and the client wants to send the choice to the other clients immideately
36  static void send_user_choice();
37 private:
38  friend class syncmp_handler;
39  typedef std::vector<syncmp_handler*> t_handlers;
41  static void add_handler(syncmp_handler* handler);
42  static t_handlers& handlers();
43 };
44 
45 #endif
static thandler * handler
Definition: handler.cpp:60
static void remove_handler(syncmp_handler *handler)
static void pull_remote_choice()
std::vector< syncmp_handler * > t_handlers
static t_handlers & handlers()
virtual void pull_remote_choice()=0
static void add_handler(syncmp_handler *handler)
virtual ~syncmp_handler()
static void send_user_choice()
virtual void send_user_choice()=0