MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/technological/adapter/ControlSystemEnable.hpp
2024-06-07 11:12:56 +03:00

56 lines
1.3 KiB
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.

/*
* 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 Input>
class ControlSystemEnable : public TieInterface<Input> {
public:
ControlSystemEnable( TieInterface<Input> & tie, systemic::IStatus & enable );
Input * try_connect();
void disconnect();
private:
TieInterface<Input> & tie;
systemic::IStatus & enable;
bool connect;
};
}
}
template<class Input>
inline technological::adapter::ControlSystemEnable<Input>::ControlSystemEnable(
TieInterface<Input> & tie, systemic::IStatus & enable ) : tie(tie), enable(enable) {}
template<class Input>
inline Input * technological::adapter::ControlSystemEnable<Input>::try_connect() {
if( connect = enable )
return tie.try_connect();
else
return nullptr;
}
template<class Input>
inline void technological::adapter::ControlSystemEnable<Input>::disconnect() {
if( connect )
tie.disconnect();
}
#endif /* UMLIBRARY_TECHNOLOGICAL_ADAPTER_CONTROLSYSTEMENABLE_HPP_ */