00001 /*************************************************************************** 00002 * Copyright (C) 2009,2010 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 #include <sigc++/sigc++.h> 00020 00021 #include <dbus-cxx/enums.h> 00022 #include <dbus-cxx/pointer.h> 00023 #include <dbus-cxx/accumulators.h> 00024 #include <dbus-cxx/forward_decls.h> 00025 #include <dbus-cxx/message.h> 00026 00027 #ifndef DBUSCXX_MESSAGEHANDLER_H 00028 #define DBUSCXX_MESSAGEHANDLER_H 00029 00030 namespace DBus 00031 { 00040 class MessageHandler : public sigc::trackable 00041 { 00042 protected: 00043 MessageHandler(); 00044 00045 public: 00046 00047 typedef DBusCxxPointer<MessageHandler> pointer; 00048 00049 typedef DBusCxxWeakPointer<MessageHandler> weak_pointer; 00050 00051 virtual ~MessageHandler(); 00052 00054 virtual HandlerResult handle_message( DBusCxxPointer<Connection>, Message::const_pointer ); 00055 00056 typedef sigc::signal<HandlerResult,DBusCxxPointer<Connection>, Message::const_pointer>::accumulated<MessageHandlerAccumulator> MessageSignal; 00057 00058 MessageSignal& signal_message(); 00059 00060 protected: 00061 00062 MessageSignal m_signal_message; 00063 00068 static DBusHandlerResult message_handler_callback(DBusConnection* connection, DBusMessage* message, void* user_data); 00069 00070 }; 00071 00072 } 00073 00074 #endif