MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/processing/acs/SubtractValueAsync.cpp
2024-06-07 11:12:56 +03:00

87 lines
1.7 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.

/*
* 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) {}