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
Event.hpp
1 // Copyright 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_GEAR_EVENT_EVENT_HPP_INCLUDED
5 #define FIRE_GEAR_EVENT_EVENT_HPP_INCLUDED
6 
7 #include <boost/signals2/signal.hpp>
8 #include <boost/signals2/connection.hpp>
9 
10 #include <exception>
11 #include <string>
12 #include <set>
13 
14 #include "fire/export.hpp"
15 
16 #include "fire/Object.hpp"
17 
18 namespace fire {
19 namespace gear {
20 namespace event {
21 class Listener;
22 } // namespace event
23 } // namespace gear
24 } // namespace fire
25 
30 namespace fire {
35 namespace gear {
40 namespace event {
45 class FIRE_ENGINE_DLL Event : public fire::Object {
46  private:
51  typedef boost::signals2::signal< void (const fire::gear::event::Event&, const std::set< fire::gear::event::Listener* >&) > Signal;
52 
53  private:
58  void* source;
63  std::string name;
68  bool connected;
73  std::set< fire::gear::event::Listener* > listeners;
78  std::auto_ptr<fire::gear::event::Event::Signal> signal;
83  boost::signals2::connection connection;
84 
85  public:
96  Event(void* source, const std::string& name);
104  Event(const Event& event);
115  fire::gear::event::Event& operator=(const fire::gear::event::Event& event);
120  virtual ~Event();
128  void* getSource() const;
136  std::string getName() const;
144  bool isConnected() const;
152  void addListener(fire::gear::event::Listener* listener);
160  void removeListener(fire::gear::event::Listener* listener);
165  void removeAllListeners();
170  void connect();
175  void disconnect();
180  void raise();
188  void raise(const fire::gear::event::Event& event);
189 };
190 } // namespace event
191 } // namespace gear
192 } // namespace fire
193 
194 #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