40 #include <pcl/point_struct_traits.h>
47 #include <type_traits>
81 template<
typename T>
struct asEnum {};
102 template<>
struct asType<detail::PointFieldTypes::FLOAT32> {
using type = float; };
103 template<>
struct asType<detail::PointFieldTypes::FLOAT64> {
using type = double; };
123 template <
typename Po
intInT,
typename OutT>
126 using Pod =
typename traits::POD<PointInT>::type;
135 const std::string &field,
138 : pt_ (reinterpret_cast<const
Pod&>(pt)), name_ (field), exists_ (exists), value_ (value)
149 const std::string &field,
151 : pt_ (reinterpret_cast<const
Pod&>(pt)), name_ (field), exists_ (exists_tmp_), value_ (value)
156 template <
typename Key>
inline void
159 if (name_ == pcl::traits::name<PointInT, Key>::value)
162 using T =
typename pcl::traits::datatype<PointInT, Key>::type;
163 const std::uint8_t* data_ptr =
reinterpret_cast<const std::uint8_t*
>(&pt_) + pcl::traits::offset<PointInT, Key>::value;
164 value_ =
static_cast<OutT
> (*
reinterpret_cast<const T*
>(data_ptr));
170 const std::string &name_;
188 template <
typename Po
intOutT,
typename InT>
191 using Pod =
typename traits::POD<PointOutT>::type;
199 const std::string &field,
201 : pt_ (reinterpret_cast<
Pod&>(pt)), name_ (field), value_ (value)
206 template <
typename Key>
inline void
209 if (name_ == pcl::traits::name<PointOutT, Key>::value)
211 using T =
typename pcl::traits::datatype<PointOutT, Key>::type;
213 *
reinterpret_cast<T*
>(data_ptr) =
static_cast<T
> (value_);
219 const std::string &name_;
228 template <
typename Po
intT,
typename ValT>
inline void
232 *
reinterpret_cast<ValT*
>(data_ptr) = value;
240 template <
typename Po
intT,
typename ValT>
inline void
244 value = *
reinterpret_cast<const ValT*
>(data_ptr);
247 template <
typename ...>
using void_t = void;
269 #ifndef __cpp_lib_is_invocable
271 template <
typename F,
typename... Args>
273 std::is_constructible<std::function<void(Args...)>,
274 std::reference_wrapper<std::remove_reference_t<F>>>::value;
276 template <
typename R,
typename F,
typename... Args>
278 std::is_constructible<std::function<R(Args...)>,
279 std::reference_wrapper<std::remove_reference_t<F>>>::value;
281 using std::is_invocable_v;
282 using std::is_invocable_r_v;
288 #ifndef __cpp_lib_remove_cvref
289 template <
typename T>
292 using std::remove_cvref_t;