40 #include <boost/mpl/assert.hpp>
45 #include <Eigen/src/StlSupport/details.h>
49 #include <type_traits>
85 template<
typename T>
struct asEnum {};
100 template<>
struct asType<detail::PointFieldTypes::INT8> {
using type = std::int8_t; };
101 template<>
struct asType<detail::PointFieldTypes::UINT8> {
using type = std::uint8_t; };
102 template<>
struct asType<detail::PointFieldTypes::INT16> {
using type = std::int16_t; };
103 template<>
struct asType<detail::PointFieldTypes::UINT16> {
using type = std::uint16_t; };
104 template<>
struct asType<detail::PointFieldTypes::INT32> {
using type = std::int32_t; };
105 template<>
struct asType<detail::PointFieldTypes::UINT32> {
using type = std::uint32_t; };
106 template<>
struct asType<detail::PointFieldTypes::FLOAT32> {
using type = float; };
107 template<>
struct asType<detail::PointFieldTypes::FLOAT64> {
using type = double; };
116 using type = std::remove_all_extents_t<T>;
117 static const std::uint32_t
value =
sizeof (T) /
sizeof (
type);
121 template<
typename Po
intT>
137 template<
typename Po
intT>
138 struct POD<
Eigen::internal::workaround_msvc_stl_support<PointT> >
155 template<
class Po
intT,
typename Tag,
int dummy = 0>
156 struct name :
name<typename POD<PointT>::type, Tag, dummy>
163 POINT_TYPE_NOT_PROPERLY_REGISTERED, (
PointT&));
167 template<
class Po
intT,
typename Tag>
175 POINT_TYPE_NOT_PROPERLY_REGISTERED, (
PointT&));
179 template<
class Po
intT,
typename Tag>
189 POINT_TYPE_NOT_PROPERLY_REGISTERED, (
PointT&));
193 template<
typename Po
intT>
201 POINT_TYPE_NOT_PROPERLY_REGISTERED, (
PointT&));
218 template <
typename Po
intInT,
typename OutT>
230 const std::string &field,
233 : pt_ (reinterpret_cast<const
Pod&>(pt)), name_ (field), exists_ (exists), value_ (value)
244 const std::string &field,
246 : pt_ (reinterpret_cast<const
Pod&>(pt)), name_ (field), exists_ (exists_tmp_), value_ (value)
251 template <
typename Key>
inline void
259 value_ =
static_cast<OutT
> (*
reinterpret_cast<const T*
>(data_ptr));
265 const std::string &name_;
283 template <
typename Po
intOutT,
typename InT>
294 const std::string &field,
296 : pt_ (reinterpret_cast<
Pod&>(pt)), name_ (field), value_ (value)
301 template <
typename Key>
inline void
308 *
reinterpret_cast<T*
>(data_ptr) = static_cast<T> (value_);
314 const std::string &name_;
323 template <
typename Po
intT,
typename ValT>
inline void
326 std::uint8_t* data_ptr =
reinterpret_cast<std::uint8_t*
>(&pt) + field_offset;
327 *
reinterpret_cast<ValT*
>(data_ptr) = value;
335 template <
typename Po
intT,
typename ValT>
inline void
338 const std::uint8_t* data_ptr =
reinterpret_cast<const std::uint8_t*
>(&pt) + field_offset;
339 value = *
reinterpret_cast<const ValT*
>(data_ptr);
342 template <
typename ...>
using void_t = void;
A helper functor that can set a specific value in a field if the field exists.
static constexpr std::uint8_t asEnum_v
static const std::uint8_t UINT32
static const std::uint8_t UINT8
static const std::uint8_t INT16
SetIfFieldExists(PointOutT &pt, const std::string &field, const InT &value)
Constructor.
BOOST_MPL_ASSERT_MSG((!std::is_same< PointT, typename POD< PointT >::type >::value), POINT_TYPE_NOT_PROPERLY_REGISTERED,(PointT &))
static const std::uint8_t UINT16
Enumeration for different numerical types.
std::remove_all_extents_t< T > type
BOOST_MPL_ASSERT_MSG((!std::is_same< PointT, typename POD< PointT >::type >::value), POINT_TYPE_NOT_PROPERLY_REGISTERED,(PointT &))
static const std::uint8_t INT8
void operator()()
Operator.
CopyIfFieldExists(const PointInT &pt, const std::string &field, bool &exists, OutT &value)
Constructor.
BOOST_MPL_ASSERT_MSG((!std::is_same< PointT, typename POD< PointT >::type >::value), POINT_TYPE_NOT_PROPERLY_REGISTERED,(PointT &))
CopyIfFieldExists(const PointInT &pt, const std::string &field, OutT &value)
Constructor.
static const std::uint32_t value
typename traits::POD< PointOutT >::type Pod
typename traits::POD< PointInT >::type Pod
void operator()()
Operator.
static const std::uint8_t INT32
Tests at compile time if type T has a custom allocator.
void setFieldValue(PointT &pt, std::size_t field_offset, const ValT &value)
Set the value at a specified field in a point.
A point structure representing Euclidean xyz coordinates, and the RGB color.
void getFieldValue(const PointT &pt, std::size_t field_offset, ValT &value)
Get the value at a specified field in a point.
static const std::uint8_t FLOAT32
typename asType< index >::type asType_t
BOOST_MPL_ASSERT_MSG((!std::is_same< PointT, typename POD< PointT >::type >::value), POINT_TYPE_NOT_PROPERLY_REGISTERED,(PointT &))
A helper functor that can copy a specific value if the given field exists.
static const std::uint8_t FLOAT64