All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | List of all members
util::flags::Flag_t< Storage > Struct Template Reference

Type identifying a flag. Operations are implemented as free functions. More...

#include <BitMask.h>

Public Types

using Storage_t = Storage
 
using This_t = Flag_t< Storage >
 This type. More...
 

Public Member Functions

constexpr Flag_t (Index_t flagIndex)
 Constructs from the flag index. More...
 
constexpr Index_t index () const
 Returns the index of the (first) bit set. More...
 
constexpr Flag_t copy () const
 Returns a copy of this object. More...
 
Comparison operators for flags
constexpr bool operator== (This_t other) const
 
constexpr bool operator!= (This_t other) const
 
constexpr bool operator< (This_t other) const
 
constexpr bool operator> (This_t other) const
 
constexpr bool operator<= (This_t other) const
 
constexpr bool operator>= (This_t other) const
 

Public Attributes

Storage_t bits
 The bits representing this flag (only one is set) More...
 

Detailed Description

template<typename Storage>
struct util::flags::Flag_t< Storage >

Type identifying a flag. Operations are implemented as free functions.

Definition at line 89 of file BitMask.h.

Member Typedef Documentation

template<typename Storage>
using util::flags::Flag_t< Storage >::Storage_t = Storage

Definition at line 90 of file BitMask.h.

template<typename Storage>
using util::flags::Flag_t< Storage >::This_t = Flag_t<Storage>

This type.

Definition at line 91 of file BitMask.h.

Constructor & Destructor Documentation

template<typename Storage>
constexpr util::flags::Flag_t< Storage >::Flag_t ( Index_t  flagIndex)
inline

Constructs from the flag index.

Definition at line 96 of file BitMask.h.

97  : bits(details::makeBits<Storage_t>(flagIndex))
98  {}
Storage_t bits
The bits representing this flag (only one is set)
Definition: BitMask.h:93

Member Function Documentation

template<typename Storage>
constexpr Flag_t util::flags::Flag_t< Storage >::copy ( ) const
inline

Returns a copy of this object.

Returns
a copy of this flag

When a flag is declared as constexpr, functions trying to take its address will trigger a link failure (as there is no address for a constexpr). Passing a copy of it should fix the problem.

Definition at line 111 of file BitMask.h.

111 { return *this; }
template<typename Storage>
constexpr Index_t util::flags::Flag_t< Storage >::index ( ) const

Returns the index of the (first) bit set.

template<typename Storage>
constexpr bool util::flags::Flag_t< Storage >::operator!= ( This_t  other) const
inline

Definition at line 118 of file BitMask.h.

119  { return bits != other.bits; }
Storage_t bits
The bits representing this flag (only one is set)
Definition: BitMask.h:93
template<typename Storage>
constexpr bool util::flags::Flag_t< Storage >::operator< ( This_t  other) const
inline

Definition at line 120 of file BitMask.h.

121  { return bits < other.bits; }
Storage_t bits
The bits representing this flag (only one is set)
Definition: BitMask.h:93
template<typename Storage>
constexpr bool util::flags::Flag_t< Storage >::operator<= ( This_t  other) const
inline

Definition at line 124 of file BitMask.h.

125  { return bits <= other.bits; }
Storage_t bits
The bits representing this flag (only one is set)
Definition: BitMask.h:93
template<typename Storage>
constexpr bool util::flags::Flag_t< Storage >::operator== ( This_t  other) const
inline

Definition at line 116 of file BitMask.h.

117  { return bits == other.bits; }
Storage_t bits
The bits representing this flag (only one is set)
Definition: BitMask.h:93
template<typename Storage>
constexpr bool util::flags::Flag_t< Storage >::operator> ( This_t  other) const
inline

Definition at line 122 of file BitMask.h.

123  { return bits > other.bits; }
Storage_t bits
The bits representing this flag (only one is set)
Definition: BitMask.h:93
template<typename Storage>
constexpr bool util::flags::Flag_t< Storage >::operator>= ( This_t  other) const
inline

Definition at line 126 of file BitMask.h.

127  { return bits >= other.bits; }
Storage_t bits
The bits representing this flag (only one is set)
Definition: BitMask.h:93

Member Data Documentation

template<typename Storage>
Storage_t util::flags::Flag_t< Storage >::bits

The bits representing this flag (only one is set)

Definition at line 93 of file BitMask.h.


The documentation for this struct was generated from the following file: