point_cloud_graph_concept.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_POINT_CLOUD_GRAPH_CONCEPT_H
39#define PCL_GRAPH_POINT_CLOUD_GRAPH_CONCEPT_H
40
41#include <boost/concept/detail/concept_def.hpp>
42#include <boost/graph/graph_concepts.hpp>
43
45{
46
47 /** \class pcl::graph::concepts::PointCloudGraphConcept
48 *
49 * A PointCloudGraph is a graph that has PCL points bundled in
50 * vertices and can be viewed as a PCL point cloud (without data-copying).
51 *
52 * This concept is a refinement of [PropertyGraph]. Please refer to
53 * [BGL concepts][GraphConcepts] for a complete list of graph-related
54 * concepts in boost.
55 *
56 * [PropertyGraph]: http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/PropertyGraph.html
57 * [GraphConcepts]: http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/graph_concepts.html
58 *
59 *
60 * ## Notation ##
61 *
62 *
63 * - `G` a type that is a model of PointCloudGraph
64 * - `g` an object of type `G`
65 *
66 *
67 * ## Associated types ##
68 *
69 *
70 * - `pcl::graph::point_cloud_graph_traits<G>::point_type`
71 *
72 * The type of PCL points bundled in vertices.
73 *
74 * - `pcl::graph::point_cloud_graph_traits<G>::point_cloud_type`
75 *
76 * The type of PCL point cloud this graph can be viewed as.
77 *
78 * - `pcl::graph::point_cloud_graph_traits<G>::point_cloud_ptr`
79 *
80 * The type of a shared pointer to PCL point cloud this graph can be
81 * viewed as.
82 *
83 * - `pcl::graph::point_cloud_graph_traits<G>::point_cloud_const_ptr`
84 *
85 * The type of a shared pointer to const PCL point cloud this graph can
86 * be viewed as.
87 *
88 *
89 * ## Valid expressions ##
90 *
91 * - `G (point_cloud_ptr)`
92 * - \ref pcl::graph::point_cloud() "pcl::graph::point_cloud (g)"
93 * - \ref pcl::graph::indices() "pcl::graph::indices (g)"
94 *
95 *
96 * ## Models ##
97 *
98 *
99 * - `pcl::graph::point_cloud_graph`
100 * - `boost::subgraph<pcl::graph::point_cloud_graph>`
101 *
102 * \author Sergey Alexandrov
103 * \ingroup graph
104 */
105
106 BOOST_concept(PointCloudGraph, (G)) : boost::concepts::Graph<G>
107 {
108
109 typedef typename boost::vertex_bundle_type<G>::type vertex_bundled;
110 typedef typename boost::graph_traits<G>::vertex_descriptor vertex_descriptor;
111 typedef typename point_cloud_graph_traits<G>::point_type point_type;
112 typedef typename point_cloud_graph_traits<G>::point_cloud_type point_cloud_type;
113 typedef typename point_cloud_graph_traits<G>::point_cloud_ptr point_cloud_ptr;
114 typedef typename point_cloud_graph_traits<G>::point_cloud_const_ptr point_cloud_const_ptr;
115
116 BOOST_STATIC_ASSERT(
117 (boost::mpl::not_<boost::is_same<vertex_bundled, boost::no_property>>::value));
118 BOOST_STATIC_ASSERT((boost::is_same<vertex_bundled, point_type>::value));
119
120 BOOST_CONCEPT_USAGE(PointCloudGraph)
121 {
122 BOOST_CONCEPT_ASSERT(
123 (boost::concepts::PropertyGraph<G, vertex_descriptor, boost::vertex_bundle_t>));
124 p = point_cloud(g);
125 i = indices(g);
126 G a(p); // require that graph can be constructed from a point cloud pointer
127 const_constraints(g);
128 }
129
130 void const_constraints(const G& cg)
131 {
132 pc = point_cloud(cg);
133 i = indices(cg);
134 }
135
136 G g;
137 point_cloud_ptr p;
138 point_cloud_const_ptr pc;
139 pcl::PointIndices::Ptr i;
140 };
141
142} // namespace pcl::graph::concepts
143
144namespace pcl::graph
145{
146 using pcl::graph::concepts::PointCloudGraphConcept;
147
148}
149
150#include <boost/concept/detail/concept_undef.hpp>
151
152#endif /* PCL_GRAPH_POINT_CLOUD_GRAPH_CONCEPT_H */
pcl::PointIndices::Ptr indices(const PCG &g)
Retrieve the indices of the points of the point cloud stored in a point cloud graph that actually bel...
pcl::PointCloud< P >::Ptr point_cloud(PCG &g)
Retrieve the point cloud stored in a point cloud graph.
Graph::point_cloud_ptr point_cloud_ptr
The type of a shared pointer to PCL point cloud the graph can be viewed as.
Graph::point_cloud_type point_cloud_type
The type of PCL point cloud the graph can be viewed as.
Graph::point_type point_type
The type of PCL points bundled in vertices.
Graph::point_cloud_const_ptr point_cloud_const_ptr
The type of a shared pointer to const PCL point cloud the graph can be viewed as.