5 #include <libutl/Object.h> 55 copyFlags(rhs._flags, lsb, msb);
73 mask = ((
uint64_t)1 << (msb + 1)) - 1;
74 if (lsb > 0) mask &= ~(((
uint64_t)1 << lsb) - 1);
75 _flags = (_flags & ~mask) | (flags & mask);
94 return ((_flags & mask) != 0);
122 return (_flags & mask) >> shift;
135 _flags |= (num << shift);
185 _value =
object->
getFlag(flagNum);
186 object->setFlag(flagNum, val);
193 _object->setFlag(_flagNum, _value);
uint64_t getFlagsNumber(uint64_t mask, uint64_t shift=0)
Get a multi-bit value in the flags data (which is stored as one 64-bit integer).
void serialize(bool &b, Stream &stream, uint_t io, uint_t mode=ser_default)
Serialize a boolean.
FlagGuard(FlagsMI *object, uint_t flagNum, bool val)
Constructor.
void setFlag(uint_t flagNum, bool val)
Set a user-defined flag.
void copyFlags(uint64_t flags, uint_t lsb, uint_t msb)
Copy (some of) the given flags.
void setFlagsNumber(uint64_t mask, uint64_t shift, uint64_t num)
Set a multi-bit value in the flags data (which is stored as one 64-bit integer).
~FlagGuard()
Restore the previous value of the flag.
uint64_t getFlags() const
Get the flags.
Mix-in to provide 64-bits for space-efficient storage of up to 64 boolean flags.
virtual ~FlagsMI()
Destructor.
unsigned long uint64_t
Unsigned 64-bit integer.
void copyFlags(const FlagsMI &rhs, uint_t lsb, uint_t msb)
Copy (some of) the given flags.
unsigned int uint_t
Unsigned integer.
const uint64_t uint64_t_max
Maximum uint64_t value.
void copyFlags(const FlagsMI &rhs)
Copy the given flags.
void setFlags(uint64_t flags)
Set the flags.
bool getFlag(uint_t flagNum) const
Get a user-defined flag.
#define ASSERTD
Do an assertion in DEBUG mode only.