Namespace nebula::util
Namespace List > nebula > util
Classes
Type | Name |
---|---|
struct | IsStreamable <typename T, typename> |
struct | IsStreamable< T, std::void_t< decltype(std::declval< std::ostream & >()<< std::declval< T >())> > <typename T> |
class | RateChecker |
class | RingBuffer <typename T> |
struct | bad_expected_access |
struct | expected <typename T, typename E> A poor man's backport of C++23's std::expected. |
Public Functions
Type | Name |
---|---|
constexpr OutT | get_bitfield (const InT & storage) Access the value of a bitfield, as a user-defined type. |
std::enable_if_t< IsStreamable< T >::value, std::string > | to_string (const T & value) |
std::string | to_string (const char value) |
std::string | to_string (const nlohmann::ordered_json & j) |
std::string | to_string (const nlohmann::json & j) |
Public Functions Documentation
function get_bitfield
Access the value of a bitfield, as a user-defined type.
template<typename OutT, uint8_t LowBit, uint8_t HighBit, typename InT>
constexpr OutT nebula::util::get_bitfield (
const InT & storage
)
Given a variable storage
of any numeric type InT
, extract the region specified by [LowBit, HighBit]
(both inclusive) and cast it to OutT
. If InT
is multiple bytes big, the container is treated with native endianness.
Template parameters:
OutT
The output type. Usually a numeric type or enumLowBit
The start bit of the bitfield (inclusive)HighBit
The end bit of the bitfield (inclusive)InT
The storage type
Parameters:
storage
The variable acting as the storage for the bitfield
Returns:
constexpr OutT The extracted value
function to_string
template<typename T>
std::enable_if_t< IsStreamable < T >::value, std::string > nebula::util::to_string (
const T & value
)
function to_string
template<size_t N>
std::string nebula::util::to_string (
const char value
)
function to_string
inline std::string nebula::util::to_string (
const nlohmann::ordered_json & j
)
function to_string
inline std::string nebula::util::to_string (
const nlohmann::json & j
)
The documentation for this class was generated from the following file nebula_common/include/nebula_common/util/bitfield.hpp