3rdparty
libpointmatcher
contrib
yaml-cpp-pm
include
yaml-cpp-pm
nodeutil.h
Go to the documentation of this file.
1
#ifndef NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
2
#define NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
3
4
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
5
#pragma once
6
#endif
7
8
9
namespace
YAML_PM
10
{
11
template
<
typename
T,
typename
U>
12
struct
is_same_type
{
13
enum
{
value
=
false
};
14
};
15
16
template
<
typename
T>
17
struct
is_same_type
<T, T> {
18
enum
{
value
=
true
};
19
};
20
21
template
<
typename
T,
bool
check>
22
struct
is_index_type_with_check
{
23
enum
{
value
=
false
};
24
};
25
26
template
<>
struct
is_index_type_with_check
<
std
::size_t, false> {
enum
{
value
=
true
}; };
27
28
#define MAKE_INDEX_TYPE(Type) \
29
template <> struct is_index_type_with_check<Type, is_same_type<Type, std::size_t>::value> { enum { value = true }; }
30
31
MAKE_INDEX_TYPE
(
int
);
32
MAKE_INDEX_TYPE
(
unsigned
);
33
MAKE_INDEX_TYPE
(
short
);
34
MAKE_INDEX_TYPE
(
unsigned
short
);
35
MAKE_INDEX_TYPE
(
long
);
36
MAKE_INDEX_TYPE
(
unsigned
long
);
37
38
#undef MAKE_INDEX_TYPE
39
40
template
<
typename
T>
41
struct
is_index_type
:
public
is_index_type_with_check
<T, false> {};
42
43
// messing around with template stuff to get the right overload for operator [] for a sequence
44
template
<
typename
T,
bool
b>
45
struct
_FindFromNodeAtIndex
{
46
const
Node
*
pRet
;
47
_FindFromNodeAtIndex
(
const
Node
&,
const
T&):
pRet
(0) {}
48
};
49
50
template
<
typename
T>
51
struct
_FindFromNodeAtIndex
<T, true> {
52
const
Node
*
pRet
;
53
_FindFromNodeAtIndex
(
const
Node
& node,
const
T& key):
pRet
(node.FindAtIndex(static_cast<
std
::size_t>(key))) {}
54
};
55
56
template
<
typename
T>
57
inline
const
Node
*
FindFromNodeAtIndex
(
const
Node
& node,
const
T& key) {
58
return
_FindFromNodeAtIndex<T, is_index_type<T>::value
>(node, key).pRet;
59
}
60
}
61
62
#endif // NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
YAML_PM::_FindFromNodeAtIndex< T, true >::pRet
const Node * pRet
Definition:
nodeutil.h:52
YAML_PM
Definition:
aliasmanager.h:11
YAML_PM::FindFromNodeAtIndex
const Node * FindFromNodeAtIndex(const Node &node, const T &key)
Definition:
nodeutil.h:57
YAML_PM::_FindFromNodeAtIndex::pRet
const Node * pRet
Definition:
nodeutil.h:46
YAML_PM::MAKE_INDEX_TYPE
MAKE_INDEX_TYPE(int)
YAML_PM::is_index_type_with_check::value
@ value
Definition:
nodeutil.h:23
YAML_PM::_FindFromNodeAtIndex< T, true >::_FindFromNodeAtIndex
_FindFromNodeAtIndex(const Node &node, const T &key)
Definition:
nodeutil.h:53
YAML_PM::is_index_type_with_check
Definition:
nodeutil.h:22
YAML_PM::Node
Definition:
node.h:33
YAML_PM::_FindFromNodeAtIndex::_FindFromNodeAtIndex
_FindFromNodeAtIndex(const Node &, const T &)
Definition:
nodeutil.h:47
YAML_PM::is_index_type
Definition:
nodeutil.h:41
std
YAML_PM::_FindFromNodeAtIndex
Definition:
nodeutil.h:45
YAML_PM::is_same_type::value
@ value
Definition:
nodeutil.h:13
YAML_PM::is_same_type
Definition:
nodeutil.h:12
mp2p_icp
Author(s):
autogenerated on Fri Dec 20 2024 03:45:59