# DBus-C++

## Desktop Communication Bus System

libdbus-c-- Documentation 0.9.0

- Files
- Data Structures
- Globals
- Main Page

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
34 namespace DBus
35{
36
37/*
38 * Glue between the event loop and the DBus library
39 */
40
41 class BusDispatcher;
42 class Pipe;
43
44 class DXXAPI BusTimeout : public Timeout, public DefaultTimeout
45{
46 BusTimeout(Timeout::Internal *, BusDispatcher *);
47
48 void toggle();
49
50 friend class BusDispatcher;
51};
52
53 class DXXAPI BusWatch : public Watch, public DefaultWatch
54{
55 BusWatch(Watch::Internal *, BusDispatcher *);
56
57 void toggle();
58
59 friend class BusDispatcher;
60};
61
62 class DXXAPI BusDispatcher : public Dispatcher, public DefaultMainLoop
63{
64 public:
65 BusDispatcher();
66
67 ~BusDispatcher() {}
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
91 private:
92 bool _running;
93 int _pipe[2];
94 std::list <Pipe *> pipe_list;
95};
96
97} /* namespace DBus */
98
99#endif//__DBUSXX_EVENTLOOP_INTEGRATION_H
api.h
DXXAPI
#define DXXAPI
Definition api.h:36
DBus::BusDispatcher
Definition eventloop-integration.h:63
DBus::BusDispatcher::pipe_list
std::list< Pipe * > pipe_list
Definition eventloop-integration.h:94
DBus::BusDispatcher::BusDispatcher
BusDispatcher()
Definition eventloop-integration.cpp:80
DBus::BusDispatcher::_pipe
int _pipe[2]
Definition eventloop-integration.h:93
DBus::BusDispatcher::~BusDispatcher
~BusDispatcher()
Definition eventloop-integration.h:67
DBus::BusDispatcher::_running
bool _running
Definition eventloop-integration.h:92
DBus::BusTimeout::BusTimeout
BusTimeout(Timeout::Internal *, BusDispatcher *)
Definition eventloop-integration.cpp:46
DBus::BusTimeout::toggle
void toggle()
Definition eventloop-integration.cpp:52
DBus::BusTimeout::BusDispatcher
friend class BusDispatcher
Definition eventloop-integration.h:50
DBus::BusWatch::toggle
void toggle()
Definition eventloop-integration.cpp:73
DBus::BusWatch::BusWatch
BusWatch(Watch::Internal *, BusDispatcher *)
Definition eventloop-integration.cpp:59
DBus::BusWatch::BusDispatcher
friend class BusDispatcher
Definition eventloop-integration.h:59
DBus::DefaultMainLoop::DefaultMainLoop
DefaultMainLoop()
Definition eventloop.cpp:112
DBus::DefaultTimeout
Definition eventloop.h:47
DBus::DefaultTimeout::DefaultTimeout
DefaultTimeout(int interval, bool repeat, DefaultMainLoop *)
Definition eventloop.cpp:44
DBus::DefaultWatch
Definition eventloop.h:111
DBus::DefaultWatch::DefaultWatch
DefaultWatch(int fd, int flags, DefaultMainLoop *)
Definition eventloop.cpp:64
DBus::Dispatcher
Definition dispatcher.h:152
DBus::Pipe
Definition pipe.h:37
DBus::Timeout
Definition dispatcher.h:36
DBus::Timeout::Timeout
Timeout(Internal *i)
DBus::Watch
Definition dispatcher.h:87
DBus::Watch::Watch
Watch(Internal *i)
dispatcher.h
eventloop.h
DBus
Definition connection_p.h:42
util.h