diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-09-25 18:29:48 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-14 11:00:25 +0100 |
commit | b7dd0a6e19d5387bc8d499bd1b3a99d457fa58d9 (patch) | |
tree | 0d1a26964435e8f91b96713e2b5beb3c1e94d0b2 /signal-composer-binding/source.hpp | |
parent | db45a68715c07e6b8fe35e322ddcbbc6c473cb2b (diff) |
Enhance pointer manage and container browsing
- SourceAPI now holds share_ptr of Signal
- Signal are stored in a map<string,signal> that change
way to browse the signals
- subscribed property included in SourceAPI.
- Clean old code
- renaming struct SignalValue->signalValue
Change-Id: Ic5c28296ddd7197c6562e12fbc91c504c1cc0b4d
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding/source.hpp')
-rw-r--r-- | signal-composer-binding/source.hpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/signal-composer-binding/source.hpp b/signal-composer-binding/source.hpp index 8b06b89..57836e7 100644 --- a/signal-composer-binding/source.hpp +++ b/signal-composer-binding/source.hpp @@ -14,11 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #pragma once - - +#include <memory> #include "signal.hpp" class SourceAPI { @@ -28,7 +26,7 @@ private: CtlActionT* init_; CtlActionT* getSignals_; - std::map<Signal*, bool> signalsMap_; + std::map<std::string, std::shared_ptr<Signal>> signalsMap_; public: SourceAPI(); @@ -38,8 +36,8 @@ public: std::string api() const; void addSignal(const std::string& id, const std::string& event, std::vector<std::string>& sources, const std::string& sClass, const std::string& unit, double frequency, CtlActionT* onReceived, json_object* getSignalsArgs); - std::vector<Signal*> getSignals() const; - std::vector<Signal*> searchSignals(const std::string& name) const; + std::vector<std::shared_ptr<Signal>> getSignals() const; + std::vector<std::shared_ptr<Signal>> searchSignals(const std::string& name); int makeSubscription(); }; |