Fix or filter (#6574)

Co-authored-by: Jonathan Swoboda <jonathan.swoboda>
This commit is contained in:
Jonathan Swoboda 2024-04-22 18:48:30 -04:00 committed by GitHub
parent aee2a49cad
commit 0874440a31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -359,11 +359,15 @@ OrFilter::OrFilter(std::vector<Filter *> filters) : filters_(std::move(filters))
OrFilter::PhiNode::PhiNode(OrFilter *or_parent) : or_parent_(or_parent) {} OrFilter::PhiNode::PhiNode(OrFilter *or_parent) : or_parent_(or_parent) {}
optional<float> OrFilter::PhiNode::new_value(float value) { optional<float> OrFilter::PhiNode::new_value(float value) {
if (!this->or_parent_->has_value_) {
this->or_parent_->output(value); this->or_parent_->output(value);
this->or_parent_->has_value_ = true;
}
return {}; return {};
} }
optional<float> OrFilter::new_value(float value) { optional<float> OrFilter::new_value(float value) {
this->has_value_ = false;
for (Filter *filter : this->filters_) for (Filter *filter : this->filters_)
filter->input(value); filter->input(value);

View file

@ -388,6 +388,7 @@ class OrFilter : public Filter {
}; };
std::vector<Filter *> filters_; std::vector<Filter *> filters_;
bool has_value_{false};
PhiNode phi_; PhiNode phi_;
}; };