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