MIP_SDK
v3.0.0
MicroStrain Communications Library for embedded systems
|
Represents an index ranging from 0..N excluding N. More...
#include <index.hpp>
Public Member Functions | |
constexpr | Index (unsigned int index) |
constexpr | Index () |
constexpr Index & | setFromIndex (unsigned int index) |
constexpr Index & | setFromId (unsigned int id) |
constexpr unsigned int | index () const |
constexpr unsigned int | id () const |
constexpr bool | operator== (const Index &other) const |
constexpr bool | operator!= (const Index &other) const |
constexpr bool | isAssigned () const |
constexpr bool | isValid (size_t max_count) const |
constexpr void | clear () |
Index & | operator++ () |
Index & | operator-- () |
Index | operator++ (int) |
Index | operator-- (int) |
constexpr | Index (const Id &other) |
constexpr Index & | operator= (const Id &other) |
bool | operator< (Index other) const |
bool | operator> (Index other) const |
bool | operator<= (Index other) const |
bool | operator>= (Index other) const |
bool | operator== (Index other) const |
bool | operator!= (Index other) const |
Represents an index ranging from 0..N excluding N.
Use this to help avoid off-by-one errors when using indices into arrays at the same time as referring to MIP values which typically start at 1.
Use the index() or id() methods to get the actual value, depending on what you need. The index() method returns an unsigned int in the range [0,N-1] while the id() method returns an unsigned int in the range [1,N]
isAssigned() can be used to see if the value is valid, i.e. initialized. isValid() can be used to check if the value is within a maximum count.
The default value with no initialization is INVALID.
This is interchangeable with the Id class below.
|
inlineexplicitconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineconstexpr |
|
inline |
|
inline |
|
inline |
|
inlineconstexpr |
|
inlineconstexpr |