LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
BitMask.h
Go to the documentation of this file.
1 
14 #ifndef LARDATAOBJ_UTILITIES_BITMASK_H
15 #define LARDATAOBJ_UTILITIES_BITMASK_H
16 
17 // C/C++ standard library
18 #include <exception>
19 #include <ostream>
20 #include <string>
21 
22 namespace util {
23 
56  namespace flags {
57 
59  using Index_t = unsigned int;
60 
61  namespace details {
62 
65  template <unsigned int NBits>
67 
69  template <unsigned int NBits>
71 
73  template <typename Storage>
74  constexpr unsigned int computePages(unsigned int bits);
75 
77  template <typename Storage>
78  constexpr Storage makeBits(Index_t index)
79  {
80  return Storage(1) << index;
81  }
82 
83  } // namespace details
84 
85  //--------------------------------------------------------------------------
87  template <typename Storage>
88  struct Flag_t {
89  using Storage_t = Storage;
91 
93 
95  constexpr Flag_t(Index_t flagIndex) : bits(details::makeBits<Storage_t>(flagIndex)) {}
96 
98  constexpr Index_t index() const;
99 
108  constexpr Flag_t copy() const { return *this; }
109 
112 
113  constexpr bool operator==(This_t other) const { return bits == other.bits; }
114  constexpr bool operator!=(This_t other) const { return bits != other.bits; }
115  constexpr bool operator<(This_t other) const { return bits < other.bits; }
116  constexpr bool operator>(This_t other) const { return bits > other.bits; }
117  constexpr bool operator<=(This_t other) const { return bits <= other.bits; }
118  constexpr bool operator>=(This_t other) const { return bits >= other.bits; }
119 
121 
122  }; // Flag_t
123 
126  template <typename Storage>
128  {
129  return left == right.index();
130  }
131  template <typename Storage>
133  {
134  return left.index() == right;
135  }
136 
137  template <typename Storage>
139  {
140  return left != right.index();
141  }
142  template <typename Storage>
144  {
145  return left.index() != right;
146  }
147 
148  template <typename Storage>
149  constexpr bool operator<(Index_t left, Flag_t<Storage> right)
150  {
151  return left < right.index();
152  }
153  template <typename Storage>
154  constexpr bool operator<(Flag_t<Storage> left, Index_t right)
155  {
156  return left.index() < right;
157  }
158 
159  template <typename Storage>
160  constexpr bool operator>(Index_t left, Flag_t<Storage> right)
161  {
162  return left > right.index();
163  }
164  template <typename Storage>
165  constexpr bool operator>(Flag_t<Storage> left, Index_t right)
166  {
167  return left.index() > right;
168  }
169 
170  template <typename Storage>
171  constexpr bool operator<=(Index_t left, Flag_t<Storage> right)
172  {
173  return left <= right.index();
174  }
175  template <typename Storage>
176  constexpr bool operator<=(Flag_t<Storage> left, Index_t right)
177  {
178  return left.index() <= right;
179  }
180 
181  template <typename Storage>
182  constexpr bool operator>=(Index_t left, Flag_t<Storage> right)
183  {
184  return left >= right.index();
185  }
186  template <typename Storage>
187  constexpr bool operator>=(Flag_t<Storage> left, Index_t right)
188  {
189  return left.index() >= right;
190  }
191 
193 
195  template <typename Storage>
196  std::ostream& operator<<(std::ostream& out, Flag_t<Storage> flag)
197  {
198  out << '[' << flag.index() << ']';
199  return out;
200  }
201 
203  template <typename Storage>
204  std::string to_string(Flag_t<Storage> const flag)
205  {
206  return std::to_string(flag.index());
207  }
208 
209  //--------------------------------------------------------------------------
211  template <typename Storage>
212  struct Bits_t {
213  using Storage_t = Storage;
215 
218 
219  Storage_t data = {0};
220 
222  constexpr Bits_t() = default;
223 
225  constexpr Bits_t(Flag_t flag) : data(flag.bits) {}
226 
228  explicit constexpr Bits_t(Storage_t bits) : data(bits) {}
229 
232 
234  constexpr bool empty() const { return data == Storage_t(0); }
235 
237  constexpr bool all(This_t bits) const;
238 
240  constexpr bool any(This_t bits) const;
241 
243  constexpr bool none(This_t bits) const;
244 
246  constexpr bool only(This_t bits) const;
247 
249 
252 
254  void set(This_t bits);
255 
257  void unset(This_t bits);
258 
260  void keepOnly(This_t bits);
261 
263  void clear() { data = 0; }
264 
266 
269 
271  constexpr This_t select(This_t bits) const;
272 
274  constexpr This_t exclude(This_t bits) const;
275 
277  constexpr This_t combine(This_t bits) const;
278 
280  constexpr This_t invert() const;
281 
283 
286 
287  constexpr bool operator==(This_t other) const { return data == other.data; }
288  constexpr bool operator!=(This_t other) const { return data != other.data; }
289  constexpr bool operator<(This_t other) const { return data < other.data; }
290  constexpr bool operator>(This_t other) const { return data > other.data; }
291  constexpr bool operator<=(This_t other) const { return data <= other.data; }
292  constexpr bool operator>=(This_t other) const { return data >= other.data; }
293 
295 
297  explicit constexpr operator bool() const { return bool(data); }
298 
300  constexpr bool operator!() const { return !data; }
301 
303  static void setBits(Storage_t& base, Storage_t bits) { base |= bits; }
304 
307  static void onlyBits(Storage_t& base, Storage_t bits) { base &= bits; }
308 
310  static void unsetBits(Storage_t& base, Storage_t bits) { onlyBits(base, ~bits); }
311 
312  }; // Bits_t
313 
315 
322  template <typename Storage>
325 
327  template <typename Storage>
329  typename Bits_t<Storage>::Flag_t right);
330 
332  template <typename Storage>
333  constexpr Bits_t<Storage> operator|(typename Bits_t<Storage>::Flag_t left,
334  Bits_t<Storage> right);
335 
337  template <typename Storage>
339 
341  template <typename Storage>
343 
345  template <typename Storage>
347  typename Bits_t<Storage>::Flag_t right);
348 
350  template <typename Storage>
351  constexpr Bits_t<Storage> operator+(typename Bits_t<Storage>::Flag_t left,
352  Bits_t<Storage> right);
353 
355  template <typename Storage>
357 
359 
360  //--------------------------------------------------------------------------
362  namespace errors {
363 
366 
368  struct Exception : public std::exception {
369  explicit Exception(std::string msg = "Flag error") : message(msg) {}
370  virtual const char* what() const noexcept override { return message.c_str(); }
371  std::string message;
372  }; // Exception
373 
375  struct FlagNotDefined : public Exception {
376  explicit FlagNotDefined(std::string msg = "Flag undefined-flag error") : Exception(msg) {}
377  }; // FlagNotDefined
378 
380  struct OutOfRange : public Exception {
381  explicit OutOfRange(std::string msg = "Flag out-of-range error") : Exception(msg) {}
382  }; // OutOfRange
383 
385 
386  } // namespace errors
387 
389 
392 
406  template <typename Storage>
407  class BitMask {
408 
410  using Storage_t = Storage;
411 
412  public:
414 
416 
418 
420  using Flag_t = typename Bits_t::Flag_t;
421 
424 
427 
430 
433 
435 
437  static constexpr auto fromValues = maskFromValues;
438 
439  // -- BEGIN Constructors from values -------------------------------------
448 
451  explicit constexpr BitMask() = default;
452 
464  constexpr BitMask(BitMaskFromValuesTag, Storage_t defined);
465 
480 
486 
495  constexpr BitMask(BitMaskFromValuesTag, Bits_t defined, Bits_t values);
496 
498  // -- END Constructors from values ---------------------------------------
499 
500  // -- BEGIN Constructors combining flags ---------------------------------
503 
513  template <typename... Others>
514  constexpr BitMask(Flag_t first, Others... others) : BitMask(create(first, others...))
515  {}
516 
526  template <typename... Others>
527  constexpr BitMask(Bits_t first, Others... others) : BitMask(create(first, others...))
528  {}
529 
541  // NOTE: if the first argument passed as reference prevent constexpr,
542  // two separate constructors will be needed;
543  // also note that this works as copy constructor as well
544  template <typename Second, typename... Others>
545  constexpr BitMask(Mask_t first, Second second, Others... others)
546  : BitMask(create(first, second, others...))
547  {}
548 
550  // -- END Constructors combining flags -----------------------------------
551 
552  // -- BEGIN Access to flags ----------------------------------------------
555 
567  constexpr bool isDefined(Flag_t flag) const;
568 
579  constexpr bool isDefined(Bits_t bits) const;
580 
589  constexpr bool isUndefined(Flag_t flag) const;
590 
599  constexpr bool isUndefined(Bits_t bits) const;
600 
610  constexpr bool get(Flag_t flag) const;
611 
621  constexpr bool isSet(Flag_t flag) const;
622 
632  constexpr bool isUnset(Flag_t flag) const;
633 
644  constexpr bool all(Bits_t bits) const;
645 
656  constexpr bool any(Bits_t bits) const;
657 
668  constexpr bool none(Bits_t bits) const;
669 
678  constexpr bool anySet(Mask_t const& mask) const;
679 
688  constexpr bool noneSet(Mask_t const& mask) const;
689 
701  constexpr bool match(Mask_t const& mask) const;
702 
704  // -- END Access to flags ------------------------------------------------
705 
706  // -- BEGIN Setting flags ------------------------------------------------
709 
723  template <typename Flag, typename... OtherFlags>
724  void set(Flag first, OtherFlags... others)
725  {
726  setImpl(first, others...);
727  }
728 
739  template <typename BeginIter, typename EndIter>
740  void rangeSet(BeginIter begin, EndIter end);
741 
753  template <typename Flag, typename... OtherFlags>
754  void unset(Flag first, OtherFlags... others)
755  {
756  unsetImpl(first, others...);
757  }
758 
769  template <typename BeginIter, typename EndIter>
770  void rangeUnset(BeginIter begin, EndIter end);
771 
792  template <typename Flag, typename... OtherFlags>
793  void remove(Flag first, OtherFlags... others)
794  {
795  undefineImpl(first, others...);
796  }
797 
799  void clear()
800  {
801  presence.clear();
802  values.clear();
803  }
804 
806  // -- END Setting flags --------------------------------------------------
807 
808  // -- BEGIN Number of flags ----------------------------------------------
811 
813  static constexpr size_t capacity();
814 
816  // -- END Number of flags ------------------------------------------------
817 
820  constexpr bool operator==(Mask_t const& other) const
821  {
822  return (values == other.values) && (presence == other.presence);
823  }
824 
827  constexpr bool operator!=(Mask_t const& other) const
828  {
829  return (values != other.values) || (presence != other.presence);
830  }
831 
833  template <typename Stream>
834  void dump(Stream&& out, unsigned int nBits) const;
835 
837  template <typename Stream>
838  void dump(Stream&& out) const
839  {
840  dump(std::forward<Stream>(out), capacity());
841  }
842 
843  // -- BEGIN Static mask manipulation -------------------------------------
846 
860  template <typename... Args>
861  static constexpr Mask_t create(Args... args);
862 
885  static constexpr Mask_t mergeIntoMask(Mask_t baseMask, Mask_t mask);
886 
904  static constexpr Mask_t mergeIntoMask(Mask_t baseMask, Bits_t bits);
905 
913  static constexpr Mask_t mergeIntoMask(Mask_t baseMask, Flag_t flag);
914 
945  static constexpr Mask_t combineWithMask(Mask_t A, Mask_t B);
946 
965  static constexpr Mask_t combineWithMask(Mask_t baseMask, Bits_t bits);
966 
973  static constexpr Mask_t combineWithMask(Mask_t baseMask, Flag_t flag);
974 
1000  static constexpr Mask_t intersectWithMask(Mask_t A, Mask_t B);
1001 
1022  static constexpr Mask_t intersectWithMask(Mask_t baseMask, Bits_t bits);
1023 
1030  static constexpr Mask_t intersectWithMask(Mask_t baseMask, Flag_t flag);
1031 
1054  static constexpr Mask_t unsetMask(Mask_t baseMask, Mask_t mask);
1055 
1076  static constexpr Mask_t unsetMask(Mask_t baseMask, Bits_t bits);
1077 
1084  static constexpr Mask_t unsetMask(Mask_t baseMask, Flag_t flag);
1085 
1103  static constexpr Mask_t negateMask(Mask_t mask);
1104 
1112  static constexpr Mask_t negateMask(Bits_t bits);
1113 
1119  static constexpr Mask_t negateMask(Flag_t flag);
1120 
1122  // -- END Static mask manipulation ---------------------------------------
1123 
1124  private:
1127 
1128  // Storage details
1129  // We store values and definition information in two different bit
1130  // buckets; the same Flag_t pattern is good for both.
1131 
1133  void defineSingle(Flag_t flag);
1134 
1136  void undefineSingle(Flag_t flag);
1137 
1139  void undefineImpl() {}
1140 
1142  template <typename... Flags>
1143  void undefineImpl(Flag_t flag, Flags... others);
1144 
1146  void setImpl() {}
1147 
1149  template <typename... Flags>
1150  void setImpl(Flag_t flag, Flags... others);
1151 
1153  void setSingle(Flag_t flag);
1154 
1156  void unsetImpl() {}
1157 
1159  constexpr Bits_t definedOnly() const;
1160 
1162  template <typename... Flags>
1163  void unsetImpl(Flag_t flag, Flags... others);
1164 
1166  void unsetSingle(Flag_t flag);
1167 
1169  static constexpr bool testBits(Storage_t data, Storage_t bits) { return data & bits; }
1170 
1172  static constexpr bool testBitmask(Storage_t data, Storage_t mask)
1173  {
1174  return (data & mask) == mask;
1175  }
1176 
1178  static constexpr bool testUnsetBitmask(Storage_t data, Storage_t mask)
1179  {
1180  return (data & ~mask) == data;
1181  }
1182 
1183  }; // BitMask<>
1184 
1186  template <typename Stream, typename Storage>
1187  Stream& operator<<(Stream&& out, BitMask<Storage> const& mask)
1188  {
1189  mask.dump(std::forward<Stream>(out));
1190  return out;
1191  }
1192 
1193  // -- BEGIN Flag and mask management ---------------------------------------
1214 
1218  template <typename Storage>
1220 
1223  template <typename Storage>
1225  typename BitMask<Storage>::Bits_t right);
1226 
1229  template <typename Storage>
1230  constexpr BitMask<Storage> operator|(typename BitMask<Storage>::Bits_t left,
1231  BitMask<Storage> right);
1232 
1233  // operator|(Bits_t, Bits_t) is still a Bits_t
1234 
1237  template <typename Storage>
1239 
1242  template <typename Storage>
1244  typename BitMask<Storage>::Bits_t right);
1245 
1248  template <typename Storage>
1249  constexpr BitMask<Storage> operator&(typename BitMask<Storage>::Bits_t left,
1250  BitMask<Storage> right);
1251 
1254  template <typename Storage>
1256 
1259  template <typename Storage>
1260  constexpr BitMask<Storage> operator+(BitMask<Storage> baseMask, BitMask<Storage> mask);
1261 
1264  template <typename Storage>
1265  constexpr BitMask<Storage> operator+(BitMask<Storage> baseMask,
1266  typename BitMask<Storage>::Bits_t bits);
1267 
1270  template <typename Storage>
1271  constexpr BitMask<Storage> operator+(typename BitMask<Storage>::Bits_t baseBits,
1272  BitMask<Storage> mask);
1273 
1274  // operator+(Bits_t, Bits_t) is still a Bits_t
1275 
1278  template <typename Storage>
1279  constexpr BitMask<Storage> operator-(BitMask<Storage> baseMask, BitMask<Storage> mask);
1280 
1283  template <typename Storage>
1284  constexpr BitMask<Storage> operator-(BitMask<Storage> baseMask,
1285  typename BitMask<Storage>::Bits_t bits);
1286 
1289  template <typename Storage>
1290  constexpr BitMask<Storage> operator-(typename BitMask<Storage>::Bits_t baseBits,
1291  BitMask<Storage> mask);
1292 
1295  template <typename Storage>
1296  constexpr BitMask<Storage> operator-(Bits_t<Storage> baseBits, Bits_t<Storage> bits);
1297 
1299  template <typename Storage>
1301 
1303  template <typename Storage>
1304  constexpr BitMask<Storage> operator+(Bits_t<Storage> bits);
1305 
1307  template <typename Storage>
1308  constexpr BitMask<Storage> operator-(Bits_t<Storage> bits);
1309 
1311  template <typename Storage>
1312  constexpr BitMask<Storage> operator-(Flag_t<Storage> flag);
1313 
1315  template <typename Storage>
1317 
1318  /*
1320  template <typename Storage>
1321  constexpr BitMask<Storage> operator~ (Bits_t<Storage> bits);
1322  */
1323 
1325  template <typename Storage>
1326  constexpr BitMask<Storage> Set(Flag_t<Storage> flag);
1327 
1329  template <typename Storage>
1330  constexpr BitMask<Storage> Unset(Flag_t<Storage> flag);
1331 
1333  // -- END Flag and mask management -----------------------------------------
1334 
1336  template <typename Storage>
1337  constexpr BitMask<Storage> makeMask(Bits_t<Storage> bits);
1338 
1339  } // namespace flags
1340 
1341 } // namespace util
1342 
1343 //------------------------------------------------------------------------------
1344 //--- template implementation
1345 //---
1346 
1348 
1349 //------------------------------------------------------------------------------
1350 
1351 #endif // LARDATAOBJ_UTILITIES_BITMASK_H
typename Bits_t::Flag_t Flag_t
Type identifying a single flag.
Definition: BitMask.h:420
Storage_t bits
The bits representing this flag (only one is set)
Definition: BitMask.h:92
constexpr unsigned int computePages(unsigned int bits)
Returns the number of Storage variables needed to hold that many bits.
constexpr Bits_t(Flag_t flag)
Constructs from a single flag.
Definition: BitMask.h:225
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:26
constexpr bool operator==(This_t other) const
Definition: BitMask.h:113
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
typename SmallestUIntType< NBits >::type smallestUInt_t
The smallest integral type accommodating NBits bits.
Definition: BitMask.h:70
constexpr bool operator>(Index_t left, Flag_t< Storage > right)
Definition: BitMask.h:160
Base class for exceptions thrown by flag-related utilities.
Definition: BitMask.h:368
constexpr Bits_t< Storage > operator|(Bits_t< Storage > left, Bits_t< Storage > right)
Returns a new Bits_t with all the bits from both arguments set.
void message(RunManager *runmanager)
Definition: ts_scorers.cc:74
FlagNotDefined(std::string msg="Flag undefined-flag error")
Definition: BitMask.h:376
Type identifying a flag. Operations are implemented as free functions.
Definition: BitMask.h:88
static void onlyBits(Storage_t &base, Storage_t bits)
Definition: BitMask.h:307
constexpr bool operator>=(This_t other) const
Definition: BitMask.h:118
void unsetImpl()
Implementation detail of unset()
Definition: BitMask.h:1156
constexpr bool operator!=(This_t other) const
Definition: BitMask.h:114
constexpr bool operator>=(Index_t left, Flag_t< Storage > right)
Definition: BitMask.h:182
unsigned int Index_t
Type to denote the index of the flag.
Definition: BitMask.h:59
util::flags::Index_t FlagIndex_t
Type of index of flag.
Definition: BitMask.h:415
void dump(Stream &&out) const
Prints into the specified stream all bits.
Definition: BitMask.h:838
Type for constructor tag from values.
Definition: BitMask.h:388
static constexpr bool testUnsetBitmask(Storage_t data, Storage_t mask)
Returns whether all the specified bits in the mask are set.
Definition: BitMask.h:1178
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
static constexpr bool testBits(Storage_t data, Storage_t bits)
Returns whether any of the specified bits is set.
Definition: BitMask.h:1169
constexpr bool operator>(This_t other) const
Definition: BitMask.h:116
constexpr BitMask< Storage > operator-(BitMask< Storage > baseMask, BitMask< Storage > mask)
A class containing a set of flags.
Definition: BitMask.h:407
constexpr Storage makeBits(Index_t index)
Returns a set of bits with only the one at the specified index set.
Definition: BitMask.h:78
constexpr bool empty() const
Returns whether there is no bit set at all.
Definition: BitMask.h:234
constexpr Flag_t(Index_t flagIndex)
Constructs from the flag index.
Definition: BitMask.h:95
constexpr bool operator!=(Mask_t const &other) const
Definition: BitMask.h:827
constexpr BitMask< Storage > operator~(BitMask< Storage > mask)
Returns a bit set which unsets the specified bits.
constexpr bool operator<(This_t other) const
Definition: BitMask.h:289
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
constexpr BitMask< Storage > Set(Flag_t< Storage > flag)
Returns a bit mask which sets the specified flag.
static void setBits(Storage_t &base, Storage_t bits)
Returns data with all bits from base and from bits set.
Definition: BitMask.h:303
constexpr bool operator>=(This_t other) const
Definition: BitMask.h:292
Storage Storage_t
Type of underlying bit data representation.
Definition: BitMask.h:410
Storage Storage_t
Definition: BitMask.h:89
void clear()
Unsets all bits.
Definition: BitMask.h:263
bool invert(ublas::matrix< T, L, A > &m)
constexpr Bits_t< Storage > operator+(Bits_t< Storage > left, Bits_t< Storage > right)
Returns a new Bits_t with all the bits from both arguments set.
static constexpr bool testBitmask(Storage_t data, Storage_t mask)
Returns whether all the specified bits in the mask are set.
Definition: BitMask.h:1172
constexpr bool operator!=(Index_t left, Flag_t< Storage > right)
Definition: BitMask.h:138
Collection of utilities for dumping data on screen.
Definition: DumperBase.h:28
Type identifying a set of bits.
Definition: BitMask.h:212
constexpr BitMask< Storage > makeMask(Bits_t< Storage > bits)
Constructs a mask from bits.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr bool operator==(Index_t left, Flag_t< Storage > right)
Definition: BitMask.h:127
constexpr bool operator>(This_t other) const
Definition: BitMask.h:290
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
constexpr BitMask(Bits_t first, Others...others)
Constructor: merges all arguments in the argument list.
Definition: BitMask.h:527
void unset(Flag first, OtherFlags...others)
Unsets all specified flags.
Definition: BitMask.h:754
constexpr BitMask(Flag_t first, Others...others)
Constructor: merges all arguments in the argument list.
Definition: BitMask.h:514
std::string to_string(Flag_t< Storage > const flag)
Convert a flag into a stream (shows its index).
Definition: BitMask.h:204
virtual const char * what() const noexcept override
Definition: BitMask.h:370
constexpr bool operator==(Mask_t const &other) const
Definition: BitMask.h:820
static void unsetBits(Storage_t &base, Storage_t bits)
Returns data with all bits from base, but the ones from bits unset.
Definition: BitMask.h:310
Exception(std::string msg="Flag error")
Definition: BitMask.h:369
util::flags::Flag_t< Storage_t > Flag_t
Type of flag matching our storage.
Definition: BitMask.h:217
Bits_t values
Storage of value bits.
Definition: BitMask.h:1125
constexpr Bits_t(Storage_t bits)
Constructs from a set of bits.
Definition: BitMask.h:228
void setImpl()
Implementation detail of set()
Definition: BitMask.h:1146
constexpr BitMask< Storage > operator&(BitMask< Storage > left, BitMask< Storage > right)
Exception thrown to convey that an invalid flag index was used.
Definition: BitMask.h:380
constexpr bool operator<=(This_t other) const
Definition: BitMask.h:117
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
constexpr BitMaskFromValuesTag maskFromValues
Value useful for BitMask constructors from value.
Definition: BitMask.h:391
Bits_t presence
Storage of definition bits.
Definition: BitMask.h:1126
void clear()
Undefines all bits.
Definition: BitMask.h:799
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82
OutOfRange(std::string msg="Flag out-of-range error")
Definition: BitMask.h:381
Storage_t data
The bits representing all set bits.
Definition: BitMask.h:219
constexpr Flag_t copy() const
Returns a copy of this object.
Definition: BitMask.h:108
constexpr bool operator!=(This_t other) const
Definition: BitMask.h:288
constexpr Index_t index() const
Returns the index of the (first) bit set.
constexpr bool operator==(This_t other) const
Definition: BitMask.h:287
Exception thrown to convey that an undefined flag index was tested.
Definition: BitMask.h:375
constexpr BitMask< Storage > Unset(Flag_t< Storage > flag)
Returns a bit mask which unsets the specified flag.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void undefineImpl()
Implementation detail of remove()
Definition: BitMask.h:1139
constexpr bool operator<=(This_t other) const
Definition: BitMask.h:291
constexpr bool operator<(This_t other) const
Definition: BitMask.h:115
constexpr bool operator!() const
Returns true if there is no bit set.
Definition: BitMask.h:300
constexpr BitMask(Mask_t first, Second second, Others...others)
Constructor: merges all arguments in the argument list.
Definition: BitMask.h:545