aboutsummaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/signal-composer-binding.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-09-25 18:29:48 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 11:00:25 +0100
commitb7dd0a6e19d5387bc8d499bd1b3a99d457fa58d9 (patch)
tree0d1a26964435e8f91b96713e2b5beb3c1e94d0b2 /signal-composer-binding/signal-composer-binding.cpp
parentdb45a68715c07e6b8fe35e322ddcbbc6c473cb2b (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/signal-composer-binding.cpp')
-rw-r--r--signal-composer-binding/signal-composer-binding.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/signal-composer-binding/signal-composer-binding.cpp b/signal-composer-binding/signal-composer-binding.cpp
index 1e14aad..3c16ad3 100644
--- a/signal-composer-binding/signal-composer-binding.cpp
+++ b/signal-composer-binding/signal-composer-binding.cpp
@@ -32,10 +32,10 @@
/// @param[in] object - eventual data that comes with the event
void onEvent(const char *event, json_object *object)
{
- AFB_DEBUG("Received event json: %s", json_object_to_json_string(object));
+ AFB_NOTICE("Received event json: %s", json_object_to_json_string(object));
Composer& composer = Composer::instance();
- std::vector<Signal*> signals = composer.searchSignals(event);
+ std::vector<std::shared_ptr<Signal>> signals = composer.searchSignals(event);
if(!signals.empty())
{
for(auto& sig: signals)
@@ -52,7 +52,7 @@ static int one_subscribe_unsubscribe(struct afb_req request,
clientAppCtx* cContext)
{
int err = 0;
- std::vector<Signal*> signals = Composer::instance().searchSignals(event);
+ std::vector<std::shared_ptr<Signal>> signals = Composer::instance().searchSignals(event);
cContext->appendSignals(signals);
if(subscribe)
@@ -154,7 +154,7 @@ void list(afb_req request)
{
struct json_object *allSignalsJ = json_object_new_array();
- std::vector<Signal*> allSignals = Composer::instance().getAllSignals();
+ std::vector<std::shared_ptr<Signal>> allSignals = Composer::instance().getAllSignals();
for(auto& sig: allSignals)
{json_object_array_add(allSignalsJ, sig->toJSON());}
@@ -212,9 +212,9 @@ int execConf()
Composer& composer = Composer::instance();
int err = 0;
CtlConfigExec(composer.ctlConfig());
- std::vector<Signal*> allSignals = composer.getAllSignals();
+ std::vector<std::shared_ptr<Signal>> allSignals = composer.getAllSignals();
ssize_t sigCount = allSignals.size();
- for( Signal*& sig: allSignals)
+ for( std::shared_ptr<Signal>& sig: allSignals)
{
sig->attachToSourceSignals(composer);
}