From 384d495c10ac33d3d88e38dd7b79b45848cfc13f Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Sat, 9 Dec 2023 01:10:46 +0900 Subject: [PATCH] [Simulation.Core] Deprecate LocalStorage feature (#4327) * remove unused local storage feat * deprecate localstorage and impl * restore and deprecate functions using localstorage --------- Co-authored-by: Hugo --- .../Core/src/sofa/simulation/BaseMechanicalVisitor.h | 6 ++++-- .../Core/src/sofa/simulation/CactusStackStorage.h | 3 +++ .../Simulation/Core/src/sofa/simulation/LocalStorage.h | 5 +++++ .../Simulation/Core/src/sofa/simulation/Visitor.h | 2 ++ .../Simulation/Core/src/sofa/simulation/config.h.in | 10 ++++++++++ .../Simulation/Core/src/sofa/simulation/fwd.h | 1 - 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/BaseMechanicalVisitor.h b/Sofa/framework/Simulation/Core/src/sofa/simulation/BaseMechanicalVisitor.h index a52ae7f2b50..bd25f9e25b7 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/BaseMechanicalVisitor.h +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/BaseMechanicalVisitor.h @@ -79,7 +79,8 @@ class SOFA_SIMULATION_CORE_API BaseMechanicalVisitor : public Visitor /// Parallel version of processNodeTopDown. /// This method calls the fwd* methods during the forward traversal. You typically do not overload it. - Result processNodeTopDown(simulation::Node* node, LocalStorage* stack) override; + SOFA_ATTRIBUTE_DEPRECATED_LOCALSTORAGE() + Result processNodeTopDown(simulation::Node * node, LocalStorage * stack) override; /// Process the OdeSolver virtual Result fwdOdeSolver(simulation::Node* /*node*/, sofa::core::behavior::OdeSolver* /*solver*/); @@ -169,7 +170,8 @@ class SOFA_SIMULATION_CORE_API BaseMechanicalVisitor : public Visitor /// Parallel version of processNodeBottomUp. /// This method calls the bwd* methods during the backward traversal. You typically do not overload it. - void processNodeBottomUp(simulation::Node* /*node*/, LocalStorage* stack) override; + SOFA_ATTRIBUTE_DEPRECATED_LOCALSTORAGE() + void processNodeBottomUp(simulation::Node* /*node*/, LocalStorage * stack) override; /// Process the BaseMechanicalState when it is not mapped from parent level virtual void bwdMechanicalState(simulation::Node* /*node*/,sofa::core::behavior::BaseMechanicalState* /*mm*/); diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/CactusStackStorage.h b/Sofa/framework/Simulation/Core/src/sofa/simulation/CactusStackStorage.h index 6afb0cca3df..4bb1222f39f 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/CactusStackStorage.h +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/CactusStackStorage.h @@ -26,6 +26,8 @@ #include #include +SOFA_HEADER_DEPRECATED_LOCALSTORAGE() + namespace sofa { @@ -36,6 +38,7 @@ namespace simulation /// Cactus Stack implementation of LocalStorage. /// See http://www.nist.gov/dads/HTML/cactusstack.html +SOFA_ATTRIBUTE_DEPRECATED_LOCALSTORAGE() class SOFA_SIMULATION_CORE_API CactusStackStorage : public simulation::LocalStorage { protected: diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/LocalStorage.h b/Sofa/framework/Simulation/Core/src/sofa/simulation/LocalStorage.h index f06d2a3c528..2df86d938c2 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/LocalStorage.h +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/LocalStorage.h @@ -22,6 +22,10 @@ #ifndef SOFA_SIMULATION_TREE_LOCALSTORAGE_H #define SOFA_SIMULATION_TREE_LOCALSTORAGE_H +#include + +SOFA_HEADER_DEPRECATED_LOCALSTORAGE() + namespace sofa { @@ -32,6 +36,7 @@ namespace simulation class Visitor; /// Abstract class allowing actions to store local data as a stack while traversing the graph. +SOFA_ATTRIBUTE_DEPRECATED_LOCALSTORAGE() class LocalStorage { protected: diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/Visitor.h b/Sofa/framework/Simulation/Core/src/sofa/simulation/Visitor.h index 42d0fb245e7..90b09b3da91 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/Visitor.h +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/Visitor.h @@ -160,10 +160,12 @@ class SOFA_SIMULATION_CORE_API Visitor /// Callback method called when decending to a new node. Recursion will stop if this method returns RESULT_PRUNE /// This version is offered a LocalStorage to store temporary data + SOFA_ATTRIBUTE_DEPRECATED_LOCALSTORAGE() virtual Result processNodeTopDown(simulation::Node* node, LocalStorage*) { return processNodeTopDown(node); } /// Callback method called after child node have been processed and before going back to the parent node. /// This version is offered a LocalStorage to store temporary data + SOFA_ATTRIBUTE_DEPRECATED_LOCALSTORAGE() virtual void processNodeBottomUp(simulation::Node* node, LocalStorage*) { processNodeBottomUp(node); } typedef sofa::core::objectmodel::Tag Tag; diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/config.h.in b/Sofa/framework/Simulation/Core/src/sofa/simulation/config.h.in index dce81618ee4..a949327fc2c 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/config.h.in +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/config.h.in @@ -238,3 +238,13 @@ SOFA_ATTRIBUTE_DEPRECATED( \ #define SOFA_HEADER_DEPRECATED_PARALLELVISITORSCHEDULER() \ SOFA_DEPRECATED_HEADER_NOT_REPLACED("v23.12", "v24.06") #endif // SOFA_BUILD_SOFA_SIMULATION_CORE + +#ifdef SOFA_BUILD_SOFA_SIMULATION_CORE +#define SOFA_HEADER_DEPRECATED_LOCALSTORAGE() +#define SOFA_ATTRIBUTE_DEPRECATED_LOCALSTORAGE() +#else +#define SOFA_HEADER_DEPRECATED_LOCALSTORAGE() \ + SOFA_DEPRECATED_HEADER_NOT_REPLACED("v23.12", "v24.06") +#define SOFA_ATTRIBUTE_DEPRECATED_LOCALSTORAGE() \ + SOFA_ATTRIBUTE_DEPRECATED("v23.12", "v24.06", "LocalStorage feature was seemingly not used so it has been deprecated.") +#endif // SOFA_BUILD_SOFA_SIMULATION_CORE diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/fwd.h b/Sofa/framework/Simulation/Core/src/sofa/simulation/fwd.h index 69e091bca8a..ca6ae46f75b 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/fwd.h +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/fwd.h @@ -46,7 +46,6 @@ namespace sofa::simulation */ SOFA_SIMULATION_CORE_API Simulation* getSimulation(); - class LocalStorage; class MutationListener; class Visitor;