name mechanism used for property type checking at retreival, OM_FORCE_STATIC_CAST removed
This commit is contained in:
@@ -44,11 +44,6 @@
|
|||||||
#ifndef OPENMESH_PROPERTYCONTAINER
|
#ifndef OPENMESH_PROPERTYCONTAINER
|
||||||
#define OPENMESH_PROPERTYCONTAINER
|
#define OPENMESH_PROPERTYCONTAINER
|
||||||
|
|
||||||
// Use static casts when not debugging
|
|
||||||
#ifdef NDEBUG
|
|
||||||
#define OM_FORCE_STATIC_CAST
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <OpenMesh/Core/Utils/Property.hh>
|
#include <OpenMesh/Core/Utils/Property.hh>
|
||||||
#include <OpenMesh/Core/Utils/TypeName.hh>
|
#include <OpenMesh/Core/Utils/TypeName.hh>
|
||||||
|
|
||||||
@@ -118,10 +113,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (*p_it != nullptr &&
|
if (*p_it != nullptr &&
|
||||||
(*p_it)->name() == _name //skip deleted properties
|
(*p_it)->name() == _name //skip deleted properties
|
||||||
// Skip type check
|
&& (*p_it)->internal_type_name() == get_type_name<T>() // new check type
|
||||||
#ifndef OM_FORCE_STATIC_CAST
|
|
||||||
&& dynamic_cast<PropertyT<T>*>(properties_[idx]) != nullptr //check type
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return BasePropHandleT<T>(idx);
|
return BasePropHandleT<T>(idx);
|
||||||
@@ -147,13 +139,10 @@ public:
|
|||||||
{
|
{
|
||||||
assert(_h.idx() >= 0 && _h.idx() < (int)properties_.size());
|
assert(_h.idx() >= 0 && _h.idx() < (int)properties_.size());
|
||||||
assert(properties_[_h.idx()] != nullptr);
|
assert(properties_[_h.idx()] != nullptr);
|
||||||
#ifdef OM_FORCE_STATIC_CAST
|
assert( properties_[_h.idx()]->internal_type_name() == get_type_name<T>() );
|
||||||
return *static_cast <PropertyT<T>*> (properties_[_h.idx()]);
|
PropertyT<T> *p = static_cast< PropertyT<T>* > (properties_[_h.idx()]);
|
||||||
#else
|
|
||||||
PropertyT<T>* p = dynamic_cast<PropertyT<T>*>(properties_[_h.idx()]);
|
|
||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
return *p;
|
return *p;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -161,13 +150,10 @@ public:
|
|||||||
{
|
{
|
||||||
assert(_h.idx() >= 0 && _h.idx() < (int)properties_.size());
|
assert(_h.idx() >= 0 && _h.idx() < (int)properties_.size());
|
||||||
assert(properties_[_h.idx()] != nullptr);
|
assert(properties_[_h.idx()] != nullptr);
|
||||||
#ifdef OM_FORCE_STATIC_CAST
|
assert( properties_[_h.idx()]->internal_type_name() == get_type_name<T>() );
|
||||||
return *static_cast<PropertyT<T>*>(properties_[_h.idx()]);
|
PropertyT<T> *p = static_cast< PropertyT<T>* > (properties_[_h.idx()]);
|
||||||
#else
|
|
||||||
PropertyT<T>* p = dynamic_cast<PropertyT<T>*>(properties_[_h.idx()]);
|
|
||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
return *p;
|
return *p;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user