DYNAMIXEL Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Namespaces | Functions
dynamixel_detail.hpp File Reference

Compile-time helpers of the DYNAMIXEL driver: typed integer literals, exact hook matching, typed register fields and enumeration checks. More...

#include <algorithm>
#include <array>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <type_traits>

Go to the source code of this file.

Namespaces

namespace  dynamixel
 The DYNAMIXEL driver: everything it declares lives here; internals in detail.
 

Functions

template<char... Digits>
consteval std::uint8_t literals::operator""_u8 () noexcept
 An integer constant of type uint8_t, for an argument whose parameter is uint8_t (MISRA C++:2023 Rule 7.0.6). 0xFF_u8 compiles; 0x100_u8 does not.
 
template<char... Digits>
consteval std::uint16_t literals::operator""_u16 () noexcept
 An integer constant of type uint16_t (Rule 7.0.6); out of range does not compile.
 
template<char... Digits>
consteval std::uint32_t literals::operator""_u32 () noexcept
 An integer constant of type uint32_t (Rule 7.0.6): on targets where uint32_t is unsigned long, a U literal is still unsigned int. Out of range does not compile.
 

Detailed Description

Compile-time helpers of the DYNAMIXEL driver: typed integer literals, exact hook matching, typed register fields and enumeration checks.

Everything here is constexpr or used only in unevaluated operands, so it adds no code to the run-time path (handbook C++20 profile, KB-CPP20-006, -008, -020, -021, -025, -026).

Function Documentation

◆ operator""_u16()

template<char... Digits>
consteval std::uint16_t literals::operator""_u16 ( )
noexcept

An integer constant of type uint16_t (Rule 7.0.6); out of range does not compile.

Template Parameters
DigitsThe characters of the literal.
Returns
The literal's value as uint16_t.

◆ operator""_u32()

template<char... Digits>
consteval std::uint32_t literals::operator""_u32 ( )
noexcept

An integer constant of type uint32_t (Rule 7.0.6): on targets where uint32_t is unsigned long, a U literal is still unsigned int. Out of range does not compile.

Template Parameters
DigitsThe characters of the literal.
Returns
The literal's value as uint32_t.

◆ operator""_u8()

template<char... Digits>
consteval std::uint8_t literals::operator""_u8 ( )
noexcept

An integer constant of type uint8_t, for an argument whose parameter is uint8_t (MISRA C++:2023 Rule 7.0.6). 0xFF_u8 compiles; 0x100_u8 does not.

The _u8, _u16 and _u32 literals are visible in the whole driver namespace without using-declarations.

Template Parameters
DigitsThe characters of the literal.
Returns
The literal's value as uint8_t.