MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/schematic/ValueTransformation.hpp
2024-06-07 11:12:56 +03:00

41 lines
1.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 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_ */