MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/schematic/DiscreteSwitch.hh
2024-06-07 11:12:56 +03:00

40 lines
1.2 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.

/*
* DiscreteSwitch.h
*
* Created on: 21 мая 2021 г.
* Author: sozonov
*/
#ifndef UMLIBRARY_SCHEMATIC_DISCRETESWITCH_HH_
#define UMLIBRARY_SCHEMATIC_DISCRETESWITCH_H_
#include "../systemic/IFunctor.hh"
//!Класс вызова функции при наличии разрешающего статуса.
class DiscreteSwitchLogics {
public:
bool enable; //!<Значение разрешающего статуса.
DiscreteSwitchLogics(){}
//!Входной сигнал. При выставленном разрешающем статусе вызов выходного сигнала.
void inputSignal(){if(enable) outputSignal();}
//!Выходной сигнал.
virtual void outputSignal();
};
namespace application { namespace schematic {
class DiscreteSwitchInterface : public systemic::IFunctor<void>{
public:
systemic::IFunctor<void> & output; //!<Колбэк выходного сигнала.
systemic::IStatus & enable;
DiscreteSwitchInterface(systemic::IFunctor<void> & _out, systemic::IStatus &_enable):output(_out), enable(_enable){}
virtual void operator()() {
if(enable) output();
}
};
}}
#endif /* UMLIBRARY_SCHEMATIC_DISCRETESWITCH_HH_ */