Struct FieldDescriptor¶
Defined in File field.h
Struct Documentation¶
-
struct FieldDescriptor¶
Helper struct used by FieldView and Field to describe field contents.
Unlike FieldType this fully describes a Field’s dimensions rather than abstract away the lidar width and height or packet count.
Public Functions
-
size_t bytes() const¶
Calculates the size in bytes of the described field.
- Returns:
type size in bytes
-
size_t size() const¶
Get array size in elements, or 1 if shape is not present.
- Returns:
size in elements
-
ChanFieldType tag() const¶
Get type tag, if can be translated to ChanFieldType, otherwise returns ChanFieldType::UNREGISTERED.
- Returns:
ChanFieldType
-
inline bool operator==(const FieldDescriptor &other) const noexcept¶
-
void swap(FieldDescriptor &other)¶
Swaps descriptors.
- Parameters:
other[inout] Handle to swapped FieldDescriptor.
-
template<typename T>
inline bool eligible_type() const¶ Check if the type is eligible for conversion.
- Returns:
true if eligible, otherwise false.
-
bool is_type_compatible(const FieldDescriptor &other) const noexcept¶
Check if descriptor types are compatible.
- Parameters:
other[in] A constant of type FieldDescriptor.
- Returns:
true if compatible, otherwise false.
-
size_t ndim() const noexcept¶
Return number of dimensions of the described field.
- Returns:
number of dimensions.
Public Members
-
size_t type¶
type hash of the described field
-
std::vector<size_t> shape¶
vector of array dimensions of the described field, if present
-
std::vector<size_t> strides¶
vector of stride offsets of the described field, if present
-
size_t element_size¶
size of the underlying type, in bytes
Public Static Functions
-
template<typename T>
static inline size_t type_hash()¶ Get type hash.
warning: different platforms produce different values
- Returns:
hash value
-
template<typename T = void>
static inline FieldDescriptor memory(size_t bytes)¶ Get a field descriptor for a chunk of typed memory.
useful when storing arbitrary sized structs.
- Template Parameters:
T – Type of memory to be stored; this gets used by safety checks.
- Parameters:
bytes[in] Number of bytes in memory.
- Returns:
-
template<typename T, class ContainerT = std::initializer_list<size_t>>
static inline FieldDescriptor array(const ContainerT &shape)¶ Get a field descriptor for an array.
- Template Parameters:
T – Array type
- Parameters:
shape[in] Shape vector of array dimensions.
- Returns:
-
template<class ContainerT = std::initializer_list<size_t>>
static inline FieldDescriptor array(ChanFieldType tag, const ContainerT &shape)¶ Get a field descriptor for an array.
- Parameters:
tag[in] Tag of array type.
shape[in] Vector of array dimensions.
- Returns:
-
size_t bytes() const¶