diff --git a/Sofa/framework/Core/CMakeLists.txt b/Sofa/framework/Core/CMakeLists.txt index 0c1c246598f..ea8d668d26b 100644 --- a/Sofa/framework/Core/CMakeLists.txt +++ b/Sofa/framework/Core/CMakeLists.txt @@ -153,11 +153,11 @@ set(HEADER_FILES ${SRC_ROOT}/objectmodel/Base.h ${SRC_ROOT}/objectmodel/BaseClass.h ${SRC_ROOT}/objectmodel/BaseClassNameHelper.h + ${SRC_ROOT}/objectmodel/BaseComponent.h ${SRC_ROOT}/objectmodel/BaseContext.h ${SRC_ROOT}/objectmodel/BaseData.h ${SRC_ROOT}/objectmodel/BaseLink.h ${SRC_ROOT}/objectmodel/BaseNode.h - ${SRC_ROOT}/objectmodel/BaseObject.h ${SRC_ROOT}/objectmodel/BaseObjectDescription.h ${SRC_ROOT}/objectmodel/ClassInfo.h ${SRC_ROOT}/objectmodel/ComponentState.h @@ -303,11 +303,11 @@ set(SOURCE_FILES ${SRC_ROOT}/objectmodel/AspectPool.cpp ${SRC_ROOT}/objectmodel/Base.cpp ${SRC_ROOT}/objectmodel/BaseClass.cpp + ${SRC_ROOT}/objectmodel/BaseComponent.cpp ${SRC_ROOT}/objectmodel/BaseContext.cpp ${SRC_ROOT}/objectmodel/BaseData.cpp ${SRC_ROOT}/objectmodel/BaseLink.cpp ${SRC_ROOT}/objectmodel/BaseNode.cpp - ${SRC_ROOT}/objectmodel/BaseObject.cpp ${SRC_ROOT}/objectmodel/BaseObjectDescription.cpp ${SRC_ROOT}/objectmodel/ClassInfo.cpp ${SRC_ROOT}/objectmodel/ComponentState.cpp @@ -355,6 +355,11 @@ set(SOURCE_FILES ${SRC_ROOT}/visual/VisualState.cpp ) +set(DEPRECATED_DIR "compat/sofa/core") +set(DEPRECATED_HEADER_FILES + ${DEPRECATED_DIR}/objectmodel/BaseObject.h +) + sofa_find_package(Sofa.Topology REQUIRED) sofa_find_package(Sofa.Helper REQUIRED) sofa_find_package(Sofa.DefaultType REQUIRED) @@ -371,6 +376,12 @@ add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Helper Sofa.Topology Sofa.DefaultType) +# For compatibility with renamed files. To remove if all files have been removed in this folder +target_include_directories(${PROJECT_NAME} PUBLIC + $ + $ +) + target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json::nlohmann_json) if(SOFA_BUILD_WITH_PCH_ENABLED) diff --git a/Sofa/framework/Core/compat/sofa/core/objectmodel/BaseObject.h b/Sofa/framework/Core/compat/sofa/core/objectmodel/BaseObject.h new file mode 100644 index 00000000000..0355a52ce80 --- /dev/null +++ b/Sofa/framework/Core/compat/sofa/core/objectmodel/BaseObject.h @@ -0,0 +1,27 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* 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: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#pragma once + +#include +#include + +SOFA_HEADER_DEPRECATED("v26.06", "v29.06", "sofa/core/objectmodel/BaseComponent.h") diff --git a/Sofa/framework/Core/src/sofa/core/config.h.in b/Sofa/framework/Core/src/sofa/core/config.h.in index 3ddb668a2a2..315be9692db 100644 --- a/Sofa/framework/Core/src/sofa/core/config.h.in +++ b/Sofa/framework/Core/src/sofa/core/config.h.in @@ -140,6 +140,13 @@ SOFA_ATTRIBUTE_DEPRECATED("v25.12", "v26.06", "Use getContactDistance or setCont SOFA_ATTRIBUTE_DEPRECATED("v25.12", "v26.12", "Use toBaseLagrangianConstraint instead.") #endif +#ifdef SOFA_BUILD_SOFA_CORE +#define SOFA_ATTRIBUTE_DEPRECATED__TOBASEOBJECT() +#else +#define SOFA_ATTRIBUTE_DEPRECATED__TOBASEOBJECT() \ +SOFA_ATTRIBUTE_DEPRECATED("v26.06", "v29.06", "Use toBaseComponent instead.") +#endif + #ifdef SOFA_BUILD_SOFA_CORE #define SOFA_ATTRIBUTE_DEPRECATED__REBUILDSYSTEM() #else diff --git a/Sofa/framework/Core/src/sofa/core/fwd.h b/Sofa/framework/Core/src/sofa/core/fwd.h index a9ab6b73c8d..07ce7568506 100644 --- a/Sofa/framework/Core/src/sofa/core/fwd.h +++ b/Sofa/framework/Core/src/sofa/core/fwd.h @@ -72,7 +72,8 @@ SOFA_CORE_API SReal dt(const sofa::core::MechanicalParams*); namespace sofa::core::objectmodel { class Base; -class BaseObject; +class BaseComponent; +using BaseObject = BaseComponent; class BaseNode; class BaseContext; class BaseData; @@ -263,7 +264,7 @@ SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::BaseMapping); SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::BehaviorModel); SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::CollisionModel); -SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::objectmodel::BaseObject); +SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::objectmodel::BaseComponent); SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::objectmodel::ContextObject); SOFA_DECLARE_OPAQUE_FUNCTION_BETWEEN_BASE_AND(sofa::core::objectmodel::ConfigurationSetting); diff --git a/Sofa/framework/Core/src/sofa/core/objectmodel/Base.h b/Sofa/framework/Core/src/sofa/core/objectmodel/Base.h index 597c97148ac..adcc0bdeefa 100644 --- a/Sofa/framework/Core/src/sofa/core/objectmodel/Base.h +++ b/Sofa/framework/Core/src/sofa/core/objectmodel/Base.h @@ -410,7 +410,7 @@ class SOFA_CORE_API Base : public IntrusiveObject SOFA_BASE_CAST_DEFINITION( core, CollisionModel ) SOFA_BASE_CAST_DEFINITION( core, DataEngine ) SOFA_BASE_CAST_DEFINITION( objectmodel, BaseContext ) - SOFA_BASE_CAST_DEFINITION( objectmodel, BaseObject ) + SOFA_BASE_CAST_DEFINITION( objectmodel, BaseComponent ) SOFA_BASE_CAST_DEFINITION( objectmodel, BaseNode ) SOFA_BASE_CAST_DEFINITION( objectmodel, ContextObject ) SOFA_BASE_CAST_DEFINITION( objectmodel, ConfigurationSetting ) @@ -444,9 +444,12 @@ class SOFA_CORE_API Base : public IntrusiveObject #undef SOFA_BASE_CAST_DEFINITION - SOFA_ATTRIBUTE_DEPRECATED__TOBASECONSTRAINT() virtual const behavior::BaseLagrangianConstraint* toBaseConstraint() const { return toBaseLagrangianConstraint(); } \ + SOFA_ATTRIBUTE_DEPRECATED__TOBASECONSTRAINT() virtual const behavior::BaseLagrangianConstraint* toBaseConstraint() const { return toBaseLagrangianConstraint(); } SOFA_ATTRIBUTE_DEPRECATED__TOBASECONSTRAINT() virtual behavior::BaseLagrangianConstraint* toBaseConstraint() { return toBaseLagrangianConstraint(); } + SOFA_ATTRIBUTE_DEPRECATED__TOBASEOBJECT() virtual const objectmodel::BaseComponent* toBaseObject() const { return toBaseComponent(); } + SOFA_ATTRIBUTE_DEPRECATED__TOBASEOBJECT() virtual objectmodel::BaseComponent* toBaseObject() { return toBaseComponent(); } + /// @} }; diff --git a/Sofa/framework/Core/src/sofa/core/objectmodel/BaseClass.h b/Sofa/framework/Core/src/sofa/core/objectmodel/BaseClass.h index b81f839b1a5..453e03e3044 100644 --- a/Sofa/framework/Core/src/sofa/core/objectmodel/BaseClass.h +++ b/Sofa/framework/Core/src/sofa/core/objectmodel/BaseClass.h @@ -247,7 +247,8 @@ class SOFA_CORE_API DeprecatedBaseClass : public BaseClass { \ return ::sofa::core::objectmodel::BaseLink::InitLink \ (this, n, help); \ -} +}\ + using BaseObject SOFA_ATTRIBUTE_DEPRECATED("v26.06", "v29.06", "BaseObject has been renamed to BaseComponent") = sofa::core::objectmodel::BaseComponent; // this alias allows the transition from BaseObject to BaseComponent. // Do not use this macro directly, use SOFA_CLASS instead #define SOFA_CLASS_DECL \ diff --git a/Sofa/framework/Core/src/sofa/core/objectmodel/BaseObject.cpp b/Sofa/framework/Core/src/sofa/core/objectmodel/BaseComponent.cpp similarity index 82% rename from Sofa/framework/Core/src/sofa/core/objectmodel/BaseObject.cpp rename to Sofa/framework/Core/src/sofa/core/objectmodel/BaseComponent.cpp index 38f0555076e..827aa9659bb 100644 --- a/Sofa/framework/Core/src/sofa/core/objectmodel/BaseObject.cpp +++ b/Sofa/framework/Core/src/sofa/core/objectmodel/BaseComponent.cpp @@ -19,7 +19,7 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include +#include #include #include #include @@ -32,7 +32,7 @@ namespace sofa::core::objectmodel { -BaseObject::BaseObject() +BaseComponent::BaseComponent() : Base() , f_listening(initData( &f_listening, false, "listening", "if true, handle the events, otherwise ignore the events")) , l_context(initLink("context","Graph Node containing this object (or BaseContext::getDefault() if no graph is used)")) @@ -48,7 +48,7 @@ BaseObject::BaseObject() f_listening.setAutoLink(false); } -BaseObject::~BaseObject() +BaseComponent::~BaseComponent() { assert(l_master.get() == nullptr); // an object that is still a slave should not be able to be deleted, as at least one smart pointer points to it for(auto& slave : l_slaves) @@ -62,7 +62,7 @@ BaseObject::~BaseObject() // This method insures that context is never nullptr (using BaseContext::getDefault() instead) // and that all slaves of an object share its context -void BaseObject::changeContextLink(BaseContext* before, BaseContext*& after) +void BaseComponent::changeContextLink(BaseContext* before, BaseContext*& after) { if (!after) after = BaseContext::getDefault(); if (before == after) return; @@ -81,14 +81,14 @@ void BaseObject::changeContextLink(BaseContext* before, BaseContext*& after) } /// This method insures that slaves objects have master and context links set correctly -void BaseObject::changeSlavesLink(BaseObject::SPtr ptr, std::size_t /*index*/, bool add) +void BaseComponent::changeSlavesLink(BaseComponent::SPtr ptr, std::size_t /*index*/, bool add) { if (!ptr) return; if (add) { ptr->l_master.set(this); ptr->l_context.set(getContext()); } else { ptr->l_master.reset(); ptr->l_context.reset(); } } -void BaseObject::parse( BaseObjectDescription* arg ) +void BaseComponent::parse( BaseObjectDescription* arg ) { if (arg->getAttribute("src")) { @@ -117,13 +117,13 @@ void BaseObject::parse( BaseObjectDescription* arg ) Base::parse(arg); } -void BaseObject::setSrc(const std::string &valueString, std::vector< std::string > *attributeList) +void BaseComponent::setSrc(const std::string &valueString, std::vector< std::string > *attributeList) { std::size_t posAt = valueString.rfind('@'); if (posAt == std::string::npos) posAt = 0; const std::string objectName = valueString.substr(posAt + 1); - const BaseObject* loader = getContext()->get(objectName); + const BaseComponent* loader = getContext()->get(objectName); if (!loader) { msg_error() << "Source object \"" << valueString << "\" NOT FOUND."; @@ -132,9 +132,9 @@ void BaseObject::setSrc(const std::string &valueString, std::vector< std::string setSrc(valueString, loader, attributeList); } -void BaseObject::setSrc(const std::string &valueString, const BaseObject *loader, std::vector< std::string > *attributeList) +void BaseComponent::setSrc(const std::string &valueString, const BaseComponent *loader, std::vector< std::string > *attributeList) { - BaseObject::MapData dataLoaderMap = loader->m_aliasData; + BaseComponent::MapData dataLoaderMap = loader->m_aliasData; if (attributeList != nullptr) { @@ -175,7 +175,7 @@ void BaseObject::setSrc(const std::string &valueString, const BaseObject *loader } } -Base* BaseObject::findLinkDestClass(const BaseClass* destType, const std::string& path, const BaseLink* link) +Base* BaseComponent::findLinkDestClass(const BaseClass* destType, const std::string& path, const BaseLink* link) { if (this->getContext() == BaseContext::getDefault()) return nullptr; @@ -184,32 +184,32 @@ Base* BaseObject::findLinkDestClass(const BaseClass* destType, const std::string } -const BaseContext* BaseObject::getContext() const +const BaseContext* BaseComponent::getContext() const { return l_context.get(); } -BaseContext* BaseObject::getContext() +BaseContext* BaseComponent::getContext() { return l_context.get(); } -const BaseObject* BaseObject::getMaster() const +const BaseComponent* BaseComponent::getMaster() const { return l_master.get(); } -BaseObject* BaseObject::getMaster() +BaseComponent* BaseComponent::getMaster() { return l_master.get(); } -const BaseObject::VecSlaves& BaseObject::getSlaves() const +const BaseComponent::VecSlaves& BaseComponent::getSlaves() const { return l_slaves.getValue(); } -BaseObject* BaseObject::getSlave(const std::string& name) const +BaseComponent* BaseComponent::getSlave(const std::string& name) const { for (auto slave : l_slaves) { @@ -219,9 +219,9 @@ BaseObject* BaseObject::getSlave(const std::string& name) const return nullptr; } -void BaseObject::addSlave(BaseObject::SPtr s) +void BaseComponent::addSlave(BaseComponent::SPtr s) { - const BaseObject::SPtr previous = s->getMaster(); + const BaseComponent::SPtr previous = s->getMaster(); if (previous == this) return; if (previous) previous->l_slaves.remove(s); @@ -232,7 +232,7 @@ void BaseObject::addSlave(BaseObject::SPtr s) this->getContext()->notifyAddSlave(this, s.get()); } -void BaseObject::removeSlave(BaseObject::SPtr s) +void BaseComponent::removeSlave(BaseComponent::SPtr s) { if (l_slaves.remove(s)) { @@ -240,7 +240,7 @@ void BaseObject::removeSlave(BaseObject::SPtr s) } } -void BaseObject::init() +void BaseComponent::init() { for(const auto data: this->m_vecData) { @@ -258,15 +258,15 @@ void BaseObject::init() } } -void BaseObject::bwdInit() +void BaseComponent::bwdInit() { } -void BaseObject::reinit() +void BaseComponent::reinit() { } -void BaseObject::updateInternal() +void BaseComponent::updateInternal() { const auto& mapTrackedData = m_internalDataTracker.getMapTrackedData(); for( auto const& it : mapTrackedData ) @@ -281,17 +281,17 @@ void BaseObject::updateInternal() } } -void BaseObject::trackInternalData(const objectmodel::BaseData& data) +void BaseComponent::trackInternalData(const objectmodel::BaseData& data) { m_internalDataTracker.trackData(data); } -void BaseObject::cleanTracker() +void BaseComponent::cleanTracker() { m_internalDataTracker.clean(); } -bool BaseObject::hasDataChanged(const objectmodel::BaseData& data) +bool BaseComponent::hasDataChanged(const objectmodel::BaseData& data) { bool dataFoundinTracker = false; const auto& mapTrackedData = m_internalDataTracker.getMapTrackedData(); @@ -314,16 +314,16 @@ bool BaseObject::hasDataChanged(const objectmodel::BaseData& data) return m_internalDataTracker.hasChanged(data); } -void BaseObject::doUpdateInternal() +void BaseComponent::doUpdateInternal() { } -void BaseObject::storeResetState() +void BaseComponent::storeResetState() { } -void BaseObject::reset() +void BaseComponent::reset() { } -void BaseObject::cleanup() +void BaseComponent::cleanup() { while (!l_slaves.empty()) { @@ -331,10 +331,10 @@ void BaseObject::cleanup() } } -void BaseObject::handleEvent( Event* /*e*/ ) +void BaseComponent::handleEvent( Event* /*e*/ ) { } -void BaseObject::handleTopologyChange(core::topology::Topology* t) +void BaseComponent::handleTopologyChange(core::topology::Topology* t) { if (t == this->getContext()->getTopology()) { @@ -342,12 +342,12 @@ void BaseObject::handleTopologyChange(core::topology::Topology* t) } } -SReal BaseObject::getTime() const +SReal BaseComponent::getTime() const { return getContext()->getTime(); } -std::string BaseObject::getPathName() const +std::string BaseComponent::getPathName() const { auto node = dynamic_cast(getContext()); if(!node) diff --git a/Sofa/framework/Core/src/sofa/core/objectmodel/BaseObject.h b/Sofa/framework/Core/src/sofa/core/objectmodel/BaseComponent.h similarity index 88% rename from Sofa/framework/Core/src/sofa/core/objectmodel/BaseObject.h rename to Sofa/framework/Core/src/sofa/core/objectmodel/BaseComponent.h index 8b149518b14..667f91a6e39 100644 --- a/Sofa/framework/Core/src/sofa/core/objectmodel/BaseObject.h +++ b/Sofa/framework/Core/src/sofa/core/objectmodel/BaseComponent.h @@ -37,16 +37,16 @@ namespace sofa::core::objectmodel * It is able to process events, if listening enabled (default is false). * */ -class SOFA_CORE_API BaseObject : public virtual Base +class SOFA_CORE_API BaseComponent : public virtual Base { public: - SOFA_CLASS(BaseObject, Base); - SOFA_BASE_CAST_IMPLEMENTATION(BaseObject) + SOFA_CLASS(BaseComponent, Base); + SOFA_BASE_CAST_IMPLEMENTATION(BaseComponent) protected: - BaseObject(); + BaseComponent(); - ~BaseObject() override; + ~BaseComponent() override; public: @@ -126,21 +126,21 @@ class SOFA_CORE_API BaseObject : public virtual Base BaseContext* getContext(); - const BaseObject* getMaster() const; + const BaseComponent* getMaster() const; - BaseObject* getMaster(); + BaseComponent* getMaster(); - typedef sofa::core::objectmodel::MultiLink LinkSlaves; + typedef sofa::core::objectmodel::MultiLink LinkSlaves; typedef LinkSlaves::Container VecSlaves; const VecSlaves& getSlaves() const; - BaseObject* getSlave(const std::string& name) const; + BaseComponent* getSlave(const std::string& name) const; - virtual void addSlave(BaseObject::SPtr s); + virtual void addSlave(BaseComponent::SPtr s); - virtual void removeSlave(BaseObject::SPtr s); + virtual void removeSlave(BaseComponent::SPtr s); /// @} /// @name data access @@ -180,7 +180,7 @@ class SOFA_CORE_API BaseObject : public virtual Base /// Sets a source Object and parses it to collect dependent Data /// Use it before scene graph insertion - void setSrc(const std::string &v, const BaseObject *loader, std::vector< std::string > *attributeList=nullptr); + void setSrc(const std::string &v, const BaseComponent *loader, std::vector< std::string > *attributeList=nullptr); Base* findLinkDestClass(const BaseClass* destType, const std::string& path, const BaseLink* link) override; @@ -205,9 +205,9 @@ class SOFA_CORE_API BaseObject : public virtual Base ///@} /// - SingleLink l_context; + SingleLink l_context; LinkSlaves l_slaves; - SingleLink l_master; + SingleLink l_master; /// Implementation of the internal update virtual void doUpdateInternal(); @@ -217,7 +217,7 @@ class SOFA_CORE_API BaseObject : public virtual Base void changeContextLink(BaseContext* before, BaseContext*& after); /// This method insures that slaves objects have master and context links set correctly - void changeSlavesLink(BaseObject::SPtr ptr, std::size_t /*index*/, bool add); + void changeSlavesLink(BaseComponent::SPtr ptr, std::size_t /*index*/, bool add); /// BaseNode can set the context of its own objects friend class BaseNode; diff --git a/Sofa/framework/Core/test/ObjectFactoryJson_test.cpp b/Sofa/framework/Core/test/ObjectFactoryJson_test.cpp index ce051811eb5..6b9aef3afd9 100644 --- a/Sofa/framework/Core/test/ObjectFactoryJson_test.cpp +++ b/Sofa/framework/Core/test/ObjectFactoryJson_test.cpp @@ -45,7 +45,7 @@ TEST(ObjectFactoryJson, oneObject) .add< simulation::DefaultAnimationLoop >().commitTo(&o), 1); const auto dump = core::ObjectFactoryJson::dump(&o); - const std::string expectedDump = R"x([{"className":"DefaultAnimationLoop","creator":{"":{"class":{"categories":["AnimationLoop"],"className":"DefaultAnimationLoop","namespaceName":"sofa::simulation","parents":["BaseAnimationLoop"],"shortName":"defaultAnimationLoop","templateName":"","typeName":"DefaultAnimationLoop"},"object":{"data":[{"defaultValue":"unnamed","group":"","help":"object name","name":"name","type":"string"},{"defaultValue":"0","group":"","help":"if true, emits extra messages at runtime.","name":"printLog","type":"bool"},{"defaultValue":"","group":"","help":"list of the subsets the object belongs to","name":"tags","type":"TagSet"},{"defaultValue":"","group":"","help":"this object bounding box","name":"bbox","type":"BoundingBox"},{"defaultValue":"Undefined","group":"","help":"The state of the component among (Dirty, Valid, Undefined, Loading, Invalid).","name":"componentState","type":"ComponentState"},{"defaultValue":"0","group":"","help":"if true, handle the events, otherwise ignore the events","name":"listening","type":"bool"},{"defaultValue":"1","group":"","help":"If true, compute the global bounding box of the scene at each time step. Used mostly for rendering.","name":"computeBoundingBox","type":"bool"},{"defaultValue":"0","group":"","help":"If true, solves all the ODEs in parallel","name":"parallelODESolving","type":"bool"}],"link":[{"destinationTypeName":"BaseContext","help":"Graph Node containing this object (or BaseContext::getDefault() if no graph is used)","name":"context"},{"destinationTypeName":"BaseObject","help":"Sub-objects used internally by this object","name":"slaves"},{"destinationTypeName":"BaseObject","help":"nullptr for regular objects, or master object for which this object is one sub-objects","name":"master"},{"destinationTypeName":"BaseNode","help":"Link to the scene's node that will be processed by the loop","name":"targetNode"}]},"target":""}},"description":"foo\n"}])x"; + const std::string expectedDump = R"x([{"className":"DefaultAnimationLoop","creator":{"":{"class":{"categories":["AnimationLoop"],"className":"DefaultAnimationLoop","namespaceName":"sofa::simulation","parents":["BaseAnimationLoop"],"shortName":"defaultAnimationLoop","templateName":"","typeName":"DefaultAnimationLoop"},"object":{"data":[{"defaultValue":"unnamed","group":"","help":"object name","name":"name","type":"string"},{"defaultValue":"0","group":"","help":"if true, emits extra messages at runtime.","name":"printLog","type":"bool"},{"defaultValue":"","group":"","help":"list of the subsets the object belongs to","name":"tags","type":"TagSet"},{"defaultValue":"","group":"","help":"this object bounding box","name":"bbox","type":"BoundingBox"},{"defaultValue":"Undefined","group":"","help":"The state of the component among (Dirty, Valid, Undefined, Loading, Invalid).","name":"componentState","type":"ComponentState"},{"defaultValue":"0","group":"","help":"if true, handle the events, otherwise ignore the events","name":"listening","type":"bool"},{"defaultValue":"1","group":"","help":"If true, compute the global bounding box of the scene at each time step. Used mostly for rendering.","name":"computeBoundingBox","type":"bool"},{"defaultValue":"0","group":"","help":"If true, solves all the ODEs in parallel","name":"parallelODESolving","type":"bool"}],"link":[{"destinationTypeName":"BaseContext","help":"Graph Node containing this object (or BaseContext::getDefault() if no graph is used)","name":"context"},{"destinationTypeName":"BaseComponent","help":"Sub-objects used internally by this object","name":"slaves"},{"destinationTypeName":"BaseComponent","help":"nullptr for regular objects, or master object for which this object is one sub-objects","name":"master"},{"destinationTypeName":"BaseNode","help":"Link to the scene's node that will be processed by the loop","name":"targetNode"}]},"target":""}},"description":"foo\n"}])x"; EXPECT_EQ(dump, expectedDump); } @@ -65,7 +65,7 @@ TEST(ObjectFactoryJson, oneTemplatedObject) const auto dump = core::ObjectFactoryJson::dump(&o); const auto vec3name = core::objectmodel::BaseClassNameHelper::getTypeName(); - const std::string expectedDump = R"x([{"className":"DummyComponent","creator":{"Vec3f":{"class":{"categories":["_Miscellaneous"],"className":"DummyComponent","namespaceName":"sofa","parents":["BaseObject"],"shortName":"dummyComponent","templateName":"Vec3f","typeName":"DummyComponent<)x" + std::string{vec3name} + R"x(>"},"object":{"data":[{"defaultValue":"unnamed","group":"","help":"object name","name":"name","type":"string"},{"defaultValue":"0","group":"","help":"if true, emits extra messages at runtime.","name":"printLog","type":"bool"},{"defaultValue":"","group":"","help":"list of the subsets the object belongs to","name":"tags","type":"TagSet"},{"defaultValue":"","group":"","help":"this object bounding box","name":"bbox","type":"BoundingBox"},{"defaultValue":"Undefined","group":"","help":"The state of the component among (Dirty, Valid, Undefined, Loading, Invalid).","name":"componentState","type":"ComponentState"},{"defaultValue":"0","group":"","help":"if true, handle the events, otherwise ignore the events","name":"listening","type":"bool"}],"link":[{"destinationTypeName":"BaseContext","help":"Graph Node containing this object (or BaseContext::getDefault() if no graph is used)","name":"context"},{"destinationTypeName":"BaseObject","help":"Sub-objects used internally by this object","name":"slaves"},{"destinationTypeName":"BaseObject","help":"nullptr for regular objects, or master object for which this object is one sub-objects","name":"master"}]},"target":""}},"description":"foo\n"}])x"; + const std::string expectedDump = R"x([{"className":"DummyComponent","creator":{"Vec3f":{"class":{"categories":["_Miscellaneous"],"className":"DummyComponent","namespaceName":"sofa","parents":["BaseComponent"],"shortName":"dummyComponent","templateName":"Vec3f","typeName":"DummyComponent<)x" + std::string{vec3name} + R"x(>"},"object":{"data":[{"defaultValue":"unnamed","group":"","help":"object name","name":"name","type":"string"},{"defaultValue":"0","group":"","help":"if true, emits extra messages at runtime.","name":"printLog","type":"bool"},{"defaultValue":"","group":"","help":"list of the subsets the object belongs to","name":"tags","type":"TagSet"},{"defaultValue":"","group":"","help":"this object bounding box","name":"bbox","type":"BoundingBox"},{"defaultValue":"Undefined","group":"","help":"The state of the component among (Dirty, Valid, Undefined, Loading, Invalid).","name":"componentState","type":"ComponentState"},{"defaultValue":"0","group":"","help":"if true, handle the events, otherwise ignore the events","name":"listening","type":"bool"}],"link":[{"destinationTypeName":"BaseContext","help":"Graph Node containing this object (or BaseContext::getDefault() if no graph is used)","name":"context"},{"destinationTypeName":"BaseComponent","help":"Sub-objects used internally by this object","name":"slaves"},{"destinationTypeName":"BaseComponent","help":"nullptr for regular objects, or master object for which this object is one sub-objects","name":"master"}]},"target":""}},"description":"foo\n"}])x"; EXPECT_EQ(dump, expectedDump); }