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

46 lines
962 B
C++
Raw Permalink Normal View History

/*
* CounterLazyFast.hpp
*
* Created on: 4 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>. 2020 <EFBFBD>.
* Author: <EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
*/
#ifndef UMLIBRARY_SYSTEMIC_COUNTERLAZYFAST_HPP_
#define UMLIBRARY_SYSTEMIC_COUNTERLAZYFAST_HPP_
#include "ICounter.hh"
namespace systemic { namespace detail {
template<typename T, uint32_t (T::* pf)() const>
class CounterLazyFast : public ICounter {
private:
const T & object;
public:
CounterLazyFast( const T & obj );
operator uint32_t() const final;
CounterLazyFast(const CounterLazyFast &) = delete;
CounterLazyFast & operator=(const CounterLazyFast &) = delete;
};
}
}
template<typename T, uint32_t (T::*pf)() const>
inline systemic::detail::CounterLazyFast<T, pf>::CounterLazyFast( const T & obj ) :
object(obj) {}
template<typename T, uint32_t (T::*pf)() const>
inline systemic::detail::CounterLazyFast<T, pf>::operator uint32_t() const {
return (object.*pf)();
}
#endif /* UMLIBRARY_SYSTEMIC_COUNTERLAZYFAST_HPP_ */