Mir
readable_fd.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 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: Andreas Pokorny <andreas.pokorny@canonical.com>
17  */
18 
19 #ifndef MIR_DISPATCH_READABLE_FD_H_
20 #define MIR_DISPATCH_READABLE_FD_H_
21 
23 #include "mir/fd.h"
24 
25 #include <functional>
26 
27 namespace mir
28 {
29 namespace dispatch
30 {
31 
32 class ReadableFd : public Dispatchable
33 {
34 public:
35  ReadableFd(Fd fd, std::function<void()> const& on_readable);
36  Fd watch_fd() const override;
37 
38  bool dispatch(FdEvents events) override;
39  FdEvents relevant_events() const override;
40 private:
41  mir::Fd fd;
42  std::function<void()> readable;
43 };
44 }
45 }
46 
47 #endif // MIR_DISPATCH_READABLE_FD_H_
Definition: as_render_target.h:27
Definition: readable_fd.h:32
Definition: fd.h:33
bool dispatch(FdEvents events) override
Dispatch one pending event.
FdEvents relevant_events() const override
The set of file-descriptor events this Dispatchable handles.
Definition: dispatchable.h:38
ReadableFd(Fd fd, std::function< void()> const &on_readable)
uint32_t FdEvents
Definition: dispatchable.h:36
Fd watch_fd() const override
Get a poll()able file descriptor.

Copyright © 2012-2016 Canonical Ltd.
Generated on Mon Jun 5 13:49:26 UTC 2017