DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Util::FeatureTester< EnumType, > Class Template Reference

Holds a bitset containing flags to indicate which features a certain instrument/ module etc. supports. More...

Public Member Functions

constexpr FeatureTester () noexcept=default
 Constructs a FeatureTester instance with no flags set. More...
 
template<size_t N>
 FeatureTester (const std::array< EnumType, N > &Flags)
 Constructs a FeatureTester instance with the Flags passed as an array being set. More...
 
template<size_t N>
bool Test (const std::array< EnumType, N > &Flags) const
 Tests whether all of the flags passed as an array are set. More...
 
bool Test (EnumType Flag) const
 Tests whether a single flag is set. More...
 
void Set (EnumType Flag)
 Sets a flag. More...
 

Private Attributes

std::bitset< static_cast< size_t >EnumType::NUM_ELEMENTS)> Features
 Bitset containing the flags and their states. More...
 

Detailed Description

template<typename EnumType, std::enable_if_t< std::is_enum_v< EnumType >, int > = 0>
class Util::FeatureTester< EnumType, >

Holds a bitset containing flags to indicate which features a certain instrument/ module etc. supports.

Template Parameters
EnumTypeEnum class type containing flags the respective FeatureTester operates on. NUM_ELEMENTS must be the last element in EnumType. No values must be assigned to the enum's elements!

Definition at line 1230 of file Util.h.

Constructor & Destructor Documentation

◆ FeatureTester() [1/2]

template<typename EnumType , std::enable_if_t< std::is_enum_v< EnumType >, int > = 0>
constexpr Util::FeatureTester< EnumType, >::FeatureTester ( )
constexprdefaultnoexcept

Constructs a FeatureTester instance with no flags set.

◆ FeatureTester() [2/2]

template<typename EnumType , std::enable_if_t< std::is_enum_v< EnumType >, int > = 0>
template<size_t N>
Util::FeatureTester< EnumType, >::FeatureTester ( const std::array< EnumType, N > &  Flags)
inline

Constructs a FeatureTester instance with the Flags passed as an array being set.

Template Parameters
NAmount of flags contained in Flags. Automatically derived. Do not specify.
Parameters
FlagsFlags to set

Definition at line 1244 of file Util.h.

Member Function Documentation

◆ Set()

template<typename EnumType , std::enable_if_t< std::is_enum_v< EnumType >, int > = 0>
void Util::FeatureTester< EnumType, >::Set ( EnumType  Flag)
inline

Sets a flag.

Parameters
FlagFlag to set

Definition at line 1281 of file Util.h.

◆ Test() [1/2]

template<typename EnumType , std::enable_if_t< std::is_enum_v< EnumType >, int > = 0>
template<size_t N>
bool Util::FeatureTester< EnumType, >::Test ( const std::array< EnumType, N > &  Flags) const
inline

Tests whether all of the flags passed as an array are set.

Template Parameters
NAmount of flags contained in Flags. Automatically derived. Do not specify.
Parameters
FlagsFlags Flags to check
Returns
Returns true if all flags contained in Flags are set, false otherwise.

Definition at line 1257 of file Util.h.

◆ Test() [2/2]

template<typename EnumType , std::enable_if_t< std::is_enum_v< EnumType >, int > = 0>
bool Util::FeatureTester< EnumType, >::Test ( EnumType  Flag) const
inline

Tests whether a single flag is set.

Parameters
FlagFlag to be checked
Returns
Returns true if the flag is set, false otherwise.

Definition at line 1275 of file Util.h.

Member Data Documentation

◆ Features

template<typename EnumType , std::enable_if_t< std::is_enum_v< EnumType >, int > = 0>
std::bitset<static_cast<size_t>EnumType::NUM_ELEMENTS)> Util::FeatureTester< EnumType, >::Features
private

Bitset containing the flags and their states.

Definition at line 1287 of file Util.h.


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