MotorControlModuleSDFM_TMS3.../Projects/EFC_Application/UMLibrary/systemic/SignalLazyFast.hpp

46 lines
944 B
C++
Raw Normal View History

/*
* SignalLazy.hpp
*
* Created on: 23 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>. 2018 <EFBFBD>.
* 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_ */