40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
|
|
/*
|
|||
|
|
* StatusTrigger.cpp
|
|||
|
|
*
|
|||
|
|
* Created on: 4 <EFBFBD><EFBFBD><EFBFBD>. 2020 <EFBFBD>.
|
|||
|
|
* 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) {}
|