46 lines
943 B
C++
46 lines
943 B
C++
|
|
/*
|
|||
|
|
* SetValue.hh
|
|||
|
|
*
|
|||
|
|
* Created on: 4 <EFBFBD><EFBFBD><EFBFBD>. 2020 <EFBFBD>.
|
|||
|
|
* Author: LeonidTitov
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#ifndef UMLIBRARY_SCHEMATIC_ACTION_SETVALUE_HH_
|
|||
|
|
#define UMLIBRARY_SCHEMATIC_ACTION_SETVALUE_HH_
|
|||
|
|
|
|||
|
|
#include "../../systemic/IFunctor.hh"
|
|||
|
|
#include "../../systemic/IValueAsync.hpp"
|
|||
|
|
|
|||
|
|
namespace schematic { namespace functor {
|
|||
|
|
|
|||
|
|
template<typename ValueType>
|
|||
|
|
class SetValue : public systemic::IFunctor<void, ValueType> {
|
|||
|
|
|
|||
|
|
typedef systemic::IValueType<ValueType> Value;
|
|||
|
|
typedef systemic::IFunctor<void> Action;
|
|||
|
|
|
|||
|
|
Value & value;
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
SetValue( Value & value );
|
|||
|
|
|
|||
|
|
virtual void operator()( ValueType new_value );
|
|||
|
|
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
template<typename ValueType>
|
|||
|
|
inline schematic::functor::SetValue<ValueType>::SetValue( Value & value ) : value(value) {}
|
|||
|
|
|
|||
|
|
template<typename ValueType>
|
|||
|
|
inline void schematic::functor::SetValue<ValueType>::operator()( ValueType new_value) {
|
|||
|
|
|
|||
|
|
value.set( new_value );
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endif /* UMLIBRARY_SCHEMATIC_ACTION_SETVALUE_HH_ */
|