DVarListener.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "DVarId.hpp"
4 #include "DVarSystem.hpp"
5 #include <unordered_set>
6 
7 namespace iv
8 {
9 
10 class Instance;
11 class DVarSystem;
12 
17 {
18 public:
19  DVarListener( Instance * inst );
20  ~DVarListener();
21  Instance * instance();
22 
23  void start_dvar_listening( DVarId id );
24  void stop_dvar_listening( DVarId id );
25 
26  virtual void on_dvar_changed( DVarId id, std::type_index type, void * value ) override = 0;
27 
28 private:
29  Instance * inst;
30  DVarSystem * dvs;
31  std::unordered_set< DVarId > listenings;
32 };
33 
34 }