From 6bb9f668b8328ed58277c70a5a47113322bfed15 Mon Sep 17 00:00:00 2001 From: Nicolas Gallego-Ortiz Date: Wed, 14 Aug 2019 15:20:50 +0200 Subject: [PATCH] name mechanism used for property type checking at retreival, OM_FORCE_STATIC_CAST removed --- src/OpenMesh/Core/Utils/PropertyContainer.hh | 24 ++++---------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/OpenMesh/Core/Utils/PropertyContainer.hh b/src/OpenMesh/Core/Utils/PropertyContainer.hh index 6f1835e4..6d9506c0 100644 --- a/src/OpenMesh/Core/Utils/PropertyContainer.hh +++ b/src/OpenMesh/Core/Utils/PropertyContainer.hh @@ -44,11 +44,6 @@ #ifndef OPENMESH_PROPERTYCONTAINER #define OPENMESH_PROPERTYCONTAINER -// Use static casts when not debugging -#ifdef NDEBUG -#define OM_FORCE_STATIC_CAST -#endif - #include #include @@ -118,10 +113,7 @@ public: { if (*p_it != nullptr && (*p_it)->name() == _name //skip deleted properties -// Skip type check -#ifndef OM_FORCE_STATIC_CAST - && dynamic_cast*>(properties_[idx]) != nullptr //check type -#endif + && (*p_it)->internal_type_name() == get_type_name() // new check type ) { return BasePropHandleT(idx); @@ -147,13 +139,10 @@ public: { assert(_h.idx() >= 0 && _h.idx() < (int)properties_.size()); assert(properties_[_h.idx()] != nullptr); -#ifdef OM_FORCE_STATIC_CAST - return *static_cast *> (properties_[_h.idx()]); -#else - PropertyT* p = dynamic_cast*>(properties_[_h.idx()]); + assert( properties_[_h.idx()]->internal_type_name() == get_type_name() ); + PropertyT *p = static_cast< PropertyT* > (properties_[_h.idx()]); assert(p != nullptr); return *p; -#endif } @@ -161,13 +150,10 @@ public: { assert(_h.idx() >= 0 && _h.idx() < (int)properties_.size()); assert(properties_[_h.idx()] != nullptr); -#ifdef OM_FORCE_STATIC_CAST - return *static_cast*>(properties_[_h.idx()]); -#else - PropertyT* p = dynamic_cast*>(properties_[_h.idx()]); + assert( properties_[_h.idx()]->internal_type_name() == get_type_name() ); + PropertyT *p = static_cast< PropertyT* > (properties_[_h.idx()]); assert(p != nullptr); return *p; -#endif }