livox_mid360_core
C++ driver library for the Livox Mid-360 LiDAR
Loading...
Searching...
No Matches
livox::mid360::bytes Namespace Reference

Little-endian byte helpers used by the protocol layer (bytes.hpp). More...

Functions

template<typename T>
requires std::is_trivially_copyable_v<T>
T read_le (std::span< const std::byte > in, std::size_t offset) noexcept
 Reads a little-endian trivially-copyable value from in at byte offset.
template<typename T>
requires std::is_trivially_copyable_v<T>
void write_le (std::span< std::byte > out, std::size_t offset, T v) noexcept
 Writes v little-endian into out at byte offset.
template<typename T>
requires std::is_trivially_copyable_v<T>
std::span< const std::byte > as_bytes (std::span< const T > s) noexcept
 Reinterprets a contiguous range of trivially-copyable objects as bytes.
std::span< const std::byte > as_bytes (const char *s, std::size_t n) noexcept
 Views n characters starting at s as bytes.

Detailed Description

Little-endian byte helpers used by the protocol layer (bytes.hpp).

Function Documentation

◆ read_le()

template<typename T>
requires std::is_trivially_copyable_v<T>
T livox::mid360::bytes::read_le ( std::span< const std::byte > in,
std::size_t offset )
inlinenodiscardnoexcept

Reads a little-endian trivially-copyable value from in at byte offset.

The caller guarantees offset + sizeof(T) <= in.size().

◆ write_le()

template<typename T>
requires std::is_trivially_copyable_v<T>
void livox::mid360::bytes::write_le ( std::span< std::byte > out,
std::size_t offset,
T v )
inlinenoexcept

Writes v little-endian into out at byte offset.

The caller guarantees offset + sizeof(T) <= out.size().