62 template<
typename BITS_ENUM,
typename UNDERLYING =
unsigned long>
113 operator Private_bool * ()
const
114 {
return _v != 0 ? (Private_bool *)1 : 0; }
121 {
return type(lhs._v | rhs._v); }
125 {
return lhs |
type(rhs); }
129 {
return type(lhs._v & rhs._v); }
133 {
return lhs &
type(rhs); }
167 template<>
struct Int_for_size<sizeof(unsigned char), true>
168 {
typedef unsigned char type; };
171 (sizeof(unsigned short) > sizeof(unsigned char))>
172 {
typedef unsigned short type; };
174 template<>
struct Int_for_size<sizeof(unsigned),
175 (sizeof(unsigned) > sizeof(unsigned short))>
176 {
typedef unsigned type; };
178 template<>
struct Int_for_size<sizeof(unsigned long),
179 (sizeof(unsigned long) > sizeof(unsigned))>
180 {
typedef unsigned long type; };
182 template<>
struct Int_for_size<sizeof(unsigned long long),
183 (sizeof(unsigned long long) > sizeof(unsigned long))>
184 {
typedef unsigned long long type; };
207#define L4_TYPES_FLAGS_OPS_DEF(T) \
208 friend constexpr T operator ~ (T f) \
210 return T(~((typename L4::Types::Int_for_type<T>::type)f)); \
213 friend constexpr T operator | (T l, T r) \
215 return T(((typename L4::Types::Int_for_type<T>::type)l) \
216 | ((typename L4::Types::Int_for_type<T>::type)r)); \
219 friend constexpr T operator & (T l, T r) \
221 return T(((typename L4::Types::Int_for_type<T>::type)l) \
222 & ((typename L4::Types::Int_for_type<T>::type)r)); \
231 template<
typename DT>
236 {
return DT(l.raw | r.raw); }
240 {
return DT(l.raw & r.raw); }
244 {
return l.raw == r.raw; }
248 {
return l.raw != r.raw; }
253 static_cast<DT *
>(
this)->raw |= r.raw;
254 return *
static_cast<DT *
>(
this);
260 static_cast<DT *
>(
this)->raw &= r.raw;
261 return *
static_cast<DT *
>(
this);
265 explicit constexpr operator bool ()
const
267 return static_cast<DT
const *
>(
this)->raw != 0;
272 {
return DT(~
static_cast<DT
const *
>(
this)->raw); }
283 template<
typename DT,
typename T>
323 template<
typename A,
typename B>
329 template<
bool EXP,
typename T =
void>
struct Enable_if {};
330 template<
typename T>
struct Enable_if<true, T> {
typedef T type; };
332 template<
typename T1,
typename T2,
typename T =
void>
333 struct Enable_if_same : Enable_if<Same<T1, T2>::value, T> {};
335 template<
typename T>
struct Remove_const {
typedef T type; };
336 template<
typename T>
struct Remove_const<T const> {
typedef T type; };
337 template<
typename T>
struct Remove_volatile {
typedef T type; };
338 template<
typename T>
struct Remove_volatile<T volatile> {
typedef T type; };
339 template<
typename T>
struct Remove_cv
340 {
typedef typename Remove_const<typename Remove_volatile<T>::type>::type type; };
342 template<
typename T>
struct Remove_pointer {
typedef T type; };
343 template<
typename T>
struct Remove_pointer<T*> {
typedef T type; };
344 template<
typename T>
struct Remove_reference {
typedef T type; };
345 template<
typename T>
struct Remove_reference<T&> {
typedef T type; };
346 template<
typename T>
struct Remove_pr {
typedef T type; };
347 template<
typename T>
struct Remove_pr<T&> {
typedef T type; };
348 template<
typename T>
struct Remove_pr<T*> {
typedef T type; };
Template for defining typical Flags bitmaps.
value_type as_value() const
Get the underlying value.
static type from_raw(value_type v)
Make flags from a raw value of value_type.
type & clear(bits_enum_type flag)
Clear the given flag.
type operator~() const
Support ~ for Flags types.
UNDERLYING value_type
type of the underlying value
type & operator|=(type rhs)
Support |= of two compatible Flags types.
Flags()
Make default Flags.
friend type operator|(type lhs, type rhs)
Support | of two compatible Flags types.
friend type operator&(type lhs, type rhs)
Support & of two compatible Flags types.
None_type
The none type to get an empty bitmap.
@ None
Use this to get an empty bitmap.
BITS_ENUM bits_enum_type
enum type defining a name for each bit
bool operator!() const
Support for if (!flags) syntax (test for empty flags).
Flags(None_type)
Make an empty bitmap.
Flags< BITS_ENUM, UNDERLYING > type
the Flags<> type itself
Flags(BITS_ENUM e)
Make flags from bit name.
type & operator&=(type rhs)
Support &= of two compatible Flags types.
L4 low-level kernel interface.
Bool< V > type
The meta type itself.
Mixin class to define a set of friend bitwise operators on DT.
DT operator|=(DT r)
bitwise or assignment for DT
friend constexpr bool operator!=(DT l, DT r)
inequality for DT
constexpr DT operator~() const
bitwise negation for DT
friend constexpr DT operator&(DT l, DT r)
bitwise and for DT
DT operator&=(DT r)
bitwise and assignment for DT
friend constexpr DT operator|(DT l, DT r)
bitwise or for DT
friend constexpr bool operator==(DT l, DT r)
equality for DT
Template type to define a flags type with bitwise operations.
Flags_t()=default
Default (uninitializing) costructor.
constexpr Flags_t(T f)
Explicit initialization from the underlying type.
Metafunction to get an unsigned integral type for the given size.
Metafunction to get an integral type of the same size as T.
Int_for_size< sizeof(T)>::type type
The resulting unsigned integer type with the size like T.
Compare two data types for equality.