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 <dbus-cxx/callmessage.h> 00020 00021 #ifndef DBUSCXX_METHODBASE_H 00022 #define DBUSCXX_METHODBASE_H 00023 00024 namespace DBus 00025 { 00026 class Connection; 00027 00028 class Interface; 00029 00037 // TODO fix signals that expect a return value and partially specialize for void returns 00038 00039 class MethodBase 00040 { 00041 protected: 00042 00043 MethodBase(const std::string& name); 00044 00045 MethodBase(const MethodBase& other); 00046 00047 public: 00048 00049 typedef DBusCxxPointer<MethodBase> pointer; 00050 00051 virtual ~MethodBase(); 00052 00053 const std::string& name() const; 00054 00055 void set_name( const std::string& name ); 00056 00057 virtual HandlerResult handle_call_message( DBusCxxPointer<Connection> connection, CallMessage::const_pointer message ) = 0; 00058 00063 virtual pointer clone() = 0; 00064 00065 sigc::signal<void,const std::string&/*old name*/, const std::string&/*new name*/> signal_name_changed(); 00066 00068 virtual std::string introspect(int space_depth=0) const { return std::string(); } 00069 00070 virtual std::string arg_name(size_t i) { return std::string(); } 00071 00072 virtual void set_arg_name(size_t i, const std::string& name) { } 00073 00074 protected: 00075 00076 std::string m_name; 00077 00079 pthread_mutex_t m_name_mutex; 00080 00081 sigc::signal<void,const std::string&, const std::string&> m_signal_name_changed; 00082 00083 }; 00084 00427 } 00428 00429 #endif