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

45 lines
949 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.

/*
* StatusLazyFast.hpp
*
* Created on: 29 нояб. 2018 г.
* Author: titov
*/
#ifndef SOURCE_SYSTEMIC_STATUSLAZYFAST_HPP_
#define SOURCE_SYSTEMIC_STATUSLAZYFAST_HPP_
#include "IStatus.hh"
#include "IStatusOverride.hh"
namespace systemic { namespace detail {
template<typename T, bool (T::* pf)() const>
class StatusLazyFast : public IStatus {
private:
const T & object;
public:
StatusLazyFast( const T & obj );
operator bool() const final;
StatusLazyFast(const StatusLazyFast &) = delete;
StatusLazyFast & operator=(const StatusLazyFast &) = delete;
};
}
}
template<typename T, bool (T::* pf)() const>
inline systemic::detail::StatusLazyFast<T, pf>::StatusLazyFast( const T & obj ) :
object(obj) {}
template<typename T, bool (T::* pf)() const>
inline systemic::detail::StatusLazyFast<T, pf>::operator bool() const {
return (object.*pf)();
}
#endif /* SOURCE_SYSTEMIC_STATUSLAZYFAST_HPP_ */