MotorControlModuleSDFM_TMS3.../Projects/EFC_Application/UMLibrary/schematic/ValueTransformation.hpp

41 lines
1.0 KiB
C++

/*
* ValueTransformation.hpp
*
* Created on: 9 èþë. 2020 ã.
* Author: LeonidTitov
*/
#ifndef UMLIBRARY_SCHEMATIC_VALUETRANSFORMATION_HPP_
#define UMLIBRARY_SCHEMATIC_VALUETRANSFORMATION_HPP_
#include "../systemic/IValue.hpp"
namespace schematic {
template<typename T, class Transformation>
class ValueTransformation : public systemic::IValue<T> {
public:
ValueTransformation( systemic::IValue<T> & value, const Transformation & transformation );
operator T() const;
private:
systemic::IValue<T> & value;
const Transformation & transformation;
};
}
template<typename T, class Transformation>
inline schematic::ValueTransformation<T, Transformation>::ValueTransformation(
systemic::IValue<T> & value, const Transformation & transformation ) : value(value), transformation(transformation) {}
template<typename T, class Transformation>
inline schematic::ValueTransformation<T, Transformation>::operator T() const {
return transformation( value );
}
#endif /* UMLIBRARY_SCHEMATIC_VALUETRANSFORMATION_HPP_ */