Skip to content

Commit 3233405

Browse files
bakpaulhugtalbot
andauthored
[Core] Move SceneCheckerVisitor out of the SceneChecking project into the core (#6150)
* Move SceneCheckerVisitor out of the SceneChecking project into the core * Fix test compilation * Update Sofa/framework/Simulation/Core/src/sofa/simulation/SceneCheckerVisitor.cpp Co-authored-by: Hugo <hugo.talbot@sofa-framework.org> * Add ocmpatibility layer for scene checking --------- Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
1 parent 2a6e99a commit 3233405

7 files changed

Lines changed: 37 additions & 19 deletions

File tree

Sofa/framework/Simulation/Core/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ set(HEADER_FILES
6868
${SRC_ROOT}/SceneCheckMainRegistry.h
6969
${SRC_ROOT}/MappingGraph.h
7070
${SRC_ROOT}/MappingGraphMechanicalOperations.h
71+
${SRC_ROOT}/SceneCheckerVisitor.h
7172

7273
${SRC_ROOT}/events/BuildConstraintSystemEndEvent.h
7374
${SRC_ROOT}/events/SimulationInitDoneEvent.h
@@ -215,6 +216,7 @@ set(SOURCE_FILES
215216
${SRC_ROOT}/init.cpp
216217
${SRC_ROOT}/fwd.cpp
217218
${SRC_ROOT}/BaseSimulationExporter.cpp
219+
${SRC_ROOT}/SceneCheckerVisitor.cpp
218220

219221
${SRC_ROOT}/events/BuildConstraintSystemEndEvent.cpp
220222
${SRC_ROOT}/events/SimulationInitDoneEvent.cpp

applications/projects/SceneChecking/src/SceneChecking/SceneCheckerVisitor.cpp renamed to Sofa/framework/Simulation/Core/src/sofa/simulation/SceneCheckerVisitor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
* *
2020
* Contact information: contact@sofa-framework.org *
2121
******************************************************************************/
22-
#include "SceneCheckerVisitor.h"
22+
#include <sofa/simulation/SceneCheckerVisitor.h>
2323

24-
#include <algorithm>
2524
#include <sofa/simulation/Node.h>
2625

27-
namespace sofa::_scenechecking_
26+
#include <algorithm>
27+
28+
namespace sofa::simulation
2829
{
2930
using sofa::core::ExecParams ;
3031

applications/projects/SceneChecking/src/SceneChecking/SceneCheckerVisitor.h renamed to Sofa/framework/Simulation/Core/src/sofa/simulation/SceneCheckerVisitor.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
******************************************************************************/
2222
#pragma once
2323

24-
#include <SceneChecking/config.h>
24+
#include <sofa/simulation/config.h>
2525
#include <sofa/simulation/SceneCheck.h>
2626
#include <sofa/core/ExecParams.h>
2727
#include <sofa/simulation/SceneLoaderFactory.h>
@@ -31,10 +31,10 @@
3131

3232
#include <sofa/simulation/Visitor.h>
3333

34-
namespace sofa::_scenechecking_
34+
namespace sofa::simulation
3535
{
3636

37-
class SOFA_SCENECHECKING_API SceneCheckerVisitor : public sofa::simulation::Visitor
37+
class SOFA_SIMULATION_CORE_API SceneCheckerVisitor : public sofa::simulation::Visitor
3838
{
3939
public:
4040
SceneCheckerVisitor(const sofa::core::ExecParams* params = sofa::core::execparams::defaultInstance()) ;
@@ -50,9 +50,4 @@ class SOFA_SCENECHECKING_API SceneCheckerVisitor : public sofa::simulation::Visi
5050
std::vector<sofa::simulation::SceneCheck::SPtr> m_checkset ;
5151
};
5252

53-
} // namespace sofa::_scenechecking_
54-
55-
namespace sofa::scenechecking
56-
{
57-
using _scenechecking_::SceneCheckerVisitor;
58-
} // namespace sofa::scenechecking
53+
} // namespace sofa::simulation

applications/projects/SceneChecking/CMakeLists.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ sofa_find_package(Sofa.Component.Collision.Response.Contact REQUIRED)
1010

1111
set(SCENECHECK_SRC_DIR src/SceneChecking)
1212

13+
set(DEPRECATED_DIR "compat/SceneChecking")
14+
set(DEPRECATED_HEADER_FILES
15+
${DEPRECATED_DIR}/SceneCheckerVisitor.h
16+
)
17+
1318
set(HEADER_FILES
1419
${SCENECHECK_SRC_DIR}/config.h.in
1520
${SCENECHECK_SRC_DIR}/init.h
@@ -24,7 +29,6 @@ set(HEADER_FILES
2429
${SCENECHECK_SRC_DIR}/SceneCheckSpecialCharacters.h
2530
${SCENECHECK_SRC_DIR}/SceneCheckUsingAlias.h
2631
${SCENECHECK_SRC_DIR}/SceneCheckerListener.h
27-
${SCENECHECK_SRC_DIR}/SceneCheckerVisitor.h
2832
)
2933

3034
set(SOURCE_FILES
@@ -40,13 +44,19 @@ set(SOURCE_FILES
4044
${SCENECHECK_SRC_DIR}/SceneCheckSpecialCharacters.cpp
4145
${SCENECHECK_SRC_DIR}/SceneCheckUsingAlias.cpp
4246
${SCENECHECK_SRC_DIR}/SceneCheckerListener.cpp
43-
${SCENECHECK_SRC_DIR}/SceneCheckerVisitor.cpp
4447
)
4548

46-
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
49+
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${DEPRECATED_HEADER_FILES})
4750

4851
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Core Sofa.Component.SceneUtility Sofa.Component.Collision.Response.Contact)
4952

53+
target_include_directories(${PROJECT_NAME} PUBLIC
54+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/compat>
55+
$<INSTALL_INTERFACE:include/${PROJECT_NAME}_compat>
56+
)
57+
58+
install(DIRECTORY compat/ DESTINATION include/${PROJECT_NAME}_compat COMPONENT headers)
59+
5060
sofa_create_package_with_targets(
5161
PACKAGE_NAME ${PROJECT_NAME}
5262
PACKAGE_VERSION ${Sofa_VERSION}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#pragma once
2+
#include <sofa/simulation/SceneCheckerVisitor.h>
3+
SOFA_HEADER_DEPRECATED("v26.06", "v27.06", "sofa/simulation/SceneCheckerVisitor.h")
4+
5+
namespace sofa::scenechecking
6+
{
7+
using SceneCheckerVisitor SOFA_ATTRIBUTE_DEPRECATED("v26.06", "v27.06",
8+
"sofa::scenechecking::SceneCheckerVisitor has been moved to sofa::simulation::SceneCheckerVisitor")
9+
= sofa::simulation::SceneCheckerVisitor;
10+
} // namespace sofa::scenechecking

applications/projects/SceneChecking/src/SceneChecking/SceneCheckerListener.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
******************************************************************************/
2222
#include "SceneCheckerListener.h"
2323

24+
#include <sofa/simulation/SceneCheckerVisitor.h>
2425
#include <sofa/simulation/Node.h>
2526
#include <sofa/simulation/SceneCheckMainRegistry.h>
26-
#include <SceneChecking/SceneCheckerVisitor.h>
2727

2828
namespace sofa::_scenechecking_
2929
{
@@ -38,7 +38,7 @@ void SceneCheckerListener::rightAfterLoadingScene(sofa::simulation::Node::SPtr n
3838
{
3939
if(node.get())
4040
{
41-
sofa::scenechecking::SceneCheckerVisitor sceneCheckerVisitor;
41+
sofa::simulation::SceneCheckerVisitor sceneCheckerVisitor;
4242

4343
for (const auto& sceneCheck : sofa::simulation::SceneCheckMainRegistry::getRegisteredSceneChecks())
4444
{

applications/projects/SceneChecking/tests/SceneChecker_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ using sofa::testing::BaseSimulationTest;
2424

2525
#include <sofa/simulation/Node.h>
2626

27-
#include <SceneChecking/SceneCheckerVisitor.h>
28-
using sofa::scenechecking::SceneCheckerVisitor;
27+
#include <sofa/simulation/SceneCheckerVisitor.h>
28+
using sofa::simulation::SceneCheckerVisitor;
2929

3030
#include <sofa/simulation/SceneCheck.h>
3131
using sofa::simulation::SceneCheck;

0 commit comments

Comments
 (0)