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_DISPATCHER_P_H
26 #define __DBUSXX_DISPATCHER_P_H
33 #include <dbus-c++/dispatcher.h>
35 #include <dbus/dbus.h>
37 #include "internalerror.h"
41 class DBUSXXAPILOCAL DispatcherCache
44 typedef std::set
<Dispatcher
*> Collection
;
46 static RefPtrI
<DispatcherCache
> getInstance()
48 static RefPtrI
<DispatcherCache
> _cache(new DispatcherCache());
63 void insert(Dispatcher
* d
)
68 void erase(Dispatcher
* d
)
73 bool exists(Dispatcher
* d
) const
75 return _instances
.find(d
) != _instances
.end();
78 Collection::size_type
size() const
80 return _instances
.size();
85 static RefPtrI
<SimpleMutex
> getGuard()
87 static RefPtrI
<SimpleMutex
> _guard(new SimpleMutex());
92 DispatcherCache() : _instances() {}
95 Collection _instances
;
97 template<typename
> friend class RefPtrI
;
101 struct DBUSXXAPILOCAL
Dispatcher::Private
103 static dbus_bool_t
on_add_watch(DBusWatch
*watch
, void *data
);
105 static void on_rem_watch(DBusWatch
*watch
, void *data
);
107 static void on_toggle_watch(DBusWatch
*watch
, void *data
);
109 static dbus_bool_t
on_add_timeout(DBusTimeout
*timeout
, void *data
);
111 static void on_rem_timeout(DBusTimeout
*timeout
, void *data
);
113 static void on_toggle_timeout(DBusTimeout
*timeout
, void *data
);
116 } /* namespace DBus */
118 #endif//__DBUSXX_DISPATCHER_P_H