Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Controller.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2015 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OMNI_INPUT_CONTROLLER_H_
21 #define OMNI_INPUT_CONTROLLER_H_
22 
23 #include <unordered_map>
24 #include "Interface.h"
25 
26 namespace omni {
27  namespace input {
28  /**@brief Input controller controls which inputs are currently active
29  @detail Implemented as a singleton
30  **/
31  class Controller {
32  public:
33  static Controller* instance();
34 
35  bool isActive(input::Interface *) const;
36  int activeCount(input::Interface *) const;
37 
38  void add(input::Interface*);
39 
40  void remove(input::Interface*);
41 
42  /// Activate input
43  void activate(input::Interface *);
44 
45  /// Deactivate input
47 
48  private:
49  Controller();
50  ~Controller();
51 
53 
54  std::unordered_map<input::Interface *, int> usage_;
55  };
56  }
57 }
58 
59 #endif /* OMNI_INPUT_CONTROLLER_H_ */
~Controller()
Definition: Controller.cpp:30
void activate(input::Interface *)
Activate input.
Definition: Controller.cpp:50
void deactivate(input::Interface *)
Deactivate input.
Definition: Controller.cpp:65
Controller()
Definition: Controller.cpp:26
Input controller controls which inputs are currently active Implemented as a singleton.
Definition: Controller.h:31
int activeCount(input::Interface *) const
Definition: Controller.cpp:44
Generic input interface.
Definition: Interface.h:53
static Controller * instance()
Definition: Controller.cpp:33
bool isActive(input::Interface *) const
Definition: Controller.cpp:40
static Controller * instance_
Definition: Controller.h:52
std::unordered_map< input::Interface *, int > usage_
Definition: Controller.h:54
void add(input::Interface *)
Definition: Controller.cpp:76