Flow123d  release_3.0.0-1111-g6aae175
Public Member Functions | Public Attributes | Static Private Member Functions | Friends | List of all members
FlagArray< Tag, Size >::Mask Class Reference

#include <flag_array.hh>

Public Member Functions

constexpr Mask ()=default
 
constexpr Mask (BitField mask, BitField set)
 Constructor. More...
 
constexpr Mask (BitField mask)
 
constexpr Mask operator& (Mask other) const
 
constexpr Mask operator~ () const
 Mask negation. More...
 
constexpr bool match (BitField flags) const
 

Public Attributes

BitField mask_
 The mask operates only on true bits of the mask_ member. More...
 
BitField set_
 Values of the mask. Only bits given by mask_ are significant. More...
 

Static Private Member Functions

static constexpr BitField mask_set (BitField set1, BitField mask2, BitField set2)
 Returns bitset set1 with bits given by mask set to the values given by the bitset set2. More...
 

Friends

template<class T , int S>
class FlagArray
 
std::ostream & operator<< (std::ostream &stream, const Mask &m)
 

Detailed Description

template<class Tag, int Size = 32>
class FlagArray< Tag, Size >::Mask

Class defines a flag mask that can set or reset certain bits to predefined values. Thus it consists of a mask part that specifies bits which are set to the second part set.

A Mask can be applied to an FlagArray via FlagArray::set() method, masks can be combined through the "&" operator and can be used to test flags via FlagArray::is() method.

Definition at line 64 of file flag_array.hh.

Constructor & Destructor Documentation

template<class Tag, int Size = 32>
constexpr FlagArray< Tag, Size >::Mask::Mask ( )
default

Here is the caller graph for this function:

template<class Tag, int Size = 32>
constexpr FlagArray< Tag, Size >::Mask::Mask ( BitField  mask,
BitField  set 
)
inline

Constructor.

Definition at line 70 of file flag_array.hh.

template<class Tag, int Size = 32>
constexpr FlagArray< Tag, Size >::Mask::Mask ( BitField  mask)
inline

Simple constructor. Namely to get elementary mask for one bit, e.g.

static constexpr Mask input_flag{0x0010};

Definition at line 80 of file flag_array.hh.

Member Function Documentation

template<class Tag, int Size = 32>
static constexpr BitField FlagArray< Tag, Size >::Mask::mask_set ( BitField  set1,
BitField  mask2,
BitField  set2 
)
inlinestaticprivate

Returns bitset set1 with bits given by mask set to the values given by the bitset set2.

Definition at line 113 of file flag_array.hh.

Here is the caller graph for this function:

template<class Tag, int Size = 32>
constexpr bool FlagArray< Tag, Size >::Mask::match ( BitField  flags) const
inline

Returns true if bits in passed flags are 1 on positions masked (equal to 1) by the Mask.

Definition at line 102 of file flag_array.hh.

template<class Tag, int Size = 32>
constexpr Mask FlagArray< Tag, Size >::Mask::operator& ( Mask  other) const
inline

Apply mask other to *this mask. That is, join bit masks and overwrite bits given by other.mask_ by outher.set_ values. The action of the result Mask on the FlagArray (method set()) is the same as application of *this followed by the application of other.

Definition at line 91 of file flag_array.hh.

template<class Tag, int Size = 32>
constexpr Mask FlagArray< Tag, Size >::Mask::operator~ ( ) const
inline

Mask negation.

Definition at line 96 of file flag_array.hh.

Friends And Related Function Documentation

template<class Tag, int Size = 32>
template<class T , int S>
friend class FlagArray
friend

Definition at line 123 of file flag_array.hh.

template<class Tag, int Size = 32>
std::ostream& operator<< ( std::ostream &  stream,
const Mask m 
)
friend

Definition at line 105 of file flag_array.hh.

Member Data Documentation

template<class Tag, int Size = 32>
BitField FlagArray< Tag, Size >::Mask::mask_

The mask operates only on true bits of the mask_ member.

Definition at line 118 of file flag_array.hh.

template<class Tag, int Size = 32>
BitField FlagArray< Tag, Size >::Mask::set_

Values of the mask. Only bits given by mask_ are significant.

Definition at line 120 of file flag_array.hh.


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