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

45 lines
944 B
C++

/*
* 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_ */