/usr/include/mirserver/mir/observer_registrar.h is in libmirserver-dev 0.31.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | /*
* Copyright © 2016 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 or 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
*/
#ifndef MIR_OBSERVER_REGISTRAR_H_
#define MIR_OBSERVER_REGISTRAR_H_
#include <memory>
namespace mir
{
class Executor;
/**
* Register observers for a subsystem.
*
* \tparam Observer The Observer type to register
*/
template<class Observer>
class ObserverRegistrar
{
public:
/**
* Add an observer to the set notified of all observations
*
* The ObserverRegistrar does not take any ownership of \p observer, and will
* automatically remove it when \p observer expires.
*
* \param [in] observer The observer to register
*/
virtual void register_interest(std::weak_ptr<Observer> const& observer) = 0;
/**
* 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 \p observer, and will
* automatically remove it when \p observer expires.
*
* All calls to \p observer methods are performed in the context of
* \p executor.
*
* The \p executor should process work in a delayed fashion. Particularly,
* executor::spawn(work) is expected to \b not run \p work in the current
* stack. Eager execution of work may result in deadlocks if calls to the
* observer result in calls into the ObserverRegistrar.
*
* \param [in] observer The observer to register
* \param [in] executor Execution environment for calls to \p observer methods.
* The caller is responsible for ensuring \p executor outlives
* \p observer.
*/
virtual void register_interest(
std::weak_ptr<Observer> const& observer,
Executor& executor) = 0;
/**
* Remove an observer from the set notified of all observations.
*
* This is threadsafe and can be called in any context.
* It is \b not guaranteed that methods of \p observer will not be called after
* this returns.
*
* \param observer [in] The observer to unregister
*/
virtual void unregister_interest(Observer const& observer) = 0;
protected:
ObserverRegistrar() = default;
virtual ~ObserverRegistrar() = default;
ObserverRegistrar(ObserverRegistrar const&) = delete;
ObserverRegistrar& operator=(ObserverRegistrar const&) = delete;
};
}
#endif //MIR_OBSERVER_REGISTRAR_H_
|