|
rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
|
Stores a set of bits in the form of flags Similar to std::bitset but instead of a index based interface it provides a enum based interface. More...
#include <rexlib/core/binary/flagset.hpp>
Public Types | |
| using | bit_type = B |
| The provided enum declaration of the flag bits. | |
| using | underlying_type = typename std::underlying_type< bit_type >::type |
| The underlying type of the provided enum. | |
| using | unsigned_type = typename std::make_unsigned< underlying_type >::type |
| Unsigned underlying type of the provided enum. | |
Public Member Functions | |
| REXLIB_CONSTEXPR | flagset () noexcept |
| Empty constructor. It initializes the set as none of the flags were set. | |
| REXLIB_CONSTEXPR | flagset (bit_type bit) noexcept |
| Initializes the set with a single bit set. | |
| REXLIB_CONSTEXPR | flagset (underlying_type data) noexcept |
| Constructs the flagset from raw binary data. | |
| template<typename It > | |
| REXLIB_CONSTEXPR | flagset (It first, It last) noexcept |
| Initializes the set with the elements inside the a iterator range. | |
| REXLIB_CONSTEXPR | flagset (std::initializer_list< bit_type > bits) noexcept |
| Initializes the set with a initializer list. | |
| flagset (const flagset &other)=default | |
| Copy constructor. | |
| flagset (flagset &&other) noexcept=default | |
| Move constructor. Same behaviour as copy constructor. | |
| ~flagset ()=default | |
| Destroy the flagset object. | |
| flagset & | operator= (const flagset &other)=default |
| Copy assign operator. | |
| flagset & | operator= (flagset &&other) noexcept=default |
| Move assign operator. Same behaviour as copy constructor. | |
| REXLIB_CONSTEXPR | operator bool () const noexcept |
| Checks if the set is nonzero. | |
| REXLIB_CONSTEXPR | operator underlying_type () const noexcept |
| Converts to the underlying type of the bit definition bits set. | |
| REXLIB_CONSTEXPR flagset & | operator|= (const flagset &rhs) noexcept |
| In-place union with another flagset. | |
| REXLIB_CONSTEXPR flagset & | operator&= (const flagset &rhs) noexcept |
| In-place intersection with another flagset. | |
| REXLIB_CONSTEXPR flagset & | operator^= (const flagset &rhs) noexcept |
| In-place XOR with another flagset. | |
| REXLIB_CONSTEXPR underlying_type | get_bits () const noexcept |
| Obtain the underlying integer representation of the flags. | |
| REXLIB_CONSTEXPR bool | contains (const bit_type &bit) const noexcept |
| Tests if the requested flag is set. | |
| REXLIB_CONSTEXPR bool | all_of (const flagset &other) const noexcept |
| Checks if all of a set of flags are present in this. | |
| REXLIB_CONSTEXPR bool | any_of (const flagset &other) const noexcept |
| Checks if any of a set of flags are present in this. | |
| REXLIB_CONSTEXPR bool | none_of (const flagset &other) const noexcept |
| Checks if none of a set of flags are present in this. | |
| REXLIB_CONSTEXPR bool | only_of (const flagset &other) const noexcept |
| Checks if only a set of flags are present in this. | |
| REXLIB_CONSTEXPR int | count () const noexcept |
| Counts the number of flags that are present. | |
| REXLIB_CONSTEXPR bool | parity () const noexcept |
| Computes the parity of the stored flags. | |
| REXLIB_CONSTEXPR bool | has_single_bit () const noexcept |
| Checks if only one flag is present. | |
| REXLIB_CONSTEXPR flagset & | set (const flagset &other, bool value) noexcept |
| Set a particular set of flags to the desired value. | |
| REXLIB_CONSTEXPR flagset & | set (const flagset &other) noexcept |
| Sets a particular set of flags. | |
| REXLIB_CONSTEXPR flagset & | clear () noexcept |
| Clears all flags. | |
| REXLIB_CONSTEXPR flagset & | clear (const flagset &other) noexcept |
| Clears a particular set of flags. | |
| REXLIB_CONSTEXPR flagset & | toggle (const flagset &other) noexcept |
| Toggles a particular set of flags. | |
Friends | |
| REXLIB_CONSTEXPR bool | operator== (const flagset &lhs, const flagset &rhs) noexcept |
| Compares for equality with another flagset. | |
| REXLIB_CONSTEXPR bool | operator!= (const flagset &lhs, const flagset &rhs) noexcept |
| Compares for inequality with another flagset. | |
| REXLIB_CONSTEXPR flagset | operator| (const flagset &lhs, const flagset &rhs) noexcept |
| REXLIB_CONSTEXPR flagset | operator& (const flagset &lhs, const flagset &rhs) noexcept |
| REXLIB_CONSTEXPR flagset | operator^ (const flagset &lhs, const flagset &rhs) noexcept |
Stores a set of bits in the form of flags Similar to std::bitset but instead of a index based interface it provides a enum based interface.
| B | enum type which contains the declaration of the flag bits |
|
noexcept |
Initializes the set with a single bit set.
| bit | The bit to be set |
|
explicitnoexcept |
Constructs the flagset from raw binary data.
| data | The binary data |
|
noexcept |
Initializes the set with the elements inside the a iterator range.
| It | forward iterator |
| first | Iterator to the first element |
| last | Iterator to the past the end element |
|
noexcept |
Initializes the set with a initializer list.
| bits | Initializer list with the flags to be set |
Copy constructor.
| other | The set to be copied from |
Move constructor. Same behaviour as copy constructor.
| other | The set to be copied from |
Checks if all of a set of flags are present in this.
| other | The set of flags that needs to be present here |
Checks if any of a set of flags are present in this.
| other | The set of flags that needs to be present here |
|
noexcept |
Clears all flags.
Clears a particular set of flags.
| other | The set of flags to be cleared |
|
noexcept |
Tests if the requested flag is set.
| bit | The flag to be tested. |
|
noexcept |
Counts the number of flags that are present.
|
noexcept |
Obtain the underlying integer representation of the flags.
|
noexcept |
Checks if only one flag is present.
Checks if none of a set of flags are present in this.
| other | The set of flags that needs to be absent here |
Checks if only a set of flags are present in this.
| other | The set of allowed flags |
|
noexcept |
Checks if the set is nonzero.
|
explicitnoexcept |
Converts to the underlying type of the bit definition bits set.
In-place intersection with another flagset.
| rhs | The other flagset |
Copy assign operator.
| other | The set to be copied from |
|
defaultnoexcept |
Move assign operator. Same behaviour as copy constructor.
| other | The set to be copied from |
In-place XOR with another flagset.
| rhs | The other flagset |
In-place union with another flagset.
| rhs | The other flagset |
|
noexcept |
Computes the parity of the stored flags.
Sets a particular set of flags.
| other | The set of flags to be set |
|
noexcept |
Set a particular set of flags to the desired value.
| other | The set of flags to be changed |
| value | The value of the flags |
Toggles a particular set of flags.
| other | The set of flags to be toggled |
Compares for inequality with another flagset.
| lhs | One flagset |
| rhs | The other flagset |
Compares for equality with another flagset.
| lhs | One flagset |
| rhs | The other flagset |