From 9e85eb1b37a280b2c45889a2705b42c522a303b8 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Mon, 6 May 2024 17:19:57 +0200 Subject: [PATCH 1/3] Found an empty module name --- BeamAdapter_test/CMakeLists.txt | 1 + .../AdaptiveBeamController_test.cpp | 38 +++++++++++++++++++ .../controller/AdaptiveBeamController.cpp | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 BeamAdapter_test/component/controller/AdaptiveBeamController_test.cpp diff --git a/BeamAdapter_test/CMakeLists.txt b/BeamAdapter_test/CMakeLists.txt index 60ee3438b..701022474 100644 --- a/BeamAdapter_test/CMakeLists.txt +++ b/BeamAdapter_test/CMakeLists.txt @@ -7,6 +7,7 @@ find_package(Threads REQUIRED) set(SOURCE_FILES BeamInterpolation_test.cpp + component/controller/AdaptiveBeamController_test.cpp component/controller/InterventionalRadiologyController_test.cpp component/constraint/AdaptiveBeamSlidingConstraintTest.cpp component/forcefield/AdaptiveBeamForceFieldAndMassTest.cpp diff --git a/BeamAdapter_test/component/controller/AdaptiveBeamController_test.cpp b/BeamAdapter_test/component/controller/AdaptiveBeamController_test.cpp new file mode 100644 index 000000000..65e14285e --- /dev/null +++ b/BeamAdapter_test/component/controller/AdaptiveBeamController_test.cpp @@ -0,0 +1,38 @@ +/****************************************************************************** +* BeamAdapter plugin * +* (c) 2006 Inria, University of Lille, CNRS * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: see Authors.md * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include +#include +#include +#include + +TEST(AdaptiveBeamController, target) +{ + const auto node = sofa::simpleapi::createNode("node"); + const auto controller = sofa::simpleapi::createObject(node, "AdaptiveBeamController"); + + const auto& creators = sofa::core::ObjectFactory::getInstance()->getEntry("AdaptiveBeamController").creatorMap; + + const auto it = creators.find(sofa::defaulttype::Rigid3Types::Name()); + EXPECT_NE(it, creators.end()); + + EXPECT_EQ(std::string(it->second->getTarget()), std::string("BeamAdapter")); +} diff --git a/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp b/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp index a6e634d4e..8a2c10a77 100644 --- a/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp +++ b/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp @@ -58,7 +58,7 @@ using core::RegisterObject; //////////////////////////////////////////////////////////////////////////////////////////////////// //TODO(dmarchal 2017-06-01): Il faut remplacer les descriptions dans RegisterObject par un vrai description -static int AdaptiveBeamControllerClass = RegisterObject("") +static int AdaptiveBeamControllerClass = RegisterObject("Adaptive beam controller") .add< AdaptiveBeamController >() ; From 4fd85861b041ed4bfe9afe6244e4a3a454759ffb Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Tue, 7 May 2024 15:15:44 +0200 Subject: [PATCH 2/3] move config.h include before the include of ObjectFactory.h --- src/BeamAdapter/component/BeamInterpolation.cpp | 1 + .../constraint/AdaptiveBeamSlidingConstraint.cpp | 1 + .../component/controller/AdaptiveBeamController.cpp | 10 ++++------ .../component/controller/AdaptiveBeamController.h | 1 + .../controller/BeamAdapterActionController.cpp | 2 +- .../controller/InterventionalRadiologyController.cpp | 2 +- .../component/controller/SutureController.cpp | 1 + .../forcefield/AdaptiveBeamForceFieldAndMass.cpp | 1 + .../forcefield/AdaptiveInflatableBeamForceField.cpp | 1 + .../component/mapping/AdaptiveBeamMapping.cpp | 1 + .../component/mapping/BeamLengthMapping.cpp | 1 + 11 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/BeamAdapter/component/BeamInterpolation.cpp b/src/BeamAdapter/component/BeamInterpolation.cpp index c3a225c70..2c00c629c 100644 --- a/src/BeamAdapter/component/BeamInterpolation.cpp +++ b/src/BeamAdapter/component/BeamInterpolation.cpp @@ -33,6 +33,7 @@ #define SOFA_PLUGIN_BEAMADAPTER_BEAMINTERPOLATION_CPP #include +#include #include /// This define is here to prevent the declaration of the template instances as "extern". diff --git a/src/BeamAdapter/component/constraint/AdaptiveBeamSlidingConstraint.cpp b/src/BeamAdapter/component/constraint/AdaptiveBeamSlidingConstraint.cpp index 9dfb476bc..de8e3a62f 100644 --- a/src/BeamAdapter/component/constraint/AdaptiveBeamSlidingConstraint.cpp +++ b/src/BeamAdapter/component/constraint/AdaptiveBeamSlidingConstraint.cpp @@ -23,6 +23,7 @@ //////////////////////// Inclusion of headers...from wider to narrower/closer ////////////////////// #include +#include #include #include diff --git a/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp b/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp index 8a2c10a77..d4094b39c 100644 --- a/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp +++ b/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp @@ -34,18 +34,16 @@ #define SOFA_PLUGIN_BEAMADAPTER_ADAPTIVEBEAMCONTROLLER_CPP //////////////////////// Inclusion of headers...from wider to narrower/closer ////////////////////// +#include #include #include #include -#include #include - -namespace sofa::component::controller::_adaptivebeamcontroller_ +namespace sofa::component::controller { -using sofa::defaulttype::Rigid3Types; using sofa::defaulttype::Rigid3Types; using core::RegisterObject; @@ -58,13 +56,13 @@ using core::RegisterObject; //////////////////////////////////////////////////////////////////////////////////////////////////// //TODO(dmarchal 2017-06-01): Il faut remplacer les descriptions dans RegisterObject par un vrai description -static int AdaptiveBeamControllerClass = RegisterObject("Adaptive beam controller") +int AdaptiveBeamControllerClass = RegisterObject("Adaptive beam controller") .add< AdaptiveBeamController >() ; template class SOFA_BEAMADAPTER_API AdaptiveBeamController; -} // namespace sofa::component::controller::_adaptivebeamcontroller_ +} // namespace sofa::component::controller diff --git a/src/BeamAdapter/component/controller/AdaptiveBeamController.h b/src/BeamAdapter/component/controller/AdaptiveBeamController.h index a62525801..7d8bb3c3d 100644 --- a/src/BeamAdapter/component/controller/AdaptiveBeamController.h +++ b/src/BeamAdapter/component/controller/AdaptiveBeamController.h @@ -43,6 +43,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// /// Declarations diff --git a/src/BeamAdapter/component/controller/BeamAdapterActionController.cpp b/src/BeamAdapter/component/controller/BeamAdapterActionController.cpp index 604c673c9..2ba73ecb4 100644 --- a/src/BeamAdapter/component/controller/BeamAdapterActionController.cpp +++ b/src/BeamAdapter/component/controller/BeamAdapterActionController.cpp @@ -21,11 +21,11 @@ ******************************************************************************/ #define SOFA_PLUGIN_BEAMADAPTER_ACTIONCONTROLLER_CPP +#include #include #include #include -#include #include namespace sofa::component::controller diff --git a/src/BeamAdapter/component/controller/InterventionalRadiologyController.cpp b/src/BeamAdapter/component/controller/InterventionalRadiologyController.cpp index 716c8b6fd..bd2a9ddf8 100644 --- a/src/BeamAdapter/component/controller/InterventionalRadiologyController.cpp +++ b/src/BeamAdapter/component/controller/InterventionalRadiologyController.cpp @@ -32,11 +32,11 @@ // #define SOFA_PLUGIN_BEAMADAPTER_INTERVENTIONALRADIOCONTROLLER_CPP +#include #include #include #include -#include #include diff --git a/src/BeamAdapter/component/controller/SutureController.cpp b/src/BeamAdapter/component/controller/SutureController.cpp index 5f3225286..f56cea48a 100644 --- a/src/BeamAdapter/component/controller/SutureController.cpp +++ b/src/BeamAdapter/component/controller/SutureController.cpp @@ -32,6 +32,7 @@ // #define SOFA_PLUGIN_BEAMADAPTER_SUTURECONTROLLER_CPP +#include #include #include diff --git a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.cpp b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.cpp index 892221b2e..82eb192c5 100644 --- a/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.cpp +++ b/src/BeamAdapter/component/forcefield/AdaptiveBeamForceFieldAndMass.cpp @@ -34,6 +34,7 @@ //////////////////////// Inclusion of headers...from wider to narrower/closer ////////////////////// #include +#include #include #include diff --git a/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.cpp b/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.cpp index 44fa6b3d2..45b2b1b9f 100644 --- a/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.cpp +++ b/src/BeamAdapter/component/forcefield/AdaptiveInflatableBeamForceField.cpp @@ -34,6 +34,7 @@ //////////////////////// Inclusion of headers...from wider to narrower/closer ////////////////////// #include +#include #include #include diff --git a/src/BeamAdapter/component/mapping/AdaptiveBeamMapping.cpp b/src/BeamAdapter/component/mapping/AdaptiveBeamMapping.cpp index e8c172866..670fa3eb6 100644 --- a/src/BeamAdapter/component/mapping/AdaptiveBeamMapping.cpp +++ b/src/BeamAdapter/component/mapping/AdaptiveBeamMapping.cpp @@ -34,6 +34,7 @@ //////////////////////// Inclusion of headers...from wider to narrower/closer ////////////////////// #include +#include #include #include diff --git a/src/BeamAdapter/component/mapping/BeamLengthMapping.cpp b/src/BeamAdapter/component/mapping/BeamLengthMapping.cpp index 0606eefd0..89a9a6ab4 100644 --- a/src/BeamAdapter/component/mapping/BeamLengthMapping.cpp +++ b/src/BeamAdapter/component/mapping/BeamLengthMapping.cpp @@ -34,6 +34,7 @@ //////////////////////// Inclusion of headers...from wider to narrower/closer ////////////////////// #define BEAMADAPTER_BEAMLENGTHMAPPING_CPP #include +#include #include #include From 9959fcc032923ed1b83d5b90fc0e487b50b891f8 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Mon, 13 May 2024 08:51:35 +0200 Subject: [PATCH 3/3] restore namespace --- .../component/controller/AdaptiveBeamController.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp b/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp index d4094b39c..1961cc924 100644 --- a/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp +++ b/src/BeamAdapter/component/controller/AdaptiveBeamController.cpp @@ -41,7 +41,7 @@ #include -namespace sofa::component::controller +namespace sofa::component::controller::_adaptivebeamcontroller_ { using sofa::defaulttype::Rigid3Types; @@ -63,6 +63,6 @@ int AdaptiveBeamControllerClass = RegisterObject("Adaptive beam controller") template class SOFA_BEAMADAPTER_API AdaptiveBeamController; -} // namespace sofa::component::controller +} // namespace sofa::component::controller::_adaptivebeamcontroller_