diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-03-22 16:27:57 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-03-22 16:27:57 +0100 |
commit | 1151515e5d811d90d5bcfdc454581c525143eca4 (patch) | |
tree | e1924de61df97024342cb59f28cbff0144f80eae /signal-composer-binding | |
parent | c190b189601bcbf79182165d77921d37232c9ec0 (diff) |
Add undefined value possibility in signal values
By default, signal value are initialized to 0 which isn't
acceptable to be accurate and be able to calculate virtual
signals values as result would be false.
Change-Id: I8ec40d8dcb9ce1fae42aeec9fb48369f0914fd9f
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding')
-rw-r--r-- | signal-composer-binding/signal.hpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/signal-composer-binding/signal.hpp b/signal-composer-binding/signal.hpp index 63be5c9..5b35065 100644 --- a/signal-composer-binding/signal.hpp +++ b/signal-composer-binding/signal.hpp @@ -34,6 +34,7 @@ class Composer; /// Not very efficient or optimized, maybe use of Variant in /// C++17 but this is a bit too new to uses it for now struct signalValue { + bool undefined; bool hasBool; bool boolVal; bool hasNum; @@ -42,15 +43,15 @@ struct signalValue { std::string strVal; signalValue(): - hasBool(false), boolVal(false), hasNum(false), numVal(0), hasStr(false), strVal("") {}; + undefined(true), hasBool(false), boolVal(false), hasNum(false), numVal(0), hasStr(false), strVal("") {}; signalValue(bool b): - hasBool(true), boolVal(b), hasNum(false), numVal(0), hasStr(false), strVal("") {}; + undefined(false), hasBool(true), boolVal(b), hasNum(false), numVal(0), hasStr(false), strVal("") {}; signalValue(int b): - hasBool(true), boolVal(b), hasNum(false), numVal(0), hasStr(false), strVal("") {}; + undefined(false), hasBool(true), boolVal(b), hasNum(false), numVal(0), hasStr(false), strVal("") {}; signalValue(double d): - hasBool(false), boolVal(false), hasNum(true), numVal(d), hasStr(false), strVal("") {}; + undefined(false), hasBool(false), boolVal(false), hasNum(true), numVal(d), hasStr(false), strVal("") {}; signalValue(const std::string& s): - hasBool(false), boolVal(false), hasNum(false), numVal(0), hasStr(true), strVal(s) {}; + undefined(false), hasBool(false), boolVal(false), hasNum(false), numVal(0), hasStr(true), strVal(s) {}; }; extern "C" void searchNsetSignalValueHandle(const char* aName, uint64_t timestamp, struct signalValue value); |