Bit flags of enum type.
More...
#include <klib/kFlags.hpp>
|
|
constexpr | kFlags () noexcept=default |
| | No flags set.
|
| template<std::same_as< T >... Args> |
| constexpr | kFlags (const T flag, const Args... flags) noexcept |
| | From set flags.
|
| constexpr auto | value () const noexcept -> U |
| | Get value.
|
| constexpr auto | isSet (const T flag) const noexcept -> bool |
| | Check if flag is set (all bits of non-empty flag).
|
| constexpr auto | set (const T flag) const noexcept -> kFlags |
| | Set flag (read-modify-write of hardware registers).
|
|
| static constexpr auto | from (const U value) noexcept -> kFlags |
| | From raw value (hardware register, table entry).
|
|
| using | U = std::underlying_type_t<T> |
| | Underlying type of flags.
|
| using | W = std::common_type_t<U, unsigned int> |
| | Type of bit operations (at least unsigned int: narrower types would be promoted to int).
|
template<class T>
requires std::is_enum_v<T>
class igros::klib::kFlags< T >
Bit flags of enum type.
- Template Parameters
-
| T | Flags enum type (bit values) |
Definition at line 29 of file kFlags.hpp.
Underlying type of flags.
Definition at line 32 of file kFlags.hpp.
Type of bit operations (at least unsigned int: narrower types would be promoted to int).
Definition at line 34 of file kFlags.hpp.
◆ kFlags()
template<class T>
template<std::same_as< T >... Args>
|
|
inlineexplicitconstexprnoexcept |
From set flags.
- Template Parameters
-
| Args | Further flags (same enum type) |
- Parameters
-
| flag | First set flag |
| flags | Further set flags |
Definition at line 48 of file kFlags.hpp.
◆ from()
template<class T>
|
|
inlinestaticnodiscardconstexprnoexcept |
From raw value (hardware register, table entry).
- Parameters
-
| value | Raw value (unknown bits are kept) |
- Returns
- Flags with given value
Definition at line 55 of file kFlags.hpp.
◆ isSet()
template<class T>
|
|
inlinenodiscardconstexprnoexcept |
Check if flag is set (all bits of non-empty flag).
- Parameters
-
| flag | Tested flag (may have several bits) |
- Returns
- true if all bits of flag are set (false for empty flag)
Definition at line 72 of file kFlags.hpp.
◆ set()
template<class T>
|
|
inlinenodiscardconstexprnoexcept |
Set flag (read-modify-write of hardware registers).
- Parameters
-
| flag | Set flag (may have several bits) |
- Returns
- Flags with all bits of flag set (other bits are kept)
Definition at line 81 of file kFlags.hpp.
◆ value()
template<class T>
|
|
inlinenodiscardconstexprnoexcept |
Get value.
- Returns
- Underlying value of flags
Definition at line 64 of file kFlags.hpp.
◆ mValue
The documentation for this class was generated from the following file: