SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
nullable.cpp
Go to the documentation of this file.
1#include "nullable.h"
2
3#include <cstdint>
4#include <limits>
5
6namespace sensesp {
7
8// Invalid values below are set equal to NMEA 2000 "missing data" values
9
10template <typename T>
11T Nullable<T>::invalid_value_ = T{};
12template <>
13float Nullable<float>::invalid_value_ = -1e9;
14template <>
15double Nullable<double>::invalid_value_ = -1e9;
16template <>
17char Nullable<char>::invalid_value_ = 0xff;
18template <>
19uint8_t Nullable<uint8_t>::invalid_value_ = 0xff;
20template <>
21int8_t Nullable<int8_t>::invalid_value_ = 0x7f;
22template <>
23uint16_t Nullable<uint16_t>::invalid_value_ = 0xffff;
24template <>
25int16_t Nullable<int16_t>::invalid_value_ = 0x7fff;
26template <>
27uint32_t Nullable<uint32_t>::invalid_value_ = 0xffffffff;
28template <>
29int32_t Nullable<int32_t>::invalid_value_ = 0x7fffffff;
30template <>
31uint64_t Nullable<uint64_t>::invalid_value_ = 0xffffffffffffffffLL;
32template <>
33int64_t Nullable<int64_t>::invalid_value_ = 0x7fffffffffffffffLL;
34
35template <>
36bool Nullable<bool>::invalid_value_ = false;
37
38
39} // namespace sensesp