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

46 lines
949 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.

/*
* SignalLazy.hpp
*
* Created on: 23 нояб. 2018 г.
* Author: titov
*/
#ifndef SOURCE_SYSTEMIC_SIGNALLAZYFAST_HPP_
#define SOURCE_SYSTEMIC_SIGNALLAZYFAST_HPP_
#include "ISignal.hh"
#include "ISignalOverride.hh"
namespace systemic { namespace detail {
template<typename T, float (T::* pf)() const>
class SignalLazyFast : public ISignal {
private:
const T & object;
public:
SignalLazyFast( const T & obj );
operator float() const final;
SignalLazyFast(const SignalLazyFast &) = delete;
SignalLazyFast & operator=(const SignalLazyFast &) = delete;
};
}
}
template<typename T, float (T::*pf)() const>
inline systemic::detail::SignalLazyFast<T, pf>::SignalLazyFast( const T & obj ) :
object(obj) {}
template<typename T, float (T::*pf)() const>
inline systemic::detail::SignalLazyFast<T, pf>::operator float() const {
return (object.*pf)();
}
#endif /* SOURCE_SYSTEMIC_SIGNALLAZYFAST_HPP_ */