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 <string> 00020 00021 #include <sigc++/sigc++.h> 00022 00023 #include <dbus-cxx/enums.h> 00024 #include <dbus-cxx/pointer.h> 00025 #include <dbus-cxx/accumulators.h> 00026 #include <dbus-cxx/signalmessage.h> 00027 00028 #ifndef DBUSCXX_SIGNALBASE_H 00029 #define DBUSCXX_SIGNALBASE_H 00030 00031 namespace DBus 00032 { 00033 class Connection; 00034 00046 // TODO fix signals that expect a return value and partially specialize for void returns 00047 00048 class signal_base 00049 { 00050 protected: 00051 00052 signal_base(const std::string& path, const std::string& interface, const std::string& name); 00053 00054 signal_base(const std::string& interface, const std::string& name); 00055 00056 signal_base(DBusCxxPointer<Connection> connection, const std::string& path, const std::string& interface, const std::string& name); 00057 00058 signal_base(DBusCxxPointer<Connection> connection, const std::string& interface, const std::string& name); 00059 00060 signal_base(const signal_base& other); 00061 00062 public: 00063 00064 typedef DBusCxxPointer<signal_base> pointer; 00065 00066 virtual ~signal_base(); 00067 00068 DBusCxxPointer<Connection> connection(); 00069 00070 void set_connection(DBusCxxPointer<Connection> connection); 00071 00072 const std::string& sender() const; 00073 00074 void set_sender(const std::string& s); 00075 00076 const std::string& interface() const; 00077 00078 void set_interface(const std::string& i); 00079 00080 const std::string& name() const; 00081 00082 void set_name( const std::string& n ); 00083 00084 const Path& path() const; 00085 00086 void set_path(const std::string& s); 00087 00088 const std::string& destination() const; 00089 00090 void set_destination(const std::string& s); 00091 00096 virtual pointer clone() = 0; 00097 00099 virtual std::string introspect(int space_depth=0) const { return std::string(); } 00100 00101 virtual std::string arg_name(size_t i) { return std::string(); } 00102 00103 virtual void set_arg_name(size_t i, const std::string& name) { } 00104 00105 protected: 00106 00107 DBusCxxWeakPointer<Connection> m_connection; 00108 00109 std::string m_sender; 00110 00111 Path m_path; 00112 00113 std::string m_interface; 00114 00115 std::string m_name; 00116 00117 std::string m_destination; 00118 00119 std::string m_match_rule; 00120 00121 bool handle_dbus_outgoing( Message::const_pointer ); 00122 }; 00123 00124 } 00125 00126 #endif