Skip to content

Commit

Permalink
[Core] Deprecate typeName with parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
alxbilger committed Jul 10, 2024
1 parent b679a97 commit 099a254
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Sofa/framework/Core/src/sofa/core/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 10 additions & 3 deletions Sofa/framework/Core/src/sofa/core/objectmodel/BaseData.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,19 @@ class SOFA_CORE_API BaseData : public DDGNode

/// Helper method to get the type name of type T
template<class T>
static std::string typeName(const T* = nullptr)
static std::string typeName()
{
if (defaulttype::DataTypeInfo<T>::ValidInfo)
{
return defaulttype::DataTypeName<T>::name();
else
return decodeTypeName(typeid(T));
}
return decodeTypeName(typeid(T));
}

template<class T>
static SOFA_ATTRIBUTE_DEPRECATED__UNNECESSARY_PARAMETER_IN_TYPENAME() std::string typeName(const T*)
{
return typeName<T>();
}

protected:
Expand Down

0 comments on commit 099a254

Please sign in to comment.