Gromacs
2018.8
|
#include <gromacs/utility/flags.h>
Template class for typesafe handling of combination of flags.
FlagType | An enumerated type that holds the possible single flags. |
This class is not used publicly, but is present in an installed header because it is used internally in public template classes.
Currently, it is not completely transparent, since or'ing together two FlagType
flags does not automatically create a FlagsTemplate object. Also, some operators and more complex operations (like testing for multiple flags at the same time) are missing, but can be added if the need arises.
Public Member Functions | |
FlagsTemplate () | |
Creates a flags object with no flags set. | |
FlagsTemplate (FlagType flag) | |
Creates a flags object from a single flag. | |
bool | test (FlagType flag) const |
Tests if the given flag is set. More... | |
void | clearAll () |
Clears all flags. | |
void | set (FlagType flag) |
Sets the given flag. | |
void | clear (FlagType flag) |
Clears the given flag. | |
void | set (FlagType flag, bool bSet) |
Sets or clears the given flag. | |
FlagsTemplate< FlagType > | operator| (const FlagsTemplate< FlagType > &other) const |
Combines flags from two flags objects. | |
FlagsTemplate< FlagType > & | operator|= (const FlagsTemplate< FlagType > &other) |
Combines flags from another flag object. | |
FlagsTemplate< FlagType > | operator& (const FlagsTemplate< FlagType > &other) const |
Combined flags from two flags objects. | |
FlagsTemplate< FlagType > | operator~ () const |
Returns an object with all flags flipped. | |
|
inline |
Tests if the given flag is set.
Note that if flag
has more than a single bit set, then returns true if any of them is set.