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

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

/*
* StatusTrigger.cpp
*
* Created on: 4 авг. 2020 г.
* Author: LeonidTitov
*/
#include "StatusTrigger.hh"
#include "../../schematic/ResetSetActionTrigger.hh"
#include "../../systemic/FunctorLazyFast.hpp"
void application::schematic::StatusTrigger::build( Environment & env ) {
typedef ::schematic::ResetSetActionTrigger RSTirgger;
RSTirgger * trigger = memories::instance_object<RSTirgger>( env.static_object_ma, config.initial_value );
typedef systemic::detail::FunctorLazyFast<RSTirgger, void> TriggerAction;
typedef systemic::detail::FunctorLazyFast<RSTirgger, void> TriggerAction;
TriggerAction::Function set_f = &RSTirgger::set;
TriggerAction::Function reset_f = &RSTirgger::reset;
TriggerAction * set = memories::instance_object<TriggerAction>( env.static_object_ma, *trigger, set_f );
TriggerAction * reset = memories::instance_object<TriggerAction>( env.static_object_ma, *trigger, reset_f );
typedef systemic::IFunctor<void> Action;
env.rholder.share<Action>(*set, links.set );
env.rholder.share<Action>(*reset, links.reset );
env.statuses.create( links.trigger, trigger->trigger() );
}
application::schematic::StatusTrigger::StatusTrigger( const Links & links, const Setting & config ) : links(links), config(config) {}