GenericListener.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
5 namespace iv
6 {
7 
8 template< class Listener >
10 
11 //========================= GenericListener ============================
15 template< class Listener >
17 {
18 public:
20 
23 
24  iv::Instance * instance() const;
25 
29  void Initialize();
30 
34  void VerifyInitialization();
35 
36 private:
37  iv::Instance * inst;
39  bool initialized;
40 };
41 
42 //========================= GenericListener_Index ============================
46 template< class Listener >
48 {
49 public:
51 
53  iv::Instance * instance() const;
54 
55  // called by listeners
56  void AddListener( Listener * );
57  void RemoveListener( Listener * );
58  void InitializeListener( Listener * );
59 
60  // called by owner
61  template< class ... Params >
62  void InvokeListeners( void( Listener::* member )( Params ... ), Params ... params );
63 
64 
65 protected:
69  virtual void Listener_Initialize( Listener * ) = 0;
70 
71 private:
72  iv::Instance * inst;
74 };
75 
76 }
77 
78 #include "GenericListener.inl"