MIP_SDK
v3.0.0
MicroStrain Communications Library for embedded systems
|
Go to the documentation of this file.
31 unsigned int INVALID = UINT_MAX;
35 constexpr
Index() : m_index(INVALID) {}
38 constexpr
Index&
setFromId(
unsigned int id) { m_index =
id-1;
return *
this; }
40 constexpr
unsigned int index()
const {
return m_index; }
41 constexpr
unsigned int id()
const {
return m_index+1; }
43 constexpr
bool operator==(
const Index& other)
const {
return m_index == other.m_index; }
44 constexpr
bool operator!=(
const Index& other)
const {
return m_index != other.m_index; }
46 constexpr
bool isAssigned()
const {
return m_index != INVALID; }
47 constexpr
bool isValid(
size_t max_count)
const {
return m_index < max_count; }
49 constexpr
void clear() { m_index = INVALID; }
56 constexpr
Index(
const Id& other);
78 unsigned int INVALID = 0;
81 constexpr
explicit Id(
unsigned int id) : m_id(
id) {}
82 constexpr
Id() : m_id(INVALID) {}
87 constexpr
unsigned int index()
const {
return m_id-1; }
88 constexpr
unsigned int id()
const {
return m_id; }
90 constexpr
bool operator==(
const Id& other)
const {
return m_id == other.m_id; }
91 constexpr
bool operator!=(
const Id& other)
const {
return m_id != other.m_id; }
93 constexpr
bool isAssigned()
const {
return m_id != INVALID; }
94 constexpr
bool isValid(
size_t max_count)
const {
return index() < max_count; }
96 constexpr
void clear() { m_id = INVALID; }
117 template<
class Container>
121 template<
class Container,
typename Value>
constexpr Index & setFromId(unsigned int id)
Definition: index.hpp:38
constexpr bool isAssigned() const
Definition: index.hpp:93
Id operator--(int)
Definition: index.hpp:101
constexpr void clear()
Definition: index.hpp:49
constexpr Id(const Index &other)
Definition: index.hpp:103
auto indexOrDefault(Container &container, Index index, Value default_)
Definition: index.hpp:122
constexpr bool isValid(size_t max_count) const
Definition: index.hpp:47
constexpr Id(unsigned int id)
Definition: index.hpp:81
constexpr bool operator==(const Id &other) const
Definition: index.hpp:90
constexpr Index & operator=(const Id &other)
Definition: index.hpp:111
constexpr unsigned int index() const
Definition: index.hpp:87
bool operator!=(Index other) const
Definition: index.hpp:64
constexpr bool operator!=(const Id &other) const
Definition: index.hpp:91
bool operator>=(Index other) const
Definition: index.hpp:62
constexpr bool operator==(Id l, Index r)
Definition: index.hpp:113
Index & operator++()
Definition: index.hpp:51
Index operator--(int)
Definition: index.hpp:54
Id & operator++()
Definition: index.hpp:98
Index & operator--()
Definition: index.hpp:52
Index operator++(int)
Definition: index.hpp:53
constexpr bool isAssigned() const
Definition: index.hpp:46
bool operator==(Index other) const
Definition: index.hpp:63
constexpr bool operator==(const Index &other) const
Definition: index.hpp:43
auto * indexOrNull(Container &container, Index index)
Definition: index.hpp:118
constexpr Id()
Definition: index.hpp:82
constexpr unsigned int index() const
Definition: index.hpp:40
bool operator<=(Index other) const
Definition: index.hpp:61
bool operator<(Index other) const
Definition: index.hpp:59
constexpr void clear()
Definition: index.hpp:96
Represents an index ranging from 0..N excluding N.
Definition: index.hpp:28
constexpr unsigned int id() const
Definition: index.hpp:88
bool operator>(Index other) const
Definition: index.hpp:60
Id & operator--()
Definition: index.hpp:99
constexpr Index()
Definition: index.hpp:35
constexpr Id & operator=(const Index &other)
Definition: index.hpp:104
Representes an ID number ranging from 1..N including N.
Definition: index.hpp:75
constexpr Index & setFromIndex(unsigned int index)
Definition: index.hpp:37
Id operator++(int)
Definition: index.hpp:100
constexpr bool isValid(size_t max_count) const
Definition: index.hpp:94
constexpr unsigned int id() const
Definition: index.hpp:41
constexpr bool operator!=(const Index &other) const
Definition: index.hpp:44
Definition: embedded_time.h:8
constexpr Id & setFromId(unsigned int id)
Definition: index.hpp:85
constexpr Index(unsigned int index)
Definition: index.hpp:34
constexpr Id & setFromIndex(unsigned int index)
Definition: index.hpp:84