-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #751 from SignalK/repeat_templates
Fix Repeat template classes
- Loading branch information
Showing
3 changed files
with
52 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,39 @@ | ||
#include "nullable.h" | ||
|
||
#include <limits> | ||
#include <cstdint> | ||
#include <limits> | ||
|
||
namespace sensesp { | ||
|
||
template <typename T> T Nullable<T>::invalid_value_ = T{}; | ||
template <> int Nullable<int>::invalid_value_ = std::numeric_limits<int>::lowest(); | ||
template <> float Nullable<float>::invalid_value_ = std::numeric_limits<float>::lowest(); | ||
template <> double Nullable<double>::invalid_value_ = std::numeric_limits<double>::lowest(); | ||
template <> char Nullable<char>::invalid_value_ = 255; | ||
// Invalid values below are set equal to NMEA 2000 "missing data" values | ||
|
||
template <typename T> | ||
T Nullable<T>::invalid_value_ = T{}; | ||
template <> | ||
float Nullable<float>::invalid_value_ = -1e9; | ||
template <> | ||
double Nullable<double>::invalid_value_ = -1e9; | ||
template <> | ||
char Nullable<char>::invalid_value_ = 0xff; | ||
template <> | ||
uint8_t Nullable<uint8_t>::invalid_value_ = 0xff; | ||
template <> | ||
int8_t Nullable<int8_t>::invalid_value_ = 0x7f; | ||
template <> | ||
uint16_t Nullable<uint16_t>::invalid_value_ = 0xffff; | ||
template <> | ||
int16_t Nullable<int16_t>::invalid_value_ = 0x7fff; | ||
template <> | ||
uint32_t Nullable<uint32_t>::invalid_value_ = 0xffffffff; | ||
template <> | ||
int32_t Nullable<int32_t>::invalid_value_ = 0x7fffffff; | ||
template <> | ||
uint64_t Nullable<uint64_t>::invalid_value_ = 0xffffffffffffffffLL; | ||
template <> | ||
int64_t Nullable<int64_t>::invalid_value_ = 0x7fffffffffffffffLL; | ||
|
||
template <> | ||
bool Nullable<bool>::invalid_value_ = false; | ||
|
||
|
||
} // namespace sensesp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters