Point Cloud Library (PCL)  1.7.1
conversions.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2012, Willow Garage, 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  * $Id$
37  *
38  */
39 
40 #ifndef PCL_ROS_CONVERSIONS_H_
41 #define PCL_ROS_CONVERSIONS_H_
42 
43 #ifdef __DEPRECATED
44 #warning The <pcl/ros/conversions.h> header is deprecated. please use \
45 <pcl/conversions.h> instead.
46 #endif
47 
48 #include <pcl/conversions.h>
49 
50 namespace pcl
51 {
52  /** \brief Convert a PCLPointCloud2 binary data blob into a pcl::PointCloud<T> object using a field_map.
53  * \param[in] msg the PCLPointCloud2 binary blob
54  * \param[out] cloud the resultant pcl::PointCloud<T>
55  * \param[in] field_map a MsgFieldMap object
56  *
57  * \note Use fromROSMsg (PCLPointCloud2, PointCloud<T>) directly or create you
58  * own MsgFieldMap using:
59  *
60  * \code
61  * MsgFieldMap field_map;
62  * createMapping<PointT> (msg.fields, field_map);
63  * \endcode
64  */
65  PCL_DEPRECATED (template <typename PointT> void fromROSMsg (
67  const MsgFieldMap& field_map),
68  "pcl::fromROSMsg is deprecated, please use fromPCLPointCloud2 instead.");
69 
70  template <typename PointT> void
72  const MsgFieldMap& field_map)
73  {
74  fromPCLPointCloud2 (msg, cloud, field_map);
75  }
76 
77  /** \brief Convert a PCLPointCloud2 binary data blob into a pcl::PointCloud<T> object.
78  * \param[in] msg the PCLPointCloud2 binary blob
79  * \param[out] cloud the resultant pcl::PointCloud<T>
80  */
81  PCL_DEPRECATED (template<typename PointT> void fromROSMsg (
82  const pcl::PCLPointCloud2& msg, pcl::PointCloud<PointT>& cloud),
83  "pcl::fromROSMsg is deprecated, please use fromPCLPointCloud2 instead.");
84  template<typename PointT> void
86  {
87  fromPCLPointCloud2 (msg, cloud);
88  }
89 
90  /** \brief Convert a pcl::PointCloud<T> object to a PCLPointCloud2 binary data blob.
91  * \param[in] cloud the input pcl::PointCloud<T>
92  * \param[out] msg the resultant PCLPointCloud2 binary blob
93  */
94  PCL_DEPRECATED (template<typename PointT> void toROSMsg (
95  const pcl::PointCloud<PointT>& cloud, pcl::PCLPointCloud2& msg),
96  "pcl::fromROSMsg is deprecated, please use fromPCLPointCloud2 instead.");
97  template<typename PointT> void
99  {
100  toPCLPointCloud2 (cloud, msg);
101  }
102 
103  /** \brief Copy the RGB fields of a PointCloud into pcl::PCLImage format
104  * \param[in] cloud the point cloud message
105  * \param[out] msg the resultant pcl::PCLImage
106  * CloudT cloud type, CloudT should be akin to pcl::PointCloud<pcl::PointXYZRGBA>
107  * \note will throw std::runtime_error if there is a problem
108  */
109  PCL_DEPRECATED (template<typename CloudT> void toROSMsg (
110  const CloudT& cloud, pcl::PCLImage& msg),
111  "pcl::fromROSMsg is deprecated, please use fromPCLPointCloud2 instead.");
112  template<typename CloudT> void
113  toROSMsg (const CloudT& cloud, pcl::PCLImage& msg)
114  {
115  toPCLPointCloud2 (cloud, msg);
116  }
117 
118  /** \brief Copy the RGB fields of a PCLPointCloud2 msg into pcl::PCLImage format
119  * \param cloud the point cloud message
120  * \param msg the resultant pcl::PCLImage
121  * will throw std::runtime_error if there is a problem
122  */
123  PCL_DEPRECATED (inline void toROSMsg (
124  const pcl::PCLPointCloud2& cloud, pcl::PCLImage& msg),
125  "pcl::fromROSMsg is deprecated, please use fromPCLPointCloud2 instead.");
126  inline void
128  {
129  toPCLPointCloud2 (cloud, msg);
130  }
131 }
132 
133 #endif //#ifndef PCL_ROS_CONVERSIONS_H_