diff --git a/Sofa/framework/Core/src/sofa/core/config.h.in b/Sofa/framework/Core/src/sofa/core/config.h.in index 73d8967a7a7b..c07540392b0c 100644 --- a/Sofa/framework/Core/src/sofa/core/config.h.in +++ b/Sofa/framework/Core/src/sofa/core/config.h.in @@ -83,3 +83,12 @@ "v24.12", "v25.06", \ "Data renamed according to the guidelines") #endif + +#ifdef SOFA_BUILD_SOFA_CORE +#define SOFA_ATTRIBUTE_DEPRECATED__UNNECESSARY_PARAMETER_IN_TYPENAME() +#else +#define SOFA_ATTRIBUTE_DEPRECATED__UNNECESSARY_PARAMETER_IN_TYPENAME() \ + SOFA_ATTRIBUTE_DEPRECATED( \ + "v24.12", "v25.06", \ + "The parameter is not necessary. Use the function without parameter.") +#endif diff --git a/Sofa/framework/Core/src/sofa/core/objectmodel/BaseData.h b/Sofa/framework/Core/src/sofa/core/objectmodel/BaseData.h index aaef1b3abe32..bb4e1ba1770d 100644 --- a/Sofa/framework/Core/src/sofa/core/objectmodel/BaseData.h +++ b/Sofa/framework/Core/src/sofa/core/objectmodel/BaseData.h @@ -288,12 +288,19 @@ class SOFA_CORE_API BaseData : public DDGNode /// Helper method to get the type name of type T template - static std::string typeName(const T* = nullptr) + static std::string typeName() { if (defaulttype::DataTypeInfo::ValidInfo) + { return defaulttype::DataTypeName::name(); - else - return decodeTypeName(typeid(T)); + } + return decodeTypeName(typeid(T)); + } + + template + static SOFA_ATTRIBUTE_DEPRECATED__UNNECESSARY_PARAMETER_IN_TYPENAME() std::string typeName(const T*) + { + return typeName(); } protected: