Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Class ID Reference

Doi Yusuke edited this page Nov 2, 2016 · 2 revisions

Class ID

The check a number class

Constructor

constexpr ID(uint8_t id)

constexpr ID(uint8_t id)

this constructor check valid id. this constructor is non explicit. this class only do is check number.

  • param:
  • id: the motor's ID
  • throw:
  • std::invalid_argument: Invalid id: id must be (0 <= id <=31).

Usage

constexpr ics::ID {0}; // create ID

Methods

  • constexpr uint8_t get() const noexcept
  • constexpr operator uint8_t() const noexcept

constexpr uint8_t get() const noexcept

get id method. return num is constructor argument.

  • return: id number.

Usage

constexpr ics::ID id {20};
auto idNumber = id.get(); // idNumber is 20

constexpr operator uint8_t() const noexcept

cast to uint8_t. return num is constructor argument.

  • return: id number.

Usage

constexpr ics::ID id {2};
uint8_t idNumber {id}; // idNumber is 2
auto idNumber2 = static_cast<uint8_t>(id); // you can take this