00001 /*************************************************************************** 00002 * Copyright (C) 2009 by Rick L. Vinyard, Jr. * 00003 * rvinyard@cs.nmsu.edu * 00004 * * 00005 * This file is part of the dbus-cxx library. * 00006 * * 00007 * The dbus-cxx library is free software; you can redistribute it and/or * 00008 * modify it under the terms of the GNU General Public License * 00009 * version 3 as published by the Free Software Foundation. * 00010 * * 00011 * The dbus-cxx library is distributed in the hope that it will be * 00012 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * 00013 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this software. If not see <http://www.gnu.org/licenses/>. * 00018 ***************************************************************************/ 00019 #ifndef DBUSMESSAGEHANDLER_H 00020 #define DBUSMESSAGEHANDLER_H 00021 00022 #include <sigc++/sigc++.h> 00023 00024 #include <dbus-cxx/enums.h> 00025 #include <dbus-cxx/pointer.h> 00026 #include <dbus-cxx/accumulators.h> 00027 #include <dbus-cxx/message.h> 00028 00029 namespace DBus 00030 { 00031 00032 class Connection; 00033 00042 class MessageHandler : public sigc::trackable 00043 { 00044 protected: 00045 MessageHandler(); 00046 00047 public: 00048 00049 typedef DBusCxxPointer<MessageHandler> pointer; 00050 00051 typedef DBusCxxWeakPointer<MessageHandler> weak_pointer; 00052 00053 ~MessageHandler(); 00054 00056 virtual HandlerResult handle_message( DBusCxxPointer<Connection>, Message::const_pointer ); 00057 00058 typedef sigc::signal<HandlerResult,DBusCxxPointer<Connection>, Message::const_pointer>::accumulated<MessageHandlerAccumulator> MessageSignal; 00059 00060 MessageSignal& signal_message(); 00061 00062 protected: 00063 00064 MessageSignal m_signal_message; 00065 00070 static DBusHandlerResult message_handler_callback(DBusConnection* connection, DBusMessage* message, void* user_data); 00071 00072 }; 00073 00074 } 00075 00076 #endif