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

52 lines
908 B
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.

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