Nugget
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Utilities::BitField< T > Struct Template Reference

A bit field that can hold multiple bit field elements of different types. More...

#include <common/util/bitfield.hh>

Public Member Functions

template<typename Field >
constexpr Field::Type get () const
 
template<typename Field >
constexpr void set (Field::Type v_)
 
void clear ()
 

Detailed Description

template<typename... T>
struct Utilities::BitField< T >

A bit field that can hold multiple bit field elements of different types.

This class is used to hold multiple bit field elements of different types. The elements are stored in a single byte array, and the offsets of each element are computed at compile time. The elements can be accessed using the get() and set() methods. The get() method returns the value of the element, and the set() method sets the value of the element. The bit field elements are stored in the order they are defined in the template parameter pack. The order of the elements is important, as the offsets are computed based on the order of the elements. The maximum size of a single element is technically 32 bits, but this actually varies depending on the alignment of the element. One element can only span a maximum of 4 bytes. There is no limit on the number of elements that can be stored in the bit field.

Template Parameters

.. T The types of the bit field elements. These need to be BitSpan types.

Member Function Documentation

◆ clear()

template<typename... T>
void Utilities::BitField< T >::clear ( )
inline

◆ get()

template<typename... T>
template<typename Field >
constexpr Field::Type Utilities::BitField< T >::get ( ) const
inlineconstexpr

◆ set()

template<typename... T>
template<typename Field >
constexpr void Utilities::BitField< T >::set ( Field::Type  v_)
inlineconstexpr

The documentation for this struct was generated from the following file: