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

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

/*
* CounterLazyFast.hpp
*
* Created on: 4 сент. 2020 г.
* Author: ПО и ВТ ЭП
*/
#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_ */