46 lines
944 B
C++
46 lines
944 B
C++
/*
|
|
* 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_ */
|