/* * ControlSystemEnable.hpp * * Created on: 1 февр. 2021 г. * Author: titov */ #ifndef UMLIBRARY_TECHNOLOGICAL_ADAPTER_CONTROLSYSTEMENABLE_HPP_ #define UMLIBRARY_TECHNOLOGICAL_ADAPTER_CONTROLSYSTEMENABLE_HPP_ #include "ControlSystemWrapper.hpp" #include "../../systemic/IStatus.hh" namespace technological { namespace adapter { template class ControlSystemEnable : public TieInterface { public: ControlSystemEnable( TieInterface & tie, systemic::IStatus & enable ); Input * try_connect(); void disconnect(); private: TieInterface & tie; systemic::IStatus & enable; bool connect; }; } } template inline technological::adapter::ControlSystemEnable::ControlSystemEnable( TieInterface & tie, systemic::IStatus & enable ) : tie(tie), enable(enable) {} template inline Input * technological::adapter::ControlSystemEnable::try_connect() { if( connect = enable ) return tie.try_connect(); else return nullptr; } template inline void technological::adapter::ControlSystemEnable::disconnect() { if( connect ) tie.disconnect(); } #endif /* UMLIBRARY_TECHNOLOGICAL_ADAPTER_CONTROLSYSTEMENABLE_HPP_ */