diff options
author | Jacob Keeler <jacob.keeler@livioradio.com> | 2016-09-20 11:44:51 -0400 |
---|---|---|
committer | Jacob Keeler <jacob.keeler@livioradio.com> | 2016-09-20 14:37:25 -0400 |
commit | 039581419749dbdd32590804e8b14a77fcaf9636 (patch) | |
tree | ced927fc4bef4686f7373a5f45dd692bd9fc9de0 /src/components/application_manager/src/event_engine/event_observer.cc | |
parent | 1b96b7c02d2e338b846a7314c6fa0bdaa31f7c5e (diff) | |
parent | aff7f09a4ec07becfb64dc78992580061d3342ff (diff) | |
download | sdl_core-039581419749dbdd32590804e8b14a77fcaf9636.tar.gz |
Merge branch 'master'
Diffstat (limited to 'src/components/application_manager/src/event_engine/event_observer.cc')
-rw-r--r-- | src/components/application_manager/src/event_engine/event_observer.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/components/application_manager/src/event_engine/event_observer.cc b/src/components/application_manager/src/event_engine/event_observer.cc index c6d81529f9..f89f6649b1 100644 --- a/src/components/application_manager/src/event_engine/event_observer.cc +++ b/src/components/application_manager/src/event_engine/event_observer.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2013, Ford Motor Company + Copyright (c) 2016, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,15 +30,16 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "application_manager/event_engine/event.h" #include "application_manager/event_engine/event_observer.h" +#include "application_manager/event_engine/event.h" +#include "application_manager/event_engine/event_dispatcher.h" namespace application_manager { namespace event_engine { -EventObserver::EventObserver() - : id_(0) { - //Get unique id based on this +EventObserver::EventObserver(EventDispatcher& event_dispatcher) + : id_(0), event_dispatcher_(event_dispatcher) { + // Get unique id based on this id_ = reinterpret_cast<unsigned long>(this); } @@ -48,16 +49,16 @@ EventObserver::~EventObserver() { void EventObserver::subscribe_on_event(const Event::EventID& event_id, int32_t hmi_correlation_id) { - EventDispatcher::instance()->add_observer(event_id, hmi_correlation_id, this); + event_dispatcher_.add_observer(event_id, hmi_correlation_id, *this); } void EventObserver::unsubscribe_from_event(const Event::EventID& event_id) { - EventDispatcher::instance()->remove_observer(event_id, this); + event_dispatcher_.remove_observer(event_id, *this); } void EventObserver::unsubscribe_from_all_events() { - EventDispatcher::instance()->remove_observer(this); + event_dispatcher_.remove_observer(*this); } -} -} +} // namespace event_engine +} // namespace application_manager |