Mir
event_handler_register.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 
20 #ifndef MIR_GRAPHICS_EVENT_HANDLER_REGISTER_H_
21 #define MIR_GRAPHICS_EVENT_HANDLER_REGISTER_H_
22 
23 #include <functional>
24 #include <initializer_list>
25 #include "mir/module_deleter.h"
26 
27 namespace mir
28 {
29 
30 namespace graphics
31 {
33 {
34 public:
35  virtual void register_signal_handler(
36  std::initializer_list<int> signals,
37  std::function<void(int)> const& handler) = 0;
38 
39  virtual void register_signal_handler(
40  std::initializer_list<int> signals,
41  mir::UniqueModulePtr<std::function<void(int)>> handler) = 0;
42 
43  virtual void register_fd_handler(
44  std::initializer_list<int> fds,
45  void const* owner,
46  std::function<void(int)> const& handler) = 0;
47 
48  virtual void register_fd_handler(
49  std::initializer_list<int> fds,
50  void const* owner,
51  mir::UniqueModulePtr<std::function<void(int)>> handler) = 0;
52 
53  virtual void unregister_fd_handler(void const* owner) = 0;
54 
55 protected:
56  EventHandlerRegister() = default;
57  virtual ~EventHandlerRegister() = default;
60 };
61 }
62 }
63 
64 
65 #endif /* MIR_GRAPHICS_EVENT_HANDLER_REGISTER_H_ */
Definition: as_render_target.h:27
virtual void unregister_fd_handler(void const *owner)=0
std::unique_ptr< T, ModuleDeleter< T >> UniqueModulePtr
Use UniqueModulePtr to ensure that your loadable libray outlives instances created within it...
Definition: module_deleter.h:83
virtual ~EventHandlerRegister()=default
virtual void register_signal_handler(std::initializer_list< int > signals, std::function< void(int)> const &handler)=0
EventHandlerRegister & operator=(EventHandlerRegister const &)=delete
virtual void register_fd_handler(std::initializer_list< int > fds, void const *owner, std::function< void(int)> const &handler)=0
Definition: event_handler_register.h:32

Copyright © 2012-2016 Canonical Ltd.
Generated on Wed May 10 10:41:27 UTC 2017