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

69 lines
2.0 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.

/*
* ActionStatusLogic.hh
*
* Created on: 20 мая 2020 г.
* Author: LeonidTitov
*/
#ifndef UMLIBRARY_APPLICATION_SCHEMATIC_ACTIONSTATUSLOGIC_HH_
#define UMLIBRARY_APPLICATION_SCHEMATIC_ACTIONSTATUSLOGIC_HH_
#include "../ISetupStep.hh"
#include "../../systemic/IFunctor.hh"
#include "../../systemic/IStatus.hh"
#include "../../schematic/FunctorLogic.hpp"
namespace application { namespace schematic {
typedef systemic::IFunctor<bool> ActionStatus;
typedef systemic::IFunctor<void> Action;
//!Логическое "И" результатов действий. Реализует логику "a and b".
struct ActionStatusAnd : public ISetupStep {
typedef systemic::detail::FunctorLogic< std::logical_and<bool>, bool > Logic;
ActionStatus * a = nullptr;
ActionStatus * b = nullptr;
bool input( Environment & env );
void build( Environment & env );
struct Links {
Environment::StatusId a; //!<Исходный статус "a".
Environment::StatusId logic_and; //!<Логическое "И" статусов "a" и "b".
Environment::StatusId b; //!<Исходный статус "b".
};
const Links & links;
ActionStatusAnd( const Links & links ) : links(links) {}
};
//!Модуль осуществляет проверку внешнего статуса по событию и возвращает его как результат.
struct CheckCondition : public ISetupStep {
Action * action = nullptr;
systemic::IStatus * condition = nullptr;
bool input( Environment & env );
void build( Environment & env );
struct Links {
Environment::Id action; //!<Действие: момент проверки
Environment::StatusId condition; //!<Условие проверки
Environment::Id check; //!<Результат проверки
};
const Links & links;
CheckCondition( const Links & links ) : links(links) {}
};
}}
#endif /* UMLIBRARY_APPLICATION_SCHEMATIC_ACTIONSTATUSLOGIC_HH_ */