modm API documentation
modm::FlagsGroup< T... > Struct Template Reference

#include <modm/architecture/interface/register.hpp>

Inheritance diagram for modm::FlagsGroup< T... >:
modm::Register< T::UnderlyingType >

Public Typedefs

typedef T UnderlyingType
 The integer type internally used to represent the register.
 

Public Member Functions

constexpr FlagsGroup ()
 default constructor initializes value to zero
 
constexpr FlagsGroup (FlagsGroup const &o)
 copy constructor
 
constexpr FlagsGroup (typename T::UnderlyingType value)
 explicit underlying type constructor
 
constexpr FlagsGroup (typename T::EnumType value)
 enum type constructor
 
constexpr FlagsGroup (::modm::FlagsOperators< typename T::EnumType, typename T::UnderlyingType > value)
 Flags operators and Flags constructor.
 
constexpr operator bool () const
 
constexpr bool operator! () const
 Returns true if value is zero.
 

Public Attributes

UnderlyingType value
 The underlying integer value.
 

Detailed Description

template<typename T...>
struct modm::FlagsGroup< T... >

Class for grouping several Flags classes together.

This variadic template class allows you to create a type which provides constructor overloads for the provided types.

This will allow you to cast the passed Flags classes into one class, but not other classes. Notice that this cast destroys type information (naturally) and therefore you cannot use any of the Flags classes type-safe operator overloads. The same reasoning applies here as in the Register class.

typedef Flags8<Control1> Control1_t;
typedef Flags8<Control2> Control2_t;
typedef FlagsGroup<Control1_t, Control2_t> Control_t;
void function(Control_t control);
// both call the same function
function(Control1_t(0x20));
function(Control2_t(0x10));
Template Parameters
T...the Flags classes to be grouped. Must all have the same underlying types.
Author
Niklas Hauser

Member Function Documentation

constexpr modm::Register< T >::operator bool ( ) const
inheritedinlineexplicitconstexpr

Returns true if value is non-zero

The compiler will allow implicit conversions to bool in the following contexts:

  • conditions of if, while, for, do-while statements
  • logical operators (&&, ||)
  • negation (operator !)
  • static_assert

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