![]() |
dfx 0.1.0
Linux-based dynamic dataflow executor
|
Typesafe bitmask wrapper for enum flags. More...
#include <dfx-utilities/Flags.hpp>
Public Types | |
| using | enum_type = Enum |
| The wrapped enum type. | |
| using | value_type = std::underlying_type_t<Enum> |
| The underlying integer storage type. | |
Public Member Functions | |
| constexpr | Flags () noexcept=default |
| Construct an empty flag set (value = 0). | |
| constexpr | Flags (enum_type e) noexcept |
| Construct from a single enum flag. | |
| constexpr | Flags (std::initializer_list< enum_type > f) noexcept |
| Construct from an initializer-list of flags. All provided flags are OR-ed into the resulting mask. | |
| constexpr Flags< enum_type > & | setFlag (enum_type flag, bool on=true) noexcept |
| Set or clear a single flag. | |
| constexpr bool | testFlag (enum_type flag) const noexcept |
| Test whether a given flag is set. | |
| constexpr bool | testAnyFlag (Flags< enum_type > const &flags) const noexcept |
Test whether any bit from flags is set. | |
| constexpr bool | testAllFlags (Flags< enum_type > const &flags) const noexcept |
Test whether all bits from flags are set. | |
| constexpr bool | operator== (Flags< enum_type > const &other) const noexcept |
| Equality comparison between two flag sets. | |
| constexpr bool | operator!= (Flags< enum_type > const &other) const noexcept |
| Inequality comparison between two flag sets. | |
| constexpr bool | operator== (enum_type flag) const noexcept |
| Compare the flag set against a single enum mask. | |
| constexpr bool | operator!= (enum_type flag) const noexcept |
| Negated form of operator==(enum_type). | |
| constexpr | operator enum_type () const noexcept |
| Implicit conversion to the enum type. | |
| constexpr | operator value_type () const noexcept |
| Implicit conversion to the underlying integer storage type. | |
| constexpr Flags< enum_type > | operator& (enum_type mask) const noexcept |
| Bitwise AND with an enum mask. | |
| constexpr Flags< enum_type > | operator& (Flags< enum_type > mask) const noexcept |
| Bitwise AND with another flag set. | |
| constexpr Flags< enum_type > & | operator&= (enum_type mask) noexcept |
| In-place bitwise AND with an enum mask. | |
| constexpr Flags< enum_type > & | operator&= (Flags< enum_type > mask) noexcept |
| In-place bitwise AND with another flag set. | |
| constexpr Flags< enum_type > | operator| (enum_type mask) const noexcept |
| Bitwise OR with an enum mask. | |
| constexpr Flags< enum_type > | operator| (Flags< enum_type > mask) const noexcept |
| Bitwise OR with another flag set. | |
| constexpr Flags< enum_type > & | operator|= (enum_type mask) noexcept |
| In-place bitwise OR with an enum mask. | |
| constexpr Flags< enum_type > & | operator|= (Flags< enum_type > mask) noexcept |
| In-place bitwise OR with another flag set. | |
| constexpr Flags< enum_type > | operator^ (enum_type mask) const noexcept |
| Bitwise XOR with an enum mask. | |
| constexpr Flags< enum_type > | operator^ (Flags< enum_type > mask) const noexcept |
| Bitwise XOR with another flag set. | |
| constexpr Flags< enum_type > & | operator^= (enum_type mask) noexcept |
| In-place bitwise XOR with an enum mask. | |
| constexpr Flags< enum_type > & | operator^= (Flags< enum_type > mask) noexcept |
| In-place bitwise XOR with another flag set. | |
| constexpr Flags< enum_type > | operator~ () const noexcept |
| Bitwise NOT. | |
| constexpr bool | operator! () const noexcept |
| Logical negation. | |
Typesafe bitmask wrapper for enum flags.
Flags<Enum> wraps an enum whose enumerators represent bit flags (typically powers of two), and provides common bitmask operations (|, &, ^, ~), as well as helpers to set/test flags.
The internal storage is the enum underlying type (std::underlying_type_t<Enum>).
| using dfx::Utils::Flags< Enum >::enum_type = Enum |
The wrapped enum type.
| using dfx::Utils::Flags< Enum >::value_type = std::underlying_type_t<Enum> |
The underlying integer storage type.
|
constexprdefaultnoexcept |
Construct an empty flag set (value = 0).
|
inlineconstexprnoexcept |
Construct from a single enum flag.
| e | Flag to set. |
|
inlineconstexprnoexcept |
Construct from an initializer-list of flags. All provided flags are OR-ed into the resulting mask.
| f | List of flags to set. |
|
inlinenodiscardconstexprnoexcept |
Implicit conversion to the enum type.
|
inlinenodiscardconstexprnoexcept |
Implicit conversion to the underlying integer storage type.
|
inlinenodiscardconstexprnoexcept |
Logical negation.
|
inlinenodiscardconstexprnoexcept |
Negated form of operator==(enum_type).
|
inlinenodiscardconstexprnoexcept |
Inequality comparison between two flag sets.
|
inlinenodiscardconstexprnoexcept |
Bitwise AND with an enum mask.
|
inlinenodiscardconstexprnoexcept |
Bitwise AND with another flag set.
|
inlineconstexprnoexcept |
In-place bitwise AND with an enum mask.
|
inlineconstexprnoexcept |
In-place bitwise AND with another flag set.
|
inlinenodiscardconstexprnoexcept |
Compare the flag set against a single enum mask.
|
inlinenodiscardconstexprnoexcept |
Equality comparison between two flag sets.
|
inlinenodiscardconstexprnoexcept |
Bitwise XOR with an enum mask.
|
inlinenodiscardconstexprnoexcept |
Bitwise XOR with another flag set.
|
inlineconstexprnoexcept |
In-place bitwise XOR with an enum mask.
|
inlineconstexprnoexcept |
In-place bitwise XOR with another flag set.
|
inlinenodiscardconstexprnoexcept |
Bitwise OR with an enum mask.
|
inlinenodiscardconstexprnoexcept |
Bitwise OR with another flag set.
|
inlineconstexprnoexcept |
In-place bitwise OR with an enum mask.
|
inlineconstexprnoexcept |
In-place bitwise OR with another flag set.
|
inlinenodiscardconstexprnoexcept |
Bitwise NOT.
|
inlineconstexprnoexcept |
Set or clear a single flag.
| flag | Flag to modify. |
| on | If true, sets the flag; if false, clears it. |
|
inlinenodiscardconstexprnoexcept |
Test whether all bits from flags are set.
| flags | Mask of bits to test. |
|
inlinenodiscardconstexprnoexcept |
Test whether any bit from flags is set.
| flags | Mask of bits to test. |
|
inlinenodiscardconstexprnoexcept |
Test whether a given flag is set.
This checks that all bits in flag are present in this mask.
| flag | Flag (or bitmask) to test. |
flag are set.