Point Cloud Library (PCL)  1.7.0
PCLPointCloud2.h
1 #ifndef PCL_SENSOR_MSGS_MESSAGE_POINTCLOUD2_H
2 #define PCL_SENSOR_MSGS_MESSAGE_POINTCLOUD2_H
3 
4 #ifdef USE_ROS
5  #error USE_ROS setup requires PCL to compile against ROS message headers, which is now deprecated
6 #endif
7 
8 #include <string>
9 #include <vector>
10 #include <ostream>
11 #include <boost/detail/endian.hpp>
12 
13 // Include the correct Header path here
14 #include <pcl/PCLHeader.h>
15 #include <pcl/PCLPointField.h>
16 
17 namespace pcl
18 {
19 
21  {
22  PCLPointCloud2 () : header (), height (0), width (0), fields (),
23  is_bigendian (false), point_step (0), row_step (0),
24  data (), is_dense (false)
25  {
26 #if defined(BOOST_BIG_ENDIAN)
27  is_bigendian = true;
28 #elif defined(BOOST_LITTLE_ENDIAN)
29  is_bigendian = false;
30 #else
31 #error "unable to determine system endianness"
32 #endif
33  }
34 
36 
37  pcl::uint32_t height;
38  pcl::uint32_t width;
39 
40  std::vector< ::pcl::PCLPointField> fields;
41 
42  pcl::uint8_t is_bigendian;
43  pcl::uint32_t point_step;
44  pcl::uint32_t row_step;
45 
46  std::vector<pcl::uint8_t> data;
47 
48  pcl::uint8_t is_dense;
49 
50  public:
51  typedef boost::shared_ptr< ::pcl::PCLPointCloud2> Ptr;
52  typedef boost::shared_ptr< ::pcl::PCLPointCloud2 const> ConstPtr;
53  }; // struct PCLPointCloud2
54 
55  typedef boost::shared_ptr< ::pcl::PCLPointCloud2> PCLPointCloud2Ptr;
56  typedef boost::shared_ptr< ::pcl::PCLPointCloud2 const> PCLPointCloud2ConstPtr;
57 
58  inline std::ostream& operator<<(std::ostream& s, const ::pcl::PCLPointCloud2 &v)
59  {
60  s << "header: " << std::endl;
61  s << v.header;
62  s << "height: ";
63  s << " " << v.height << std::endl;
64  s << "width: ";
65  s << " " << v.width << std::endl;
66  s << "fields[]" << std::endl;
67  for (size_t i = 0; i < v.fields.size (); ++i)
68  {
69  s << " fields[" << i << "]: ";
70  s << std::endl;
71  s << " " << v.fields[i] << std::endl;
72  }
73  s << "is_bigendian: ";
74  s << " " << v.is_bigendian << std::endl;
75  s << "point_step: ";
76  s << " " << v.point_step << std::endl;
77  s << "row_step: ";
78  s << " " << v.row_step << std::endl;
79  s << "data[]" << std::endl;
80  for (size_t i = 0; i < v.data.size (); ++i)
81  {
82  s << " data[" << i << "]: ";
83  s << " " << v.data[i] << std::endl;
84  }
85  s << "is_dense: ";
86  s << " " << v.is_dense << std::endl;
87 
88  return (s);
89  }
90 
91 } // namespace pcl
92 
93 #endif // PCL_SENSOR_MSGS_MESSAGE_POINTCLOUD2_H
94