dbus-cxx logo
interfaceproxy.h
Go to the documentation of this file.
1 
2 // -*- c++ -*-
3 /* Do not edit! -- generated file */
4 
5 /***************************************************************************
6  * Copyright (C) 2007,2008,2009,2010 by Rick L. Vinyard, Jr. *
7  * rvinyard@cs.nmsu.edu *
8  * *
9  * This file is part of the dbus-cxx library. *
10  * *
11  * The dbus-cxx library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public License *
13  * version 3 as published by the Free Software Foundation. *
14  * *
15  * The dbus-cxx library is distributed in the hope that it will be *
16  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
17  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
18  * General Public License for more details. *
19  * *
20  * You should have received a copy of the GNU General Public License *
21  * along with this software. If not see <http://www.gnu.org/licenses/>. *
22  ***************************************************************************/
23 #include <sigc++/sigc++.h>
24 
25 #include <string>
26 #include <map>
27 #include <set>
28 
29 #include <dbus-cxx/methodproxy.h>
30 #include <dbus-cxx/signal_proxy.h>
31 
32 #ifndef DBUSCXX_INTERFACEPROXY_H
33 #define DBUSCXX_INTERFACEPROXY_H
34 
35 namespace DBus {
36 
37  class ObjectProxy;
38 
46  {
47  protected:
48  InterfaceProxy(const std::string& name);
49 
50  public:
51  typedef DBusCxxPointer<InterfaceProxy> pointer;
52 
53  typedef DBusCxxWeakPointer<InterfaceProxy> weak_pointer;
54 
55  typedef std::multimap<std::string, MethodProxyBase::pointer> Methods;
56 
57  typedef std::set<signal_proxy_base::pointer> Signals;
58 
59  static pointer create( const std::string& name = std::string() );
60 
61  virtual ~InterfaceProxy();
62 
63  ObjectProxy* object() const;
64 
65  Path path() const;
66 
67  DBusCxxPointer<Connection> connection() const;
68 
69  const std::string& name() const;
70 
71  void set_name( const std::string& new_name );
72 
73  const Methods& methods() const;
74 
76  MethodProxyBase::pointer method( const std::string& name ) const;
77 
78  template <class T_return>
79  DBusCxxPointer<MethodProxy<T_return> > create_method( const std::string& name )
80  {
81  DBusCxxPointer< MethodProxy<T_return> > method;
82  method = MethodProxy<T_return>::create(name);
83  this->add_method(method);
84  return method;
85  }
86 
87  template <class T_return, class T_arg1>
88  DBusCxxPointer<MethodProxy<T_return, T_arg1> > create_method( const std::string& name )
89  {
90  DBusCxxPointer< MethodProxy<T_return, T_arg1> > method;
92  this->add_method(method);
93  return method;
94  }
95 
96  template <class T_return, class T_arg1,class T_arg2>
97  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2> > create_method( const std::string& name )
98  {
99  DBusCxxPointer< MethodProxy<T_return, T_arg1,T_arg2> > method;
101  this->add_method(method);
102  return method;
103  }
104 
105  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
106  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2,T_arg3> > create_method( const std::string& name )
107  {
108  DBusCxxPointer< MethodProxy<T_return, T_arg1,T_arg2,T_arg3> > method;
110  this->add_method(method);
111  return method;
112  }
113 
114  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
115  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > create_method( const std::string& name )
116  {
117  DBusCxxPointer< MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > method;
119  this->add_method(method);
120  return method;
121  }
122 
123  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
124  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > create_method( const std::string& name )
125  {
126  DBusCxxPointer< MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > method;
128  this->add_method(method);
129  return method;
130  }
131 
132  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
133  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > create_method( const std::string& name )
134  {
135  DBusCxxPointer< MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > method;
137  this->add_method(method);
138  return method;
139  }
140 
141  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7>
142  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > create_method( const std::string& name )
143  {
144  DBusCxxPointer< MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > method;
146  this->add_method(method);
147  return method;
148  }
149 
150 
151 
154 
156  void remove_method( const std::string& name );
157 
160 
162  bool has_method( const std::string& name ) const;
163 
166 
167  CallMessage::pointer create_call_message( const std::string& method_name ) const;
168 
169  ReturnMessage::const_pointer call( CallMessage::const_pointer, int timeout_milliseconds=-1 ) const;
170 
171  PendingCall::pointer call_async( CallMessage::const_pointer, int timeout_milliseconds=-1 ) const;
172 
173  template <class T_return>
174  DBusCxxPointer<signal_proxy<T_return> > create_signal( const std::string& sig_name )
175  {
176  DBusCxxPointer< signal_proxy<T_return> > sig;
177  sig = signal_proxy<T_return>::create(this->path(), m_name, sig_name);
178  this->add_signal(sig);
179  return sig;
180  }
181 
182  template <class T_return, class T_arg1>
183  DBusCxxPointer<signal_proxy<T_return, T_arg1> > create_signal( const std::string& sig_name )
184  {
185  DBusCxxPointer< signal_proxy<T_return, T_arg1> > sig;
186  sig = signal_proxy<T_return, T_arg1>::create(this->path(), m_name, sig_name);
187  this->add_signal(sig);
188  return sig;
189  }
190 
191  template <class T_return, class T_arg1,class T_arg2>
192  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2> > create_signal( const std::string& sig_name )
193  {
194  DBusCxxPointer< signal_proxy<T_return, T_arg1,T_arg2> > sig;
196  this->add_signal(sig);
197  return sig;
198  }
199 
200  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
201  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3> > create_signal( const std::string& sig_name )
202  {
203  DBusCxxPointer< signal_proxy<T_return, T_arg1,T_arg2,T_arg3> > sig;
205  this->add_signal(sig);
206  return sig;
207  }
208 
209  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
210  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > create_signal( const std::string& sig_name )
211  {
212  DBusCxxPointer< signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > sig;
214  this->add_signal(sig);
215  return sig;
216  }
217 
218  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
219  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > create_signal( const std::string& sig_name )
220  {
221  DBusCxxPointer< signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > sig;
223  this->add_signal(sig);
224  return sig;
225  }
226 
227  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
228  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > create_signal( const std::string& sig_name )
229  {
230  DBusCxxPointer< signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > sig;
232  this->add_signal(sig);
233  return sig;
234  }
235 
236  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7>
237  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > create_signal( const std::string& sig_name )
238  {
239  DBusCxxPointer< signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > sig;
241  this->add_signal(sig);
242  return sig;
243  }
244 
245 
246 
247  const Signals& signals() const;
248 
249  signal_proxy_base::pointer signal( const std::string& signame );
250 
252 
253  bool remove_signal( const std::string& signame );
254 
256 
257  bool has_signal( const std::string& signame ) const;
258 
259  bool has_signal( signal_proxy_base::pointer sig ) const;
260 
262  sigc::signal<void,const std::string&/*old name*/,const std::string&/*new name*/> signal_name_changed();
263 
265  sigc::signal<void,MethodProxyBase::pointer> signal_method_added();
266 
268  sigc::signal<void,MethodProxyBase::pointer> signal_method_removed();
269 
270  protected:
271 
272  friend class ObjectProxy;
273 
275 
276  std::string m_name;
277 
278  Methods m_methods;
279 
280  Signals m_signals;
281 
282  mutable pthread_rwlock_t m_methods_rwlock;
283 
285  pthread_mutex_t m_name_mutex;
286 
287  sigc::signal<void,const std::string&,const std::string&> m_signal_name_changed;
288 
289  sigc::signal<void,MethodProxyBase::pointer> m_signal_method_added;
290 
291  sigc::signal<void,MethodProxyBase::pointer> m_signal_method_removed;
292 
293  typedef std::map<MethodProxyBase::pointer,sigc::connection> MethodSignalNameConnections;
294 
295  MethodSignalNameConnections m_method_signal_name_connections;
296 
297  void on_method_name_changed(const std::string& oldname, const std::string& newname, MethodProxyBase::pointer method);
298 
299  void on_object_set_connection( DBusCxxPointer<Connection> conn );
300 
301  void on_object_set_path( const std::string& path );
302  };
303 
304 }
305 
306 #endif
307 
static pointer create(const std::string &interface, const std::string &name)
Definition: signal_proxy.h:405
sigc::signal< void, MethodProxyBase::pointer > m_signal_method_removed
Definition: interfaceproxy.h:291
static pointer create(const std::string &name=std::string())
Definition: interfaceproxy.cpp:37
DBusCxxPointer< CallMessage > pointer
Definition: callmessage.h:57
DBusCxxWeakPointer< InterfaceProxy > weak_pointer
Definition: interfaceproxy.h:53
MethodProxyBase::pointer method(const std::string &name) const
Returns the first method with the given name.
Definition: interfaceproxy.cpp:84
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > create_signal(const std::string &sig_name)
Definition: interfaceproxy.h:228
bool add_signal(signal_proxy_base::pointer sig)
Definition: interfaceproxy.cpp:288
sigc::signal< void, MethodProxyBase::pointer > signal_method_removed()
Signal emitted when a method of the given name is removed.
Definition: interfaceproxy.cpp:348
Definition: accumulators.h:24
const std::string & name() const
Definition: interfaceproxy.cpp:65
ObjectProxy * object() const
Definition: interfaceproxy.cpp:48
bool remove_signal(const std::string &signame)
Definition: interfaceproxy.cpp:310
sigc::signal< void, MethodProxyBase::pointer > signal_method_added()
Signal emitted when a method of the given name is added.
Definition: interfaceproxy.cpp:343
bool has_signal(const std::string &signame) const
Definition: interfaceproxy.cpp:324
ReturnMessage::const_pointer call(CallMessage::const_pointer, int timeout_milliseconds=-1) const
Definition: interfaceproxy.cpp:262
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > create_signal(const std::string &sig_name)
Definition: interfaceproxy.h:237
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > create_method(const std::string &name)
Definition: interfaceproxy.h:115
std::string m_name
Definition: interfaceproxy.h:276
Methods m_methods
Definition: interfaceproxy.h:278
virtual ~InterfaceProxy()
Definition: interfaceproxy.cpp:42
DBusCxxPointer< InterfaceProxy > pointer
Definition: interfaceproxy.h:51
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2 > > create_method(const std::string &name)
Definition: interfaceproxy.h:97
InterfaceProxy(const std::string &name)
Definition: interfaceproxy.cpp:29
Signals m_signals
Definition: interfaceproxy.h:280
void on_method_name_changed(const std::string &oldname, const std::string &newname, MethodProxyBase::pointer method)
Definition: interfaceproxy.cpp:353
CallMessage::pointer create_call_message(const std::string &method_name) const
Definition: interfaceproxy.cpp:256
Definition: interfaceproxy.h:45
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > create_method(const std::string &name)
Definition: interfaceproxy.h:124
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2 > > create_signal(const std::string &sig_name)
Definition: interfaceproxy.h:192
std::multimap< std::string, MethodProxyBase::pointer > Methods
Definition: interfaceproxy.h:55
bool add_method(MethodProxyBase::pointer method)
Adds the named method.
Definition: interfaceproxy.cpp:101
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3 > > create_signal(const std::string &sig_name)
Definition: interfaceproxy.h:201
DBusCxxPointer< PendingCall > pointer
Definition: pendingcall.h:47
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > create_signal(const std::string &sig_name)
Definition: interfaceproxy.h:210
ObjectProxy * m_object
Definition: interfaceproxy.h:274
signal_proxy_base::pointer signal(const std::string &signame)
Definition: interfaceproxy.cpp:279
static pointer create(const std::string &name)
Definition: methodproxy.h:63
DBusCxxPointer< signal_proxy< T_return > > create_signal(const std::string &sig_name)
Definition: interfaceproxy.h:174
std::map< MethodProxyBase::pointer, sigc::connection > MethodSignalNameConnections
Definition: interfaceproxy.h:293
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > create_method(const std::string &name)
Definition: interfaceproxy.h:133
DBusCxxPointer< MethodProxyBase > pointer
Definition: methodproxybase.h:56
bool has_method(const std::string &name) const
True if the interface has a method with the given name.
Definition: interfaceproxy.cpp:210
void set_name(const std::string &new_name)
Definition: interfaceproxy.cpp:70
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > create_method(const std::string &name)
Definition: interfaceproxy.h:142
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2, T_arg3 > > create_method(const std::string &name)
Definition: interfaceproxy.h:106
void remove_method(const std::string &name)
Removes the first method with the given name.
Definition: interfaceproxy.cpp:139
void on_object_set_connection(DBusCxxPointer< Connection > conn)
Definition: interfaceproxy.cpp:390
DBusCxxPointer< signal_proxy_base > pointer
Definition: signal_proxy_base.h:39
Definition: path.h:31
std::set< signal_proxy_base::pointer > Signals
Definition: interfaceproxy.h:57
Path path() const
Definition: interfaceproxy.cpp:53
MethodSignalNameConnections m_method_signal_name_connections
Definition: interfaceproxy.h:295
pthread_rwlock_t m_methods_rwlock
Definition: interfaceproxy.h:282
DBusCxxPointer< Connection > connection() const
Definition: interfaceproxy.cpp:59
pthread_mutex_t m_name_mutex
Ensures that the name doesn't change while the name changed signal is emitting.
Definition: interfaceproxy.h:285
DBusCxxPointer< const ReturnMessage > const_pointer
Definition: returnmessage.h:54
DBusCxxPointer< MethodProxy< T_return, T_arg1 > > create_method(const std::string &name)
Definition: interfaceproxy.h:88
Object proxies are local proxies that provide local methods and signals for remote objects with dbus ...
Definition: objectproxy.h:177
const Signals & signals() const
Definition: interfaceproxy.cpp:274
DBusCxxPointer< const CallMessage > const_pointer
Definition: callmessage.h:59
sigc::signal< void, MethodProxyBase::pointer > m_signal_method_added
Definition: interfaceproxy.h:289
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > create_signal(const std::string &sig_name)
Definition: interfaceproxy.h:219
void on_object_set_path(const std::string &path)
Definition: interfaceproxy.cpp:403
const Methods & methods() const
Definition: interfaceproxy.cpp:79
PendingCall::pointer call_async(CallMessage::const_pointer, int timeout_milliseconds=-1) const
Definition: interfaceproxy.cpp:268
sigc::signal< void, const std::string &, const std::string & > m_signal_name_changed
Definition: interfaceproxy.h:287
sigc::signal< void, const std::string &, const std::string & > signal_name_changed()
Signal emitted when the name is changed.
Definition: interfaceproxy.cpp:338
DBusCxxPointer< MethodProxy< T_return > > create_method(const std::string &name)
Definition: interfaceproxy.h:79
DBusCxxPointer< signal_proxy< T_return, T_arg1 > > create_signal(const std::string &sig_name)
Definition: interfaceproxy.h:183

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