xpcc
xpcc::Value< Parent, Width, Position > Struct Template Reference

Class for accessing a numeric value in a register. More...

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

Inheritance diagram for xpcc::Value< Parent, Width, Position >:
xpcc::FlagsOperators< Parent::EnumType, Parent::UnderlyingType > xpcc::Register< Parent::UnderlyingType >

Public Member Functions

constexpr Value (UnderlyingType config)
 explicit constructor for the underlying type
 
constexpr Value (Value const &o)=default
 copy constructor
 
constexpr Value (Value &&o)=default
 move constructor
 
- Public Member Functions inherited from xpcc::FlagsOperators< Parent::EnumType, Parent::UnderlyingType >
constexpr FlagsOperators operator~ () const
 bitwise negation
 
constexpr FlagsOperators ()
 default constructor initializes value to zero
 
constexpr FlagsOperators (Parent::EnumType 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< Parent::UnderlyingType > 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.
 
FlagsOperatorsoperator= (FlagsOperators const &o)=default
 Copy assignment.
 
FlagsOperatorsoperator= (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
 
FlagsOperatorsoperator&= (FlagsOperators const &o)
 bitwise AND with multiple bits
 
FlagsOperatorsoperator|= (FlagsOperators const &o)
 bitwise OR with multiple bits
 
FlagsOperatorsoperator^= (FlagsOperators const &o)
 bitwise XOR with multiple bits
 
FlagsOperatorsoperator&= (Parent::EnumType const &flag)
 bitwise AND with a single bit
 
FlagsOperatorsoperator|= (Parent::EnumType const &flag)
 bitwise OR with a single bit
 
FlagsOperatorsoperator^= (Parent::EnumType const &flag)
 bitwise XOR with a single bit
 
- Public Member Functions inherited from xpcc::Register< Parent::UnderlyingType >
constexpr Register ()
 Default constructor initializes value to zero.
 
constexpr operator bool () const
 Returns true if value is non-zero. More...
 
constexpr bool operator! () const
 Returns true if value is zero.
 

Static Public Member Functions

static constexpr Parent mask ()
 returns the shifted mask for this value
 
static void set (Parent &parent, UnderlyingType config)
 clears and sets a new value in a Flags register
 
static void reset (Parent &parent)
 clears the value in a Flags register
 
static constexpr UType get (Parent const &parent)
 returns the value from a Flags register
 
- Static Public Member Functions inherited from xpcc::FlagsOperators< Parent::EnumType, Parent::UnderlyingType >
static constexpr FlagsOperators mask ()
 returns the mask of the integer type
 

Additional Inherited Members

- Public Types inherited from xpcc::FlagsOperators< Parent::EnumType, Parent::UnderlyingType >
typedef Parent::EnumType EnumType
 The enum type.
 
- Public Types inherited from xpcc::Register< Parent::UnderlyingType >
typedef Parent::UnderlyingType UnderlyingType
 The integer type internally used to represent the register.
 
- Public Attributes inherited from xpcc::Register< Parent::UnderlyingType >
UnderlyingType value
 The underlying integer value.
 
- Protected Member Functions inherited from xpcc::Register< Parent::UnderlyingType >
constexpr Register (UnderlyingType value)
 This class is meant to be subclassed.
 

Detailed Description

template<typename Parent, typename Parent::UnderlyingType Width, typename Parent::UnderlyingType Position = 0>
struct xpcc::Value< Parent, Width, Position >

A value is a combination of bits which correspond to their numerical value. An example is a 3-bit wide bit field corresponding to the start-up delay in ms.

The value class is similar to the configuration class, but a lot simpler. No enum type is needed, instead the underlying type of the parent register class is used for setting and getting the value.

typedef Value< Control_t, 3, 1 > Delay_t;
Template Parameters
Parentthe Flags class to which this configuration belongs to
Widththe width in bits of the value in the register
Positionhow many bits the configuration values need to be shifted
Author
Niklas Hauser

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