eventloop-integration.h
Go to the documentation of this file.
1/*
2 *
3 * D-Bus++ - C++ bindings for D-Bus
4 *
5 * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
6 *
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24
25#ifndef __DBUSXX_EVENTLOOP_INTEGRATION_H
26#define __DBUSXX_EVENTLOOP_INTEGRATION_H
27
28#include <errno.h>
29#include "api.h"
30#include "dispatcher.h"
31#include "util.h"
32#include "eventloop.h"
33
34namespace DBus
35{
36
37/*
38 * Glue between the event loop and the DBus library
39 */
40
41class BusDispatcher;
42class Pipe;
43
45{
46 BusTimeout(Timeout::Internal *, BusDispatcher *);
47
48 void toggle();
49
50 friend class BusDispatcher;
51};
52
53class DXXAPI BusWatch : public Watch, public DefaultWatch
54{
55 BusWatch(Watch::Internal *, BusDispatcher *);
56
57 void toggle();
58
59 friend class BusDispatcher;
60};
61
63{
64public:
66
68
69 virtual void enter();
70
71 virtual void leave();
72
73 virtual Pipe *add_pipe(void(*handler)(const void *data, void *buffer, unsigned int nbyte), const void *data);
74
75 virtual void del_pipe(Pipe *pipe);
76
77 virtual void do_iteration();
78
79 virtual Timeout *add_timeout(Timeout::Internal *);
80
81 virtual void rem_timeout(Timeout *);
82
83 virtual Watch *add_watch(Watch::Internal *);
84
85 virtual void rem_watch(Watch *);
86
87 void watch_ready(DefaultWatch &);
88
89 void timeout_expired(DefaultTimeout &);
90
91private:
93 int _pipe[2];
94 std::list <Pipe *> pipe_list;
95};
96
97} /* namespace DBus */
98
99#endif//__DBUSXX_EVENTLOOP_INTEGRATION_H
#define DXXAPI
Definition: api.h:36
std::list< Pipe * > pipe_list