diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-11 13:36:17 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-14 11:00:49 +0100 |
commit | 1b4bbe3b4f048754fe90e93546126f1d161d8037 (patch) | |
tree | 539e372998e876e7f90fd9ef4ee0e3ff81189112 /signal-composer-binding/source.cpp | |
parent | 9a4ba373acf7b7feac6d980506bcdad20b96bdb6 (diff) |
Avoid create duplicate source entries.
Change-Id: If50a439634382fa6d1c856b5c3fb29db4eb93a31
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding/source.cpp')
-rw-r--r-- | signal-composer-binding/source.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/signal-composer-binding/source.cpp b/signal-composer-binding/source.cpp index f616e51..f34b88f 100644 --- a/signal-composer-binding/source.cpp +++ b/signal-composer-binding/source.cpp @@ -21,13 +21,27 @@ SourceAPI::SourceAPI() {} -SourceAPI::SourceAPI(const std::string& api, const std::string& info, CtlActionT* init, CtlActionT* getSignals, CtlActionT* onReceived, int retention):api_(api), - info_(info), - init_(init), - getSignals_(getSignals), +SourceAPI::SourceAPI(const std::string& uid, const std::string& api, const std::string& info, CtlActionT* init, CtlActionT* getSignals, CtlActionT* onReceived, int retention): + uid_{uid}, + api_{api}, + info_{info}, + init_{init}, + getSignals_{getSignals}, signalsDefault_({onReceived, retention}) {} +bool SourceAPI::operator ==(const SourceAPI& other) const +{ + if(uid_ == other.uid_) {return true;} + return false; +} + +bool SourceAPI::operator ==(const std::string& other) const +{ + if(uid_ == other) {return true;} + return false; +} + void SourceAPI::init() { if(init_) |