52 lines
908 B
C++
52 lines
908 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_ */
|