Skip to content

Commit

Permalink
[Simulation.Core] Deprecate LocalStorage feature (#4327)
Browse files Browse the repository at this point in the history
* remove unused local storage feat

* deprecate localstorage and impl

* restore and deprecate functions using localstorage

---------

Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
  • Loading branch information
fredroy and hugtalbot authored Dec 8, 2023
1 parent da70359 commit 384d495
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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*/);
Expand Down Expand Up @@ -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*/);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <sofa/simulation/LocalStorage.h>
#include <stack>

SOFA_HEADER_DEPRECATED_LOCALSTORAGE()


namespace sofa
{
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#ifndef SOFA_SIMULATION_TREE_LOCALSTORAGE_H
#define SOFA_SIMULATION_TREE_LOCALSTORAGE_H

#include <sofa/simulation/config.h>

SOFA_HEADER_DEPRECATED_LOCALSTORAGE()

namespace sofa
{

Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions Sofa/framework/Simulation/Core/src/sofa/simulation/Visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions Sofa/framework/Simulation/Core/src/sofa/simulation/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion Sofa/framework/Simulation/Core/src/sofa/simulation/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ namespace sofa::simulation
*/
SOFA_SIMULATION_CORE_API Simulation* getSimulation();

class LocalStorage;
class MutationListener;
class Visitor;

Expand Down

0 comments on commit 384d495

Please sign in to comment.