Mir
|
Register observers for a subsystem. More...
#include <observer_registrar.h>
Public Member Functions | |
virtual void | register_interest (std::weak_ptr< Observer > const &observer)=0 |
Add an observer to the set notified of all observations. More... | |
virtual void | register_interest (std::weak_ptr< Observer > const &observer, Executor &executor)=0 |
Add an observer with specified execution environment. More... | |
virtual void | unregister_interest (Observer const &observer)=0 |
Remove an observer from the set notified of all observations. More... | |
Protected Member Functions | |
ObserverRegistrar ()=default | |
virtual | ~ObserverRegistrar ()=default |
ObserverRegistrar (ObserverRegistrar const &)=delete | |
ObserverRegistrar & | operator= (ObserverRegistrar const &)=delete |
Register observers for a subsystem.
Observer | The Observer type to register |
|
protecteddefault |
|
protectedvirtualdefault |
|
protecteddelete |
|
protecteddelete |
|
pure virtual |
Add an observer to the set notified of all observations.
The ObserverRegistrar does not take any ownership of observer
, and will automatically remove it when observer
expires.
[in] | observer | The observer to register |
|
pure virtual |
Add an observer with specified execution environment.
This is threadsafe and can be called in any context.
The ObserverRegistrar does not take any ownership of observer
, and will automatically remove it when observer
expires.
All calls to observer
methods are performed in the context of executor
.
The executor
should process work in a delayed fashion. Particularly, executor::spawn(work) is expected to not run work
in the current stack. Eager execution of work may result in deadlocks if calls to the observer result in calls into the ObserverRegistrar.
[in] | observer | The observer to register |
[in] | executor | Execution environment for calls to observer methods. The caller is responsible for ensuring executor outlives observer . |
|
pure virtual |
Remove an observer from the set notified of all observations.
This is threadsafe and can be called in any context. It is not guaranteed that methods of observer
will not be called after this returns.
observer | [in] The observer to unregister |
Copyright © 2012-2016 Canonical Ltd.
Generated on Sat Dec 3 12:48:59 UTC 2016