Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenVolumeMesh
OpenVolumeMesh
Commits
17719a78
Commit
17719a78
authored
Jul 03, 2019
by
Martin Heistermann
Browse files
use internal_type_name in property_exists() instead of dynamic_cast
parent
919e020d
Pipeline
#11277
passed with stage
in 7 minutes and 13 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/OpenVolumeMesh/Core/PropertyDefines.hh
View file @
17719a78
...
...
@@ -84,6 +84,8 @@ template <> const std::string entityTypeName<Entity::Mesh>();
template
<
typename
T
,
typename
Entity
>
class
PropertyTT
:
public
PropertyPtr
<
OpenVolumeMeshPropertyT
<
T
>
,
Entity
>
{
public:
using
value_type
=
T
;
using
entity_type
=
Entity
;
template
<
typename
MeshT
>
PropertyTT
(
MeshT
*
mesh
,
const
std
::
string
&
_name
,
const
T
&
_def
=
T
())
:
PropertyTT
(
std
::
move
(
mesh
->
template
request_property
<
T
,
Entity
>(
_name
,
_def
)))
...
...
src/OpenVolumeMesh/Core/ResourceManager.hh
View file @
17719a78
...
...
@@ -43,6 +43,7 @@
#include
"OpenVolumeMeshProperty.hh"
#include
"PropertyHandles.hh"
#include
"TypeName.hh"
#include
"ForwardDeclarations.hh"
namespace
OpenVolumeMesh
{
...
...
@@ -222,7 +223,9 @@ public:
private:
template
<
class
FullPropT
,
class
PropIterT
>
bool
property_exists
(
const
PropIterT
&
_begin
,
const
PropIterT
&
_end
,
const
std
::
string
&
_name
)
const
{
bool
property_exists
(
const
PropIterT
&
_begin
,
const
PropIterT
&
_end
,
const
std
::
string
&
_name
)
const
{
auto
type_name
=
get_type_name
<
typename
FullPropT
::
value_type
>
();
if
(
_name
.
empty
())
{
#ifndef NDEBUG
...
...
@@ -235,16 +238,10 @@ private:
PropIterT
it
=
_begin
;
for
(;
it
!=
_end
;
++
it
)
{
if
((
*
it
)
->
name
()
==
_name
)
{
#if defined OVM_FORCE_STATIC_CAST && OVM_FORCE_STATIC_CAST
return
true
;
#else
if
(
dynamic_cast
<
FullPropT
*>
(
*
it
)
!=
nullptr
)
if
((
*
it
)
->
name
()
==
_name
&&
(
*
it
)
->
internal_type_name
()
==
type_name
)
{
return
true
;
}
#endif
return
true
;
}
}
return
false
;
...
...
src/OpenVolumeMesh/Core/TypeName.hh
View file @
17719a78
#pragma once
#include
<string>
#include
<typeinfo>
...
...
@@ -6,7 +8,7 @@
/// We need this in order to provide property type safety when
/// only limited RTTI support is available.
template
<
typename
T
>
std
::
string
get_type_name
()
inline
std
::
string
get_type_name
()
{
#ifdef _MSC_VER
// MSVC's type_name only returns a friendly name with .name(),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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