10 #ifndef LARDATAOBJ_UTILITIES_FLAGSET_H 11 #define LARDATAOBJ_UTILITIES_FLAGSET_H 40 <
unsigned int NFlags,
typename Storage = details::smallestUInt_t<NFlags>>
43 static_assert(details::computePages<Storage>(NFlags) <= 1,
44 "Too many flags for this storage type.");
160 template <
typename Stream>
181 template <
typename... Args>
194 template <
unsigned int NBits,
typename Storage>
195 std::ostream&
operator<<
197 { flags.dump(out);
return out; }
208 #include "FlagSet.tcc" 213 #endif // LARDATAOBJ_UTILITIES_FLAGSET_H typename Bits_t::Flag_t Flag_t
Type identifying a single flag.
void dump(Stream &&out, unsigned int nBits) const
Prints into the specified stream the least nBits significant bits.
Namespace for general, non-LArSoft-specific utilities.
errors::OutOfRange OutOfRangeError
Out-of-range flag index.
errors::Exception Exception
Generic BitMask exception.
Base class for exceptions thrown by flag-related utilities.
errors::FlagNotDefined FlagNotDefinedError
Flag not defined.
util::flags::Bits_t< Storage_t > Bits_t
Set of bits.
A class containing a set of flags.
constexpr Mask_t const & mask() const
Returns all the flags in the form of a mask.
static constexpr Mask_t create(Args...args)
Creates a new BitMask.
util::flags::Index_t FlagIndex_t
Type of index of flag.
A class containing a set of flags.
static constexpr Mask_t createMask(Args...args)
Creates a new BitMask.
bool test(Flag_t flag) const
Returns if the specified flag is set.
FlagSet & operator=(This_t const &)=default
constexpr FlagSet(Mask_t const &from)
Constructor: copy the specified mask.
constexpr bool isFlag(FlagIndex_t flagIndex) const
Returns whether the flag index is valid.
void dump(Stream &&out) const
Dumps on screen only the "official" flags (see size()).
Exception thrown to convey that an invalid flag index was used.
bool testImpl(Flag_t flag) const
Implementation detail of test()
Exception thrown to convey that an undefined flag index was tested.
BitMask< Storage > Mask_t
Type of bit mask for this flag set.
static constexpr size_t size()
Returns the number of flags the set supports.