3 * D-Bus++ - C++ bindings for D-Bus
5 * Copyright (C) 2005-2009 Paolo Durante <shackan@gmail.com>
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.
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.
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
25 #ifndef __DBUSXX_EVENTLOOP_INTEGRATION_H
26 #define __DBUSXX_EVENTLOOP_INTEGRATION_H
29 #include "dispatcher.h"
31 #include "eventloop.h"
36 * Glue between the event loop and the DBus library
39 class DefaultDispatcher
;
41 class DBUSXXAPI DefaultTimeout
: public Timeout
, public SimpleTimeout
43 DefaultTimeout(Timeout::Internal
*, DefaultDispatcher
*);
47 friend class DefaultDispatcher
;
50 class DBUSXXAPI DefaultWatch
: public Watch
, public SimpleWatch
52 DefaultWatch(Watch::Internal
*, DefaultDispatcher
*);
56 friend class DefaultDispatcher
;
59 class DBUSXXAPI DefaultDispatcher
60 : public Dispatcher
, public SimpleMainLoop
, public CallbackTarget
64 static DefaultDispatcher instance
;
66 DefaultDispatcher(int32_t pollTimeout
= 500 /* msec*/)
68 , SimpleMainLoop(pollTimeout
)
76 bool running() { return _running
; }
82 virtual void start_iteration();
83 virtual void do_iteration();
85 virtual Timeout
*add_timeout(Timeout::Internal
*);
87 virtual void rem_timeout(Timeout
*);
89 virtual Watch
*add_watch(Watch::Internal
*);
91 virtual void rem_watch(Watch
*);
93 void watch_ready(SimpleWatch
&);
95 void timeout_expired(SimpleTimeout
&);
99 volatile bool _running
;
102 } /* namespace DBus */
104 #endif//__DBUSXX_EVENTLOOP_INTEGRATION_H