You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include "ILifeCycle.h"
  3. template<class T>
  4. class IInput
  5. : public ILifeCycle
  6. {
  7. public:
  8. const T& getValue() const
  9. {
  10. return m_lastValue;
  11. }
  12. bool hasChanged() const
  13. {
  14. return m_hasChanged;
  15. }
  16. protected:
  17. void setValue(const T& value)
  18. {
  19. if (value != m_lastValue)
  20. {
  21. m_hasChanged = true;
  22. m_lastValue = value;
  23. }
  24. else if (m_hasChanged)
  25. {
  26. m_hasChanged = false;
  27. }
  28. }
  29. T m_lastValue;
  30. bool m_hasChanged;
  31. };