14#include <lagrange/utils/Error.h>
15#include <lagrange/utils/fmt/format.h>
20namespace lagrange::io::internal {
24template <
typename ValueType>
27 if constexpr (std::is_floating_point_v<ValueType>) {
29 }
else if constexpr (std::is_signed_v<ValueType>) {
45template <
typename Func>
50 if (size == 4)
return void(func(
float{}));
51 if (size == 8)
return void(func(
double{}));
54 if (size == 1)
return void(func(int8_t{}));
55 if (size == 2)
return void(func(int16_t{}));
56 if (size == 4)
return void(func(int32_t{}));
57 if (size == 8)
return void(func(int64_t{}));
60 if (size == 1)
return void(func(uint8_t{}));
61 if (size == 2)
return void(func(uint16_t{}));
62 if (size == 4)
return void(func(uint32_t{}));
63 if (size == 8)
return void(func(uint64_t{}));
67 throw Error(lagrange::format(
"Unsupported PCD field type '{}' with size {}", type, size));
void dispatch_pcd_type(char type, int size, Func &&func)
Dispatches a (type, size) pair from a PCD header to the matching C++ value type and invokes func with...
Definition pcd_utils.h:46
constexpr char pcd_type_char()
Returns the PCD TYPE character corresponding to a C++ value type: signed integer ('I'),...
Definition pcd_utils.h:25
@ Error
Throw an error if collision is detected.
Definition MappingPolicy.h:24