Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenMesh
OpenMesh
Commits
6bb9f668
Commit
6bb9f668
authored
Aug 14, 2019
by
Nicolas Gallego-Ortiz
Browse files
name mechanism used for property type checking at retreival, OM_FORCE_STATIC_CAST removed
parent
3e83f731
Changes
1
Show whitespace changes
Inline
Side-by-side
src/OpenMesh/Core/Utils/PropertyContainer.hh
View file @
6bb9f668
...
...
@@ -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
<OpenMesh/Core/Utils/Property.hh>
#include
<OpenMesh/Core/Utils/TypeName.hh>
...
...
@@ -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
<
PropertyT
<
T
>*>
(
properties_
[
idx
])
!=
nullptr
//check type
#endif
&&
(
*
p_it
)
->
internal_type_name
()
==
get_type_name
<
T
>
()
// new check type
)
{
return
BasePropHandleT
<
T
>
(
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
<
PropertyT
<
T
>*>
(
properties_
[
_h
.
idx
()]);
#else
PropertyT
<
T
>*
p
=
dynamic_cast
<
PropertyT
<
T
>*>
(
properties_
[
_h
.
idx
()]);
assert
(
properties_
[
_h
.
idx
()]
->
internal_type_name
()
==
get_type_name
<
T
>
()
);
PropertyT
<
T
>
*
p
=
static_cast
<
PropertyT
<
T
>*
>
(
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
<
PropertyT
<
T
>*>
(
properties_
[
_h
.
idx
()]);
#else
PropertyT
<
T
>*
p
=
dynamic_cast
<
PropertyT
<
T
>*>
(
properties_
[
_h
.
idx
()]);
assert
(
properties_
[
_h
.
idx
()]
->
internal_type_name
()
==
get_type_name
<
T
>
()
);
PropertyT
<
T
>
*
p
=
static_cast
<
PropertyT
<
T
>*
>
(
properties_
[
_h
.
idx
()]);
assert
(
p
!=
nullptr
);
return
*
p
;
#endif
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment