/* * SubtractValueAsync.cpp * * Created on: 8 θών. 2020 γ. * Author: LeonidTitov */ #include "SubtractValueAsync.hh" void processing::acs::SubtractValueAsync::set( TypeInput input ) { TypeSet val = input - subtrahend; output->set(val); } processing::acs::SubtractValueAsync::TypeOutput processing::acs::SubtractValueAsync::get() const { return processing::acs::SubtractValueAsync::TypeOutput(); } void processing::acs::SubtractValueAsync::set_output( SetInterface * new_output ) { output = new_output; } void processing::acs::SubtractValueAsync::reset() { output = nullptr; } processing::acs::SubtractValueAsync::SubtractValueAsync( systemic::ISignal & subtrahend) : subtrahend(subtrahend), output(nullptr) {} void processing::acs::SubtractValueProcess::set( TypeInput input ) { demand = input; if( output ) proc_enable = true; } processing::acs::SubtractValueProcess::TypeOutput processing::acs::SubtractValueProcess::get() const { return processing::acs::SubtractValueProcess::TypeOutput(); } void processing::acs::SubtractValueProcess::set_output( SetInterface * output_interface ) { if( not output_interface ) proc_enable = false; output = output_interface; } void processing::acs::SubtractValueProcess::reset() { proc_enable = false; demand = 0.0f; } void processing::acs::SubtractValueProcess::process() { if( not proc_enable ) return; TypeSet val = demand - subtrahend; if( proc_enable ) output->set(val); } processing::acs::SubtractValueProcess::SubtractValueProcess( systemic::ISignal & subtrahend ) : subtrahend(subtrahend), output(nullptr), proc_enable(false), demand(0.0f) {}