Fire Core  8.0.0.alpha
GIS framework per tutti gli usi
 Tutto Classi Namespace Funzioni Variabili Ridefinizioni di tipo (typedef) Tipi enumerati (enum) Valori del tipo enumerato Friend
Handler.hpp
1 // Copyright 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_GEAR_EVENT_HANDLER_HPP_INCLUDED
5 #define FIRE_GEAR_EVENT_HANDLER_HPP_INCLUDED
6 
7 #include <exception>
8 #include <map>
9 #include <string>
10 #include <set>
11 
12 #include "fire/export.hpp"
13 
14 #include "fire/Object.hpp"
15 
16 namespace fire {
17 namespace gear {
18 namespace event {
19 class Event;
20 } // namespace event
21 } // namespace gear
22 } // namespace fire
23 
24 namespace fire {
25 namespace gear {
26 namespace event {
27 class Listener;
28 } // namespace event
29 } // namespace gear
30 } // namespace fire
31 
36 namespace fire {
41 namespace gear {
46 namespace event {
51 class FIRE_ENGINE_DLL Handler : public fire::Object {
52  private:
57  static std::map< void*, std::map< std::string, fire::gear::event::Event* > > sourceEvents;
58 
59  public:
70  void operator()(const fire::gear::event::Event& event, const std::set< fire::gear::event::Listener* >& listeners) const;
81  static void addEvent(void* source, fire::gear::event::Event* event);
92  static void removeEvent(void* source, fire::gear::event::Event* event);
100  static void removeAllEvent(void* source);
114  static void addEventListener(void* source, const std::string& eventName, fire::gear::event::Listener* listener);
128  static void removeEventListener(void* source, const std::string& eventName, fire::gear::event::Listener* listener);
139  static void removeAllEventListeners(void* source, const std::string& eventName);
150  static void connectEvent(void* source, const std::string& eventName);
161  static void disconnectEvent(void* source, const std::string& eventName);
172  static void raiseEvent(void* source, const fire::gear::event::Event& event);
173 };
174 } // namespace event
175 } // namespace gear
176 } // namespace fire
177 
178 #endif
Classe per la gestione di un evento.
Definition: Event.hpp:45
Classe per la gestione di un oggetto.
Definition: Object.hpp:29
Classe per la gestione di un ascoltatore.
Definition: Listener.hpp:36
Classe per la gestione del gestore degli eventi.
Definition: Handler.hpp:51