diff options
Diffstat (limited to 'signal-composer-binding/source.cpp')
-rw-r--r-- | signal-composer-binding/source.cpp | 19 |
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; +} |