utils.h
Go to the documentation of this file.
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2014-, Open Perception, Inc.
6
*
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of the copyright holder(s) nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*
36
*/
37
38
#ifndef PCL_GRAPH_UTILS_H
39
#define PCL_GRAPH_UTILS_H
40
41
#include <boost/mpl/has_xxx.hpp>
42
43
namespace
pcl::graph::detail
44
{
45
// Create a meta-function that checks if a type has "graph_type" member
46
// typedef. This will be used to distinguish between boost::subgraph (does
47
// have), and normal graph types (do not have).
48
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_root_graph, graph_type,
false
)
49
}
// namespace pcl::graph::detail
50
51
namespace
pcl::graph
52
{
53
/** remove_edge_if structure is an "extended" version of,
54
* boost::remove_edge_if that incorporates a workaround to allow edge
55
* removal from both plain graphs and subgraphs.
56
*
57
* Plain graphs should be passed to boost::remove_edge_if as is, whereas
58
* member field `m_graph` should be used in place of the subgraphs
59
* (otherwise expect segfaults). */
60
template
<
typename
Graph,
typename
Enable =
void
>
61
struct
remove_edge_if
62
{
63
template
<
typename
Predicate>
64
void
65
operator()
(
const
Predicate& predicate, Graph&
graph
)
const
66
{
67
boost::remove_edge_if(predicate,
graph
);
68
}
69
};
70
71
template
<
typename
Graph>
72
struct
remove_edge_if
<Graph, typename
boost
::enable_if<detail::has_root_graph<Graph>>::type>
73
{
74
template
<
typename
Predicate>
75
void
76
operator()
(
const
Predicate& predicate, Graph&
graph
)
const
77
{
78
boost::remove_edge_if(predicate,
graph
.m_graph);
79
}
80
};
81
82
}
// namespace pcl::graph
83
84
85
#endif
/* PCL_GRAPH_UTILS_H */
boost
Definition
ApplicationOptions.h:38
pcl::graph::detail
Definition
edge_weight_computer.hpp:52
pcl::graph
Definition
common.h:46
pcl::graph::remove_edge_if< Graph, typename boost::enable_if< detail::has_root_graph< Graph > >::type >::operator()
void operator()(const Predicate &predicate, Graph &graph) const
Definition
utils.h:76
pcl::graph::remove_edge_if
remove_edge_if structure is an "extended" version of, boost::remove_edge_if that incorporates a worka...
Definition
utils.h:62
pcl::graph::remove_edge_if::operator()
void operator()(const Predicate &predicate, Graph &graph) const
Definition
utils.h:65
VisionX
libraries
PointCloudGraph
utils.h
Generated by
1.13.2