modm API documentation
modm::FlagsOperators< Enum, T > Struct Template Reference

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

Inheritance diagram for modm::FlagsOperators< Enum, T >:
modm::Register< T > modm::Flags< Enum, T >

Public Typedefs

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

Public Member Functions

constexpr FlagsOperators operator~ () const
 bitwise negation
 
constexpr operator bool () const
 
constexpr bool operator! () const
 Returns true if value is zero.
 
constexpr FlagsOperators ()
 default constructor initializes value to zero
 
constexpr FlagsOperators (Enum flag)
 constructs itself out of a strongly-typed enum
 
constexpr FlagsOperators (UnderlyingType flag)
 When explicitly called, this class constructs itself out of the underlying type.
 
constexpr FlagsOperators (Register< T > const &o)
 When explicitly called, this class constructs itself out of the superclass.
 
constexpr FlagsOperators (FlagsOperators const &o) = default
 Copy constructor.
 
constexpr FlagsOperators (FlagsOperators &&o) = default
 Move constructor.
 
FlagsOperators & operator= (FlagsOperators const &o) = default
 Copy assignment.
 
FlagsOperators & operator= (FlagsOperators &&o) = default
 Move assignment.
 
constexpr FlagsOperators operator& (FlagsOperators const &o) const
 bitwise AND with multiple bits
 
constexpr FlagsOperators operator| (FlagsOperators const &o) const
 bitwise OR with multiple bits
 
constexpr FlagsOperators operator^ (FlagsOperators const &o) const
 bitwise XOR with multiple bits
 
FlagsOperators & operator&= (FlagsOperators const &o)
 bitwise AND with multiple bits
 
FlagsOperators & operator|= (FlagsOperators const &o)
 bitwise OR with multiple bits
 
FlagsOperators & operator^= (FlagsOperators const &o)
 bitwise XOR with multiple bits
 
FlagsOperators & operator&= (Enum const &flag)
 bitwise AND with a single bit
 
FlagsOperators & operator|= (Enum const &flag)
 bitwise OR with a single bit
 
FlagsOperators & operator^= (Enum const &flag)
 bitwise XOR with a single bit
 

Static Public Member Functions

static constexpr FlagsOperators mask ()
 returns the mask of the integer type
 

Public Attributes

UnderlyingType value
 The underlying integer value.
 

Friends

constexpr friend FlagsOperators operator& (Enum const &a, FlagsOperators const &b)
 bitwise AND with a single bit
 
constexpr friend FlagsOperators operator| (Enum const &a, FlagsOperators const &b)
 bitwise OR with a single bit
 
constexpr friend FlagsOperators operator^ (Enum const &a, FlagsOperators const &b)
 bitwise XOR with a single bit
 
constexpr friend FlagsOperators operator& (FlagsOperators const &a, Enum const &b)
 bitwise AND with a single bit
 
constexpr friend FlagsOperators operator| (FlagsOperators const &a, Enum const &b)
 bitwise OR with a single bit
 
constexpr friend FlagsOperators operator^ (FlagsOperators const &a, Enum const &b)
 bitwise XOR with a single bit
 
constexpr friend FlagsOperators operator& (Enum const &a, Enum const &b)
 bitwise AND with a single bit
 
constexpr friend FlagsOperators operator| (Enum const &a, Enum const &b)
 bitwise OR with a single bit
 
constexpr friend FlagsOperators operator^ (Enum const &a, Enum const &b)
 bitwise XOR with a single bit
 
constexpr friend bool operator== (FlagsOperators const &a, Enum const &b)
 
constexpr friend bool operator!= (FlagsOperators const &a, Enum const &b)
 
constexpr friend bool operator== (Enum const &a, FlagsOperators const &b)
 
constexpr friend bool operator!= (Enum const &a, FlagsOperators const &b)
 

Detailed Description

template<typename Enum, typename T>
struct modm::FlagsOperators< Enum, T >

Class for operating on a register.

This class extends the Register base class by adding constructor and bitwise operation overloading between a strongly-typed enum and itself. It is the common base class for Flags, Configurations and Values!

Template Parameters
Enuma strongly-typed enum containing the bit masks
Tthe underlying integer type to be for internal representation
See also
Flags
Author
Niklas Hauser

Member Function Documentation

template<typename T >
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

Friends And Related Function Documentation

template<typename Enum , typename T >
constexpr friend bool operator== ( FlagsOperators< Enum, T > const &  a,
Enum const &  b 
)
friend

Compares if two flags are equal


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