FunctorField.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../Field.hpp"
4 #include <functional>
5 
6 namespace iv
7 {
8 
9 template< class T >
10 class FunctorField : public Field< T >
11 {
12 public:
13  FunctorField( Instance * inst, std::function< void( bool real ) > const & OnChange = nullptr );
14  void OnChange( std::function< void( bool real ) > const & );
15 
16  T Get();
17  void Modify( T const & );
18 
19 protected:
20  virtual void OnChanged( bool real ) override;
21 
22 private:
23  std::function< void( bool ) > change_reporter;
24 };
25 
26 }
27 
28 //================================================================
29 
30 #include "FunctorField.inl"