/* * BrakeProxy.cpp * * Created on: 7 окт. 2020 г. * Author: LeonidTitov */ #include "BrakeProxy.hh" technological::proxy::BrakeProxy::BrakeProxy( ResourceKeeper & brake ) : brake(brake), intention(false) {} void technological::proxy::BrakeProxy::engage() { intention = false; if( brake ) { brake->engage(); brake.unlock(); } } void technological::proxy::BrakeProxy::disengage() { intention = true; if( brake or brake.try_lock() ) brake->disengage(); } bool technological::proxy::BrakeProxy::isApplied() const { return (brake) ? brake->isApplied() : false; } bool technological::proxy::BrakeProxy::isFree() const { return (brake) ? brake->isFree() : false; } bool technological::proxy::BrakeProxy::isBlocked() const { return not( brake ) and intention; }