32 lines
1.0 KiB
C++
32 lines
1.0 KiB
C++
/*
|
||
* Brake.cpp
|
||
*
|
||
* Created on: 6 апр. 2021 г.
|
||
* Author: titov
|
||
*/
|
||
|
||
#include "Brake.hh"
|
||
|
||
#include "../../driver/Brake.hh"
|
||
#include "../../systemic/ValueLazyFast.hpp"
|
||
|
||
bool application::board::Brake::input( Environment & env ) {
|
||
|
||
return grab( output, env.rholder.getShared<IDiscreteOutput>( links.discrete_output ) );
|
||
|
||
}
|
||
|
||
void application::board::Brake::build( Environment & env ) {
|
||
|
||
driver::detail::Brake * brake = memories::instance_object<driver::detail::Brake>( env.static_object_ma, *output );
|
||
|
||
env.rholder.share<driver::IBrake>( *brake, links.brake );
|
||
|
||
typedef systemic::detail::ValueLazyFast<bool, driver::detail::Brake, &driver::detail::Brake::isApplied> StatusEngaged;
|
||
env.statuses.add( links.engaged, memories::instance_object<StatusEngaged>( env.static_object_ma, *brake ) );
|
||
|
||
typedef systemic::detail::ValueLazyFast<bool, driver::detail::Brake, &driver::detail::Brake::isFree> StatusDisengaged;
|
||
env.statuses.add( links.disengaged, memories::instance_object<StatusDisengaged>( env.static_object_ma, *brake ) );
|
||
|
||
}
|