39 #ifndef PCL_POINT_TRAITS_H_
40 #define PCL_POINT_TRAITS_H_
43 #pragma GCC system_header
46 #include "pcl/pcl_macros.h"
48 #include <pcl/PCLPointField.h>
49 #include <boost/type_traits/remove_all_extents.hpp>
50 #include <boost/type_traits/is_same.hpp>
51 #include <boost/mpl/assert.hpp>
52 #if PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) == PCL_LINEAR_VERSION(4,4,3)
53 #include <boost/mpl/bool.hpp>
67 template<
typename T>
struct asEnum {};
92 typedef typename boost::remove_all_extents<T>::type
type;
93 static const uint32_t
value =
sizeof (T) /
sizeof (
type);
97 template<
typename Po
intT>
113 template<
class Po
intT,
typename Tag,
int dummy = 0>
114 struct name :
name<typename POD<PointT>::type, Tag, dummy>
121 POINT_TYPE_NOT_PROPERLY_REGISTERED, (
PointT&));
125 template<
class Po
intT,
typename Tag>
133 POINT_TYPE_NOT_PROPERLY_REGISTERED, (
PointT&));
137 template<
class Po
intT,
typename Tag>
147 POINT_TYPE_NOT_PROPERLY_REGISTERED, (
PointT&));
151 template<
typename Po
intT>
159 POINT_TYPE_NOT_PROPERLY_REGISTERED, (
PointT&));
161 #if PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) == PCL_LINEAR_VERSION(4,4,3)
176 template<
typename Po
intT,
typename Tag>
189 template <
typename Po
intInT,
typename OutT>
201 const std::string &field,
204 : pt_ (reinterpret_cast<const
Pod&>(pt)), name_ (field), exists_ (exists), value_ (value)
215 const std::string &field,
217 : pt_ (reinterpret_cast<const
Pod&>(pt)), name_ (field), exists_ (exists_tmp_), value_ (value)
222 template <
typename Key>
inline void
230 value_ =
static_cast<OutT
> (*
reinterpret_cast<const T*
>(data_ptr));
236 const std::string &name_;
244 template <
typename Po
intOutT,
typename InT>
255 const std::string &field,
257 : pt_ (reinterpret_cast<
Pod&>(pt)), name_ (field), value_ (value)
262 template <
typename Key>
inline void
269 *
reinterpret_cast<T*
>(data_ptr) = static_cast<T> (value_);
275 const std::string &name_;
284 template <
typename Po
intT,
typename ValT>
inline void
287 uint8_t* data_ptr =
reinterpret_cast<uint8_t*
>(&pt) + field_offset;
288 *
reinterpret_cast<ValT*
>(data_ptr) = value;
296 template <
typename Po
intT,
typename ValT>
inline void
299 const uint8_t* data_ptr =
reinterpret_cast<const uint8_t*
>(&pt) + field_offset;
300 value = *
reinterpret_cast<const ValT*
>(data_ptr);
304 #endif //#ifndef PCL_POINT_TRAITS_H_
boost::remove_all_extents< T >::type type
A helper functor that can set a specific value in a field if the field exists.
A helper functor that can copy a specific value if the given field exists.
bool operator()(const pcl::PCLPointField &field)
BOOST_MPL_ASSERT_MSG((!boost::is_same< PointT, typename POD< PointT >::type >::value), POINT_TYPE_NOT_PROPERLY_REGISTERED,(PointT &))
void operator()()
Operator.
BOOST_MPL_ASSERT_MSG((!bool(boost::mpl::bool_< false >::value)), WTF_GCC443,(bool))
CopyIfFieldExists(const PointInT &pt, const std::string &field, OutT &value)
Constructor.
CopyIfFieldExists(const PointInT &pt, const std::string &field, bool &exists, OutT &value)
Constructor.
traits::POD< PointOutT >::type Pod
static const uint32_t value
BOOST_MPL_ASSERT_MSG((!boost::is_same< PointT, typename POD< PointT >::type >::value), POINT_TYPE_NOT_PROPERLY_REGISTERED,(PointT &))
BOOST_MPL_ASSERT_MSG((!boost::is_same< PointT, typename POD< PointT >::type >::value), POINT_TYPE_NOT_PROPERLY_REGISTERED,(PointT &))
traits::POD< PointInT >::type Pod
SetIfFieldExists(PointOutT &pt, const std::string &field, const InT &value)
Constructor.
void operator()()
Operator.
BOOST_MPL_ASSERT_MSG((!boost::is_same< PointT, typename POD< PointT >::type >::value), POINT_TYPE_NOT_PROPERLY_REGISTERED,(PointT &))
void setFieldValue(PointT &pt, size_t field_offset, const ValT &value)
Set the value at a specified field in a point.
void getFieldValue(const PointT &pt, size_t field_offset, ValT &value)
Get the value at a specified field in a point.
A point structure representing Euclidean xyz coordinates, and the RGB color.