/* * ControlStateExternal.hh * * Created on: 27 сент. 2021 г. * Author: titov */ #ifndef UMLIBRARY_TECHNOLOGICAL_DRIVECONTROL_CONTROLSTATEEXTERNAL_HH_ #define UMLIBRARY_TECHNOLOGICAL_DRIVECONTROL_CONTROLSTATEEXTERNAL_HH_ #include "../IExecutorState.hh" #include "../../systemic/IStatus.hh" #include "../../systemic/SharedData.hh" namespace technological { namespace drivecontrol { struct ControlStateExternalComplite : public IExecutorState { bool on_entry() { return state.on_entry(); } bool execute( CommandCode code, const char * args, std::size_t size ) { return state.execute(code, args, size); } CommandCode isComplite() const { return status ? self_code : disable_code; } void reset() { return state.reset(); } void on_exit() { return state.on_exit(); } ControlStateExternalComplite( IExecutorState & state, systemic::IStatus & status, CommandCode self_code, CommandCode disable_code = 0 ); private: systemic::IStatus & status; IExecutorState & state; CommandCode self_code; CommandCode disable_code; }; struct ControlStateExternalArgs : public IExecutorState { bool on_entry() { return state.on_entry(); } bool execute( CommandCode code, const char * args, std::size_t size ); CommandCode isComplite() const { return state.isComplite(); } void reset() { return state.reset(); } void on_exit() { return state.on_exit(); } ControlStateExternalArgs( IExecutorState & state, systemic::SharedData args ); private: systemic::SharedData args; IExecutorState & state; }; }} #endif /* UMLIBRARY_TECHNOLOGICAL_DRIVECONTROL_CONTROLSTATEEXTERNAL_HH_ */