dbus-cxx logo
methodbase.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2009,2010 by Rick L. Vinyard, Jr. *
3  * rvinyard@cs.nmsu.edu *
4  * *
5  * This file is part of the dbus-cxx library. *
6  * *
7  * The dbus-cxx library is free software; you can redistribute it and/or *
8  * modify it under the terms of the GNU General Public License *
9  * version 3 as published by the Free Software Foundation. *
10  * *
11  * The dbus-cxx library is distributed in the hope that it will be *
12  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this software. If not see <http://www.gnu.org/licenses/>. *
18  ***************************************************************************/
19 #include <dbus-cxx/callmessage.h>
20 
21 #ifndef DBUSCXX_METHODBASE_H
22 #define DBUSCXX_METHODBASE_H
23 
24 namespace DBus
25 {
26  class Connection;
27 
28  class Interface;
29 
37  // TODO fix signals that expect a return value and partially specialize for void returns
38 
39  class MethodBase
40  {
41  protected:
42 
43  MethodBase(const std::string& name);
44 
45  MethodBase(const MethodBase& other);
46 
47  public:
48 
49  typedef DBusCxxPointer<MethodBase> pointer;
50 
51  virtual ~MethodBase();
52 
53  const std::string& name() const;
54 
55  void set_name( const std::string& name );
56 
57  virtual HandlerResult handle_call_message( DBusCxxPointer<Connection> connection, CallMessage::const_pointer message ) = 0;
58 
63  virtual pointer clone() = 0;
64 
65  sigc::signal<void,const std::string&/*old name*/, const std::string&/*new name*/> signal_name_changed();
66 
68  virtual std::string introspect(int space_depth=0) const { return std::string(); }
69 
70  virtual std::string arg_name(size_t i) { return std::string(); }
71 
72  virtual void set_arg_name(size_t i, const std::string& name) { }
73 
74  protected:
75 
76  std::string m_name;
77 
79  pthread_mutex_t m_name_mutex;
80 
81  sigc::signal<void,const std::string&, const std::string&> m_signal_name_changed;
82 
83  };
84 
427 }
428 
429 #endif
void set_name(const std::string &name)
Definition: methodbase.cpp:47
HandlerResult
Definition: enums.h:87
const std::string & name() const
Definition: methodbase.cpp:42
Definition: accumulators.h:24
virtual void set_arg_name(size_t i, const std::string &name)
Definition: methodbase.h:72
MethodBase(const std::string &name)
Definition: methodbase.cpp:25
Definition: methodbase.h:39
sigc::signal< void, const std::string &, const std::string & > m_signal_name_changed
Definition: methodbase.h:81
std::string m_name
Definition: methodbase.h:76
virtual HandlerResult handle_call_message(DBusCxxPointer< Connection > connection, CallMessage::const_pointer message)=0
virtual std::string introspect(int space_depth=0) const
Returns a DBus XML description of this interface.
Definition: methodbase.h:68
virtual std::string arg_name(size_t i)
Definition: methodbase.h:70
sigc::signal< void, const std::string &, const std::string & > signal_name_changed()
Definition: methodbase.cpp:56
DBusCxxPointer< MethodBase > pointer
Definition: methodbase.h:49
DBusCxxPointer< const CallMessage > const_pointer
Definition: callmessage.h:59
virtual pointer clone()=0
This method is needed to be able to create a duplicate of a child capable of parsing their specific t...
virtual ~MethodBase()
Definition: methodbase.cpp:37
pthread_mutex_t m_name_mutex
Ensures that the name doesn't change while the name changed signal is emitting.
Definition: methodbase.h:79

Generated on Sun Mar 19 2017 14:54:27 for dbus-cxx by doxygen 1.8.8