3 #ifndef __YARP_CLOUD_UTILS_PCL_TRAITS_HPP__
4 #define __YARP_CLOUD_UTILS_PCL_TRAITS_HPP__
7 #include <yarp/sig/PointCloudTypes.h>
8 #include <pcl/point_types.h>
16 struct pcl_type_from_yarp;
19 struct pcl_type_from_yarp<yarp::sig::DataXY>
20 {
typedef pcl::PointXY type; };
23 struct pcl_type_from_yarp<yarp::sig::DataXYZ>
24 {
typedef pcl::PointXYZ type; };
27 struct pcl_type_from_yarp<yarp::sig::DataNormal>
28 {
typedef pcl::Normal type; };
31 struct pcl_type_from_yarp<yarp::sig::DataXYZRGBA>
32 {
typedef pcl::PointXYZRGB type; };
35 struct pcl_type_from_yarp<yarp::sig::DataXYZI>
36 {
typedef pcl::PointXYZI type; };
39 struct pcl_type_from_yarp<yarp::sig::DataInterestPointXYZ>
40 {
typedef pcl::InterestPoint type; };
43 struct pcl_type_from_yarp<yarp::sig::DataXYZNormal>
44 {
typedef pcl::PointNormal type; };
47 struct pcl_type_from_yarp<yarp::sig::DataXYZNormalRGBA>
48 {
typedef pcl::PointXYZRGBNormal type; };
52 struct pcl_all_xyz_types_tag {};
54 struct pcl_xyz_rgb_types_tag {};
56 struct pcl_rgb_types_tag {};
58 struct pcl_xyzi_types_tag {};
60 struct pcl_normal_types_tag {};
64 struct pcl_mls_types_tag :
public pcl_all_xyz_types_tag {};
65 struct pcl_mls_normal_types_tag :
public pcl_normal_types_tag {};
69 template <
typename T,
typename tag>
75 struct pcl_decay<T, pcl_all_xyz_types_tag>
81 struct pcl_decay<T, pcl_xyz_rgb_types_tag>
82 {
typedef pcl::PointXYZ type; };
85 struct pcl_decay<pcl::PointXYZRGB, pcl_xyz_rgb_types_tag>
86 {
typedef pcl::PointXYZRGB type; };
89 struct pcl_decay<pcl::PointXYZRGBNormal, pcl_xyz_rgb_types_tag>
90 {
typedef pcl::PointXYZRGB type; };
95 struct pcl_decay<T, pcl_rgb_types_tag>
96 {
typedef pcl::PointXYZRGB type; };
100 template <
typename T>
101 struct pcl_decay<T, pcl_xyzi_types_tag>
102 {
typedef pcl::PointXYZI type; };
105 struct pcl_decay<pcl::PointNormal, pcl_xyzi_types_tag>
106 {
typedef pcl::PointXYZINormal type; };
109 struct pcl_decay<pcl::PointXYZRGBNormal, pcl_xyzi_types_tag>
110 {
typedef pcl::PointXYZINormal type; };
113 struct pcl_decay<pcl::PointXYZINormal, pcl_xyzi_types_tag>
114 {
typedef pcl::PointXYZINormal type; };
118 template <
typename T>
119 struct pcl_decay<T, pcl_normal_types_tag>
123 struct pcl_decay<pcl::PointXYZ, pcl_normal_types_tag>
124 {
typedef pcl::PointNormal type; };
127 struct pcl_decay<pcl::PointXYZRGB, pcl_normal_types_tag>
128 {
typedef pcl::PointXYZRGBNormal type; };
131 struct pcl_decay<pcl::PointXYZI, pcl_normal_types_tag>
132 {
typedef pcl::PointXYZINormal type; };
135 struct pcl_decay<pcl::InterestPoint, pcl_normal_types_tag>
136 {
typedef pcl::PointNormal type; };
140 template <
typename T>
141 struct pcl_decay<T, pcl_mls_types_tag>
145 struct pcl_decay<pcl::InterestPoint, pcl_mls_types_tag>
146 {
typedef pcl::PointXYZ type; };
148 template <
typename T>
149 struct pcl_decay<T, pcl_mls_normal_types_tag>
153 struct pcl_decay<pcl::PointXYZ, pcl_mls_normal_types_tag>
154 {
typedef pcl::PointNormal type; };
157 struct pcl_decay<pcl::PointXYZRGB, pcl_mls_normal_types_tag>
158 {
typedef pcl::PointXYZRGBNormal type; };
161 struct pcl_decay<pcl::PointXYZI, pcl_mls_normal_types_tag>
162 {
typedef pcl::PointNormal type; };
165 struct pcl_decay<pcl::InterestPoint, pcl_mls_normal_types_tag>
166 {
typedef pcl::PointNormal type; };
170 template <
typename T1,
typename T2>
171 struct pcl_is_convertible : std::false_type {};
173 template <
typename T>
174 struct pcl_is_convertible<T, pcl::PointXYZ> : std::true_type {};
177 struct pcl_is_convertible<pcl::PointXYZRGBNormal, pcl::PointXYZRGB> : std::true_type {};
180 struct pcl_is_convertible<pcl::PointXYZRGBNormal, pcl::PointNormal> : std::true_type {};
183 struct pcl_is_convertible<pcl::PointXYZINormal, pcl::PointXYZI> : std::true_type {};
186 struct pcl_is_convertible<pcl::PointXYZINormal, pcl::PointNormal> : std::true_type {};
190 template <
typename T>
191 struct pcl_descriptor;
194 struct pcl_descriptor<pcl::PointXY>
195 {
static constexpr
const char * name =
"XY"; };
198 struct pcl_descriptor<pcl::PointXYZ>
199 {
static constexpr
const char * name =
"XYZ"; };
202 struct pcl_descriptor<pcl::Normal>
203 {
static constexpr
const char * name =
"NORMAL"; };
206 struct pcl_descriptor<pcl::PointXYZRGB>
207 {
static constexpr
const char * name =
"XYZ_RGB"; };
210 struct pcl_descriptor<pcl::PointXYZI>
211 {
static constexpr
const char * name =
"XYZI"; };
214 struct pcl_descriptor<pcl::InterestPoint>
215 {
static constexpr
const char * name =
"XYZ_INTEREST"; };
218 struct pcl_descriptor<pcl::PointNormal>
219 {
static constexpr
const char * name =
"XYZ_NORMAL"; };
222 struct pcl_descriptor<pcl::PointXYZRGBNormal>
223 {
static constexpr
const char * name =
"XYZ_RGB_NORMAL"; };
226 struct pcl_descriptor<pcl::PointXYZINormal>
227 {
static constexpr
const char * name =
"XYZI_NORMAL"; };
231 template <
typename T>
232 constexpr
auto is_unsupported_type =
233 std::is_same_v<T, pcl::PointXY> ||
234 std::is_same_v<T, pcl::Normal>;