Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenMesh
OpenMesh
Commits
6bb9f668
Commit
6bb9f668
authored
Aug 14, 2019
by
Nicolas Gallego-Ortiz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
name mechanism used for property type checking at retreival, OM_FORCE_STATIC_CAST removed
parent
3e83f731
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
19 deletions
+5
-19
src/OpenMesh/Core/Utils/PropertyContainer.hh
src/OpenMesh/Core/Utils/PropertyContainer.hh
+5
-19
No files found.
src/OpenMesh/Core/Utils/PropertyContainer.hh
View file @
6bb9f668
...
@@ -44,11 +44,6 @@
...
@@ -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:
...
@@ -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:
...
@@ -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:
...
@@ -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
}
}
...
...
Write
Preview
Markdown
is supported
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