ComponentAttr.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 #include <unordered_map>
5 
6 namespace iv
7 {
8 
9 //=================================== ComponentAttr_Index ===========================================
13 template< class Component >
15 {
16 public:
19  iv::Instance * instance() const;
20 
21  void AttributeEvent( iv::AttributeEventProcessor::Event event, Component * component, iv::Attribute * attr, iv::AttributeListener * listener );
22 
23 protected:
24  virtual void Component_AttrChanged( Component * component, iv::Attribute * attr ) = 0;
25 
26 private:
27  iv::Instance * inst;
28  std::unordered_multimap< iv::Attribute *, iv::AttributeListener * > listeners;
29  bool iterating;
30 };
31 
32 //====================================== ComponentAttr ==============================================
36 template< class Component, class T >
38 {
39 public:
40  ComponentAttr( iv::ClientMarker * cm, T const & initial_value = T() );
42 
45 
49  void Index( Component * component, ComponentAttr_Index< Component > * index );
50 
54  void Index();
55 
56 private:
57  virtual void AttributeEvent( iv::AttributeEventProcessor::Event event, iv::Attribute * attr, iv::AttributeListener * listener ) override;
58 
59 private:
60  Component * component;
62 };
63 
64 }
65 
66 #include "ComponentAttr.inl"