Bit field utility class.
More...
#include <lagrange/utils/BitField.h>
|
|
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.
|
| |
|
| static constexpr BitField | none () |
| | Named constructor returning a bitfield set to 0.
|
| |
| static constexpr BitField | all () |
| | Named constructor returning a bitfield set to 1.
|
| |
template<typename EnumType_>
class lagrange::BitField< EnumType_ >
Bit field utility class.
This class describes a bit field over an enum type.
- Template Parameters
-
| EnumType_ | An enum type whose values are to be used in the bit field. |
◆ BitField() [1/2]
template<typename EnumType_>
Constructor.
- Parameters
-
| [in] | value | Enum to initialize the bit field with. |
◆ BitField() [2/2]
template<typename EnumType_>
Constructor.
- Parameters
-
| [in] | bits | Value to initialize the bit field with. |
◆ none()
template<typename EnumType_>
Named constructor returning a bitfield set to 0.
- Returns
- The bit field.
◆ all()
template<typename EnumType_>
Named constructor returning a bitfield set to 1.
- Returns
- The bit field.
◆ set()
template<typename EnumType_>
| void set |
( |
const BitField< EnumType_ > & | other | ) |
|
|
inlineconstexpr |
Set to 1 the specified bit.
- Parameters
-
| [in] | other | The bits to set. |
◆ clear()
template<typename EnumType_>
| void clear |
( |
const BitField< EnumType_ > & | other | ) |
|
|
inlineconstexpr |
Set to 0 the specified Bit.
- Parameters
-
| [in] | other | The bits to clear. |
◆ test()
template<typename EnumType_>
| bool test |
( |
const BitField< EnumType_ > & | other | ) |
const |
|
inlineconstexpr |
Test the specified bit.
- Parameters
-
| [in] | other | The bits to test. |
- Returns
- True if all the specified bits are set to 1.
◆ test_any()
template<typename EnumType_>
| bool test_any |
( |
const BitField< EnumType_ > & | other | ) |
const |
|
inlineconstexpr |
Test if any bits are set.
- Parameters
-
| [in] | other | The bits to test. |
- Returns
- true if any of the specified bits is set to 1
◆ set_bit()
template<typename EnumType_>
| void set_bit |
( |
const BitField< EnumType_ > & | other, |
|
|
bool | is_set ) |
|
inlineconstexpr |
Allow to set the value of a bit.
- Parameters
-
| [in] | other | The bits to modify. |
| [in] | is_set | The value that indicates if the bit is set or not. |
◆ get_value()
template<typename EnumType_>
Gets the underlying integral value.
- Returns
- Internal value.
◆ operator==()
template<typename EnumType_>
| bool operator== |
( |
const BitField< EnumType_ > & | other | ) |
const |
|
inlineconstexpr |
Equal operator.
- Parameters
-
| [in] | other | The other bitfield. |
- Returns
- true if other is equal to current.
◆ operator!=()
template<typename EnumType_>
| bool operator!= |
( |
const BitField< EnumType_ > & | other | ) |
const |
|
inlineconstexpr |
Different operator.
- Parameters
-
| [in] | other | The other bitfield. |
- Returns
- true if other is equal to current.
◆ operator|()
template<typename EnumType_>
Bitwise 'or' operator.
- Parameters
-
| [in] | other | The other bitfield. |
- Returns
- The result of the bitwise 'or'
◆ operator&()
template<typename EnumType_>
Bitwise 'and' operator.
- Parameters
-
| [in] | other | The other bitfield. |
- Returns
- The result of the bitwise 'and'.
◆ operator^()
template<typename EnumType_>
Bitwise 'exclusive or' operator.
- Parameters
-
| [in] | other | The other bitfield. |
- Returns
- The result of the bitwise 'exclusive or'.
◆ operator~()
template<typename EnumType_>
Bitwise 'one's complement' operator.
- Returns
- The result of the bitwise 'one's complement'.
The documentation for this class was generated from the following file: