summaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/source.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-09-14 19:31:42 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 11:00:25 +0100
commiteabae24ea592420de46e36f0b1af5d39eee5b8a4 (patch)
tree16cbc39e84eb71d655add40e715f7d87b4b02132 /signal-composer-binding/source.cpp
parent140fd3d8f76a8cbbde8f6b0bf997808855f3da43 (diff)
Attach and recursion check working
Change-Id: I2f9509d4b6aa63a16df8db2187810337fd802ef4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding/source.cpp')
-rw-r--r--signal-composer-binding/source.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/signal-composer-binding/source.cpp b/signal-composer-binding/source.cpp
index 919ae5b..6e7fec2 100644
--- a/signal-composer-binding/source.cpp
+++ b/signal-composer-binding/source.cpp
@@ -17,26 +17,35 @@
#include "source.hpp"
-Source::Source()
+SourceAPI::SourceAPI()
{}
-Source::Source(const std::string& api, const std::string& info, CtlActionT* init, CtlActionT* getSignal):
+SourceAPI::SourceAPI(const std::string& api, const std::string& info, CtlActionT* init, CtlActionT* getSignal):
api_(api), info_(info), init_(init), getSignal_(getSignal)
{}
-std::string Source::api()
+std::string SourceAPI::api() const
{
return api_;
}
-void Source::addSignal(const std::string& id, std::vector<std::string>& sources, const std::string& sClass, const std::string& unit, double frequency, CtlActionT* onReceived)
+void SourceAPI::addSignal(const std::string& id, std::vector<std::string>& sources, const std::string& sClass, const std::string& unit, double frequency, CtlActionT* onReceived)
{
std::shared_ptr<Signal> sig = std::make_shared<Signal>(id, sources, unit, frequency, onReceived);
signals_.push_back(sig);
}
-std::vector<std::shared_ptr<Signal>> Source::getSignals()
+std::vector<std::shared_ptr<Signal>> SourceAPI::getSignals() const
{
return signals_;
}
+
+std::shared_ptr<Signal> SourceAPI::searchSignal(const std::string& name) const
+{
+ for (auto& sig: signals_)
+ {
+ if(*sig == name) {return sig;}
+ }
+ return nullptr;
+}