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

52 lines
904 B
C++

/*
* ValueSample.hpp
*
* Created on: 22 èþë. 2020 ã.
* Author: LeonidTitov
*/
#ifndef UMLIBRARY_SCHEMATIC_VALUESAMPLE_HPP_
#define UMLIBRARY_SCHEMATIC_VALUESAMPLE_HPP_
#include "../systemic/IValue.hpp"
#include "../systemic/IProcess.hh"
namespace schematic {
template<typename T>
class ValueSample : public systemic::IProcess {
public:
ValueSample( systemic::IValue<T> & value );
const volatile T & getSample() const;
void process();
private:
systemic::IValue<T> & value;
T temp;
};
}
template<typename T>
inline schematic::ValueSample<T>::ValueSample( systemic::IValue<T> & value ) : value(value) {}
template<typename T>
inline const volatile T& schematic::ValueSample<T>::getSample() const {
return temp;
}
template<typename T>
inline void schematic::ValueSample<T>::process() {
temp = value;
}
#endif /* UMLIBRARY_SCHEMATIC_VALUESAMPLE_HPP_ */