00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00045 #ifndef PCL_ROS_POINT_TRAITS_H_
00046 #define PCL_ROS_POINT_TRAITS_H_
00047
00048 #include <pcl/ros_macros.h>
00049 #if ROS_VERSION_MINIMUM(1, 3, 0)
00050 #include <std_msgs/Header.h>
00051 #else
00052 #include <roslib/Header.h>
00053 #endif
00054 #include <sensor_msgs/PointField.h>
00055 #include <boost/type_traits/remove_all_extents.hpp>
00056 #include <boost/type_traits/is_same.hpp>
00057 #include <boost/mpl/assert.hpp>
00058
00059 namespace pcl
00060 {
00061
00062 namespace fields
00063 {
00064
00065 }
00066
00067 namespace traits
00068 {
00069
00070 template<typename T> struct asEnum {};
00071 template<> struct asEnum<int8_t> { static const uint8_t value = sensor_msgs::PointField::INT8; };
00072 template<> struct asEnum<uint8_t> { static const uint8_t value = sensor_msgs::PointField::UINT8; };
00073 template<> struct asEnum<int16_t> { static const uint8_t value = sensor_msgs::PointField::INT16; };
00074 template<> struct asEnum<uint16_t> { static const uint8_t value = sensor_msgs::PointField::UINT16; };
00075 template<> struct asEnum<int32_t> { static const uint8_t value = sensor_msgs::PointField::INT32; };
00076 template<> struct asEnum<uint32_t> { static const uint8_t value = sensor_msgs::PointField::UINT32; };
00077 template<> struct asEnum<float> { static const uint8_t value = sensor_msgs::PointField::FLOAT32; };
00078 template<> struct asEnum<double> { static const uint8_t value = sensor_msgs::PointField::FLOAT64; };
00079
00080
00081
00082 template<typename T> struct decomposeArray
00083 {
00084 typedef typename boost::remove_all_extents<T>::type type;
00085 static const uint32_t value = sizeof(T) / sizeof(type);
00086 };
00087
00088
00089 template<typename PointT> struct POD
00090 {
00091 typedef PointT type;
00092 };
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 template<class PointT, typename Tag, int dummy = 0>
00105 struct name : name<typename POD<PointT>::type, Tag, dummy>
00106 {
00107
00108
00109
00110
00111 BOOST_MPL_ASSERT_MSG((!boost::is_same<PointT, typename POD<PointT>::type>::value),
00112 POINT_TYPE_NOT_PROPERLY_REGISTERED, (PointT));
00113 };
00114
00115
00116 template<class PointT, typename Tag>
00117 struct offset : offset<typename POD<PointT>::type, Tag>
00118 {
00119
00120
00121
00122
00123 BOOST_MPL_ASSERT_MSG((!boost::is_same<PointT, typename POD<PointT>::type>::value),
00124 POINT_TYPE_NOT_PROPERLY_REGISTERED, (PointT));
00125 };
00126
00127
00128 template<class PointT, typename Tag>
00129 struct datatype : datatype<typename POD<PointT>::type, Tag>
00130 {
00131
00132
00133
00134
00135
00136
00137 BOOST_MPL_ASSERT_MSG((!boost::is_same<PointT, typename POD<PointT>::type>::value),
00138 POINT_TYPE_NOT_PROPERLY_REGISTERED, (PointT));
00139 };
00140
00141
00142 template<typename PointT>
00143 struct fieldList : fieldList<typename POD<PointT>::type>
00144 {
00145
00146
00147
00148
00149 BOOST_MPL_ASSERT_MSG((!boost::is_same<PointT, typename POD<PointT>::type>::value),
00150 POINT_TYPE_NOT_PROPERLY_REGISTERED, (PointT));
00151 };
00152
00153 }
00154 }
00155
00156 #endif //#ifndef PCL_ROS_POINT_TRAITS_H_