From f1132a1459aa577df9b2084d93a8cf1daeddac6e Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Tue, 23 Apr 2024 18:54:25 -0400 Subject: [PATCH] Use deferred actions to remove the neighbor lists. Messages are now sent to the pipeline output to help the user understand what go deleted. API was changed for DeleteDataAction to emit a warning if the target object does not exist Signed-off-by: Michael Jackson --- .../SimplnxCore/src/SimplnxCore/Filters/MinNeighbors.cpp | 3 ++- .../SimplnxCore/Filters/RemoveMinimumSizeFeaturesFilter.cpp | 2 +- src/simplnx/Filter/Actions/DeleteDataAction.cpp | 2 +- src/simplnx/Utilities/DataGroupUtilities.cpp | 3 +-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/MinNeighbors.cpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/MinNeighbors.cpp index 4517c876e9..3241a742a8 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/MinNeighbors.cpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/MinNeighbors.cpp @@ -3,6 +3,7 @@ #include "simplnx/DataStructure/DataArray.hpp" #include "simplnx/DataStructure/Geometry/ImageGeom.hpp" #include "simplnx/Filter/Actions/DeleteDataAction.hpp" + #include "simplnx/Parameters/ArraySelectionParameter.hpp" #include "simplnx/Parameters/AttributeMatrixSelectionParameter.hpp" #include "simplnx/Parameters/BoolParameter.hpp" @@ -423,7 +424,7 @@ IFilter::PreflightResult MinNeighbors::preflightImpl(const DataStructure& dataSt { ss.append(" " + featureNeighborList.toString() + "\n"); auto action = std::make_unique(featureNeighborList); - resultOutputActions.value().actions.emplace_back(std::move(action)); + resultOutputActions.value().deferredActions.emplace_back(std::move(action)); } // Inform users that the following arrays are going to be modified in place diff --git a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/RemoveMinimumSizeFeaturesFilter.cpp b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/RemoveMinimumSizeFeaturesFilter.cpp index 6f5b8c352b..70caddec5a 100644 --- a/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/RemoveMinimumSizeFeaturesFilter.cpp +++ b/src/Plugins/SimplnxCore/src/SimplnxCore/Filters/RemoveMinimumSizeFeaturesFilter.cpp @@ -389,7 +389,7 @@ IFilter::PreflightResult RemoveMinimumSizeFeaturesFilter::preflightImpl(const Da { ss.append(" " + featureNeighborList.toString() + "\n"); auto action = std::make_unique(featureNeighborList); - resultOutputActions.value().actions.emplace_back(std::move(action)); + resultOutputActions.value().deferredActions.emplace_back(std::move(action)); } // Inform users that the following arrays are going to be modified in place diff --git a/src/simplnx/Filter/Actions/DeleteDataAction.cpp b/src/simplnx/Filter/Actions/DeleteDataAction.cpp index 6caad648e4..12783e718a 100644 --- a/src/simplnx/Filter/Actions/DeleteDataAction.cpp +++ b/src/simplnx/Filter/Actions/DeleteDataAction.cpp @@ -21,7 +21,7 @@ Result<> TerminateNode(DataStructure& dataStructure, const DataPath& path, IData DataObject* targetObject = dataStructure.getData(path); if(targetObject == nullptr) { - return {nonstd::make_unexpected(std::vector{{k_TargetNotFoundErrorCode, fmt::format("Trying to delete DataObject '{}' which does not exist.", path.getTargetName())}})}; + return MakeWarningVoidResult(k_TargetNotFoundErrorCode, fmt::format("Trying to delete DataObject '{}' which does not exist.", path.getTargetName())); } dataStructure.removeData(targetObject->getId()); diff --git a/src/simplnx/Utilities/DataGroupUtilities.cpp b/src/simplnx/Utilities/DataGroupUtilities.cpp index c4592465bd..c56841c197 100644 --- a/src/simplnx/Utilities/DataGroupUtilities.cpp +++ b/src/simplnx/Utilities/DataGroupUtilities.cpp @@ -98,8 +98,7 @@ bool RemoveInactiveObjects(DataStructure& dataStructure, const DataPath& feature std::vector neighborListDataPaths = result.value(); for(const auto& neighborListDataPath : neighborListDataPaths) { - messageHandler( - nx::core::IFilter::Message{nx::core::IFilter::Message::Type::Warning, fmt::format("NeighborList '{}' was removed from the DataStructure.", neighborListDataPath.toString())}); + messageHandler(nx::core::IFilter::Message{nx::core::IFilter::Message::Type::Info, fmt::format("NeighborList '{}' was removed from the DataStructure.", neighborListDataPath.toString())}); dataStructure.removeData(neighborListDataPath); } }