|
SensESP 3.4.1-alpha
Universal Signal K sensor toolkit ESP32
|
Template class that supports a special invalid magic value for a type. More...
#include <sensesp/types/nullable.h>
Public Member Functions | |
| Nullable () | |
| Nullable (T value) | |
| Nullable< T > & | operator= (T &value) |
| Nullable< T > & | operator= (const Nullable< T > &other) |
| operator T () const | |
| bool | is_valid () const |
| T * | ptr () |
| T | value () const |
Static Public Member Functions | |
| static T | invalid () |
Template class that supports a special invalid magic value for a type.
Each specialization defines an invalid sentinel (see nullable.cpp; e.g. float -> -1e9, uint8_t -> 0xff), matching the NMEA 2000 "missing data" values. A value is invalid only when it equals that sentinel. A default-constructed Nullable holds T{} (0), so it is valid for types whose sentinel differs from 0; use Nullable<T>::invalid() to obtain the invalid value explicitly.
bool has no spare value to reserve as a sentinel, so Nullable<bool> is an explicit specialization (below) that tracks validity with a separate flag.
Definition at line 21 of file nullable.h.
|
inline |
Definition at line 23 of file nullable.h.
|
inline |
Definition at line 24 of file nullable.h.
|
inlinestatic |
|
inline |
|
inline |
Definition at line 33 of file nullable.h.
|
inline |
Definition at line 29 of file nullable.h.
|
inline |
|
inline |
Definition at line 41 of file nullable.h.
|
inline |