/* * ValueLazyFast.hpp * * Created on: 29 нояб. 2018 г. * Author: titov */ #ifndef SOURCE_SYSTEMIC_VALUELAZYFAST_HPP_ #define SOURCE_SYSTEMIC_VALUELAZYFAST_HPP_ #include "IValue.hpp" #include "IValueOverride.hpp" namespace systemic { namespace detail { template class ValueLazyFast : public IValue { private: const T & object; public: ValueLazyFast( const T & obj ); operator V() const final; ValueLazyFast(const ValueLazyFast &) = delete; ValueLazyFast & operator=(const ValueLazyFast &) = delete; IValue * getValue(); IValueOverride * getValueOverride(); volatile const V * getBase(); ~ValueLazyFast() = default; }; } } template inline systemic::detail::ValueLazyFast::ValueLazyFast( const T & obj ) : object(obj) {} template inline systemic::detail::ValueLazyFast::operator V() const { return (object.*pf)(); } template inline systemic::IValue * systemic::detail::ValueLazyFast::getValue() { return this; } template inline systemic::IValueOverride * systemic::detail::ValueLazyFast::getValueOverride() { return nullptr; } template inline const volatile V * systemic::detail::ValueLazyFast::getBase() { return nullptr; } #endif /* SOURCE_SYSTEMIC_VALUELAZYFAST_HPP_ */