Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PointCloud2.h
Go to the documentation of this file.
1 #ifndef PCL_SENSOR_MSGS_MESSAGE_POINTCLOUD2_H
2 #define PCL_SENSOR_MSGS_MESSAGE_POINTCLOUD2_H
3 #include <string>
4 #include <vector>
5 #include <ostream>
6 
7 // Include the correct Header path here
8 #include "std_msgs/Header.h"
10 
11 namespace sensor_msgs
12 {
13 
14 #if (defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) || defined(__ppc__) || defined(_M_PPC) || defined(__ARCH_PPC))
15 # define PCL_BIG_ENDIAN
16 #elif (defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) || defined(__INTEL__)) \
17  || (defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64)) \
18  || (defined(__ANDROID__))
19 # define PCL_LITTLE_ENDIAN
20 #else
21 # error
22 #endif
23 
24  struct PointCloud2
25  {
26  PointCloud2 () : header (), height (0), width (0), fields (),
27  is_bigendian (false), point_step (0), row_step (0),
28  data (), is_dense (false)
29  {
30 #ifdef PCL_BIG_ENDIAN
31  is_bigendian = true;
32 #elif defined(PCL_LITTLE_ENDIAN)
33  is_bigendian = false;
34 #else
35 # error
36 #endif
37  }
38 
39 #undef PCL_BIG_ENDIAN
40 #undef PCL_LITTLE_ENDIAN
41 
43 
44  pcl::uint32_t height;
45  pcl::uint32_t width;
46 
47  std::vector< ::sensor_msgs::PointField> fields;
48 
49  pcl::uint8_t is_bigendian;
50  pcl::uint32_t point_step;
51  pcl::uint32_t row_step;
52 
53  std::vector<pcl::uint8_t> data;
54 
55  pcl::uint8_t is_dense;
56 
57  public:
58  typedef boost::shared_ptr< ::sensor_msgs::PointCloud2> Ptr;
59  typedef boost::shared_ptr< ::sensor_msgs::PointCloud2 const> ConstPtr;
60  }; // struct PointCloud2
61 
62  typedef boost::shared_ptr< ::sensor_msgs::PointCloud2> PointCloud2Ptr;
63  typedef boost::shared_ptr< ::sensor_msgs::PointCloud2 const> PointCloud2ConstPtr;
64 
65  inline std::ostream& operator<<(std::ostream& s, const ::sensor_msgs::PointCloud2 &v)
66  {
67  s << "header: " << std::endl;
68  s << v.header;
69  s << "height: ";
70  s << " " << v.height << std::endl;
71  s << "width: ";
72  s << " " << v.width << std::endl;
73  s << "fields[]" << std::endl;
74  for (size_t i = 0; i < v.fields.size (); ++i)
75  {
76  s << " fields[" << i << "]: ";
77  s << std::endl;
78  s << " " << v.fields[i] << std::endl;
79  }
80  s << "is_bigendian: ";
81  s << " " << v.is_bigendian << std::endl;
82  s << "point_step: ";
83  s << " " << v.point_step << std::endl;
84  s << "row_step: ";
85  s << " " << v.row_step << std::endl;
86  s << "data[]" << std::endl;
87  for (size_t i = 0; i < v.data.size (); ++i)
88  {
89  s << " data[" << i << "]: ";
90  s << " " << v.data[i] << std::endl;
91  }
92  s << "is_dense: ";
93  s << " " << v.is_dense << std::endl;
94 
95  return (s);
96  }
97 
98 } // namespace sensor_msgs
99 
100 #endif // PCL_SENSOR_MSGS_MESSAGE_POINTCLOUD2_H
101