Lagrange
|
Bit field utility class. More...
#include <lagrange/utils/BitField.h>
Public Types | |
using | EnumType = EnumType_ |
Enum type on top of which the bit field is built. | |
using | UnderlyingType = std::underlying_type_t< EnumType > |
Underlying integral type representing the enum type. | |
Public Member Functions | |
constexpr | BitField () |
Default Constructor. | |
constexpr | BitField (EnumType value) |
Constructor. More... | |
constexpr | BitField (UnderlyingType bits) |
Constructor. More... | |
constexpr void | set (const BitField &other) |
Set to 1 the specified bit. More... | |
constexpr void | clear (const BitField &other) |
Set to 0 the specified Bit. More... | |
constexpr void | clear_all () |
Set all bits to 0. | |
constexpr bool | test (const BitField &other) const |
Test the specified bit. More... | |
constexpr bool | test_any (const BitField &other) const |
Test if any bits are set. More... | |
constexpr void | set_bit (const BitField &other, bool is_set) |
Allow to set the value of a bit. More... | |
constexpr | operator UnderlyingType () const |
Implicit conversion to the underlying integer type. | |
constexpr const UnderlyingType & | get_value () const |
Gets the underlying integral value. More... | |
constexpr bool | operator== (const BitField &other) const |
Equal operator. More... | |
constexpr bool | operator!= (const BitField &other) const |
Different operator. More... | |
constexpr BitField | operator| (const BitField &other) const |
Bitwise 'or' operator. More... | |
constexpr BitField | operator& (const BitField &other) const |
Bitwise 'and' operator. More... | |
constexpr BitField | operator^ (const BitField &other) const |
Bitwise 'exclusive or' operator. More... | |
constexpr BitField | operator~ () const |
Bitwise 'one's complement' operator. More... | |
Static Public Member Functions | |
static constexpr BitField | none () |
Named constructor returning a bitfield set to 0. More... | |
static constexpr BitField | all () |
Named constructor returning a bitfield set to 1. More... | |
Bit field utility class.
This class describes a bit field over an enum type.
EnumType_ | An enum type whose values are to be used in the bit field. |
Constructor.
[in] | value | Enum to initialize the bit field with. |
|
inlineconstexpr |
Constructor.
[in] | bits | Value to initialize the bit field with. |
|
inlinestaticconstexpr |
Named constructor returning a bitfield set to 0.
|
inlinestaticconstexpr |
Named constructor returning a bitfield set to 1.
|
inlineconstexpr |
Set to 1 the specified bit.
[in] | other | The bits to set. |
|
inlineconstexpr |
Set to 0 the specified Bit.
[in] | other | The bits to clear. |
|
inlineconstexpr |
Test the specified bit.
[in] | other | The bits to test. |
|
inlineconstexpr |
Test if any bits are set.
[in] | other | The bits to test. |
|
inlineconstexpr |
Allow to set the value of a bit.
[in] | other | The bits to modify. |
[in] | is_set | The value that indicates if the bit is set or not. |
|
inlineconstexpr |
Gets the underlying integral value.
|
inlineconstexpr |
Equal operator.
[in] | other | The other bitfield. |
|
inlineconstexpr |
Different operator.
[in] | other | The other bitfield. |
Bitwise 'or' operator.
[in] | other | The other bitfield. |
Bitwise 'and' operator.
[in] | other | The other bitfield. |
Bitwise 'exclusive or' operator.
[in] | other | The other bitfield. |
|
inlineconstexpr |
Bitwise 'one's complement' operator.