dbus-cxx logo
objectproxy.h
Go to the documentation of this file.
1 
2 // -*- c++ -*-
3 /* Do not edit! -- generated file */
4 
5 /***************************************************************************
6  * Copyright (C) 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 
28 #include <dbus-cxx/signal_proxy.h>
30 
31 #ifndef DBUSCXX_OBJECTPROXY_H
32 #define DBUSCXX_OBJECTPROXY_H
33 
34 namespace DBus
35 {
36 
37  class Connection;
38 
178  {
179  protected:
180 
185  ObjectProxy( DBusCxxPointer<Connection> conn, const std::string& destination, const std::string& path );
186 
187  public:
188 
194  typedef DBusCxxPointer<ObjectProxy> pointer;
195 
200  static pointer create( const std::string& path );
201 
207  static pointer create( const std::string& destination, const std::string& path );
208 
209  static pointer create( DBusCxxPointer<Connection> conn, const std::string& path );
210 
211  static pointer create( DBusCxxPointer<Connection> conn, const std::string& destination, const std::string& path );
212 
213  virtual ~ObjectProxy();
214 
215  DBusCxxPointer<Connection> connection() const;
216 
217  void set_connection( DBusCxxPointer<Connection> conn );
218 
219  const std::string& destination() const;
220 
221  void set_destination( const std::string& destination );
222 
223  const Path& path() const;
224 
225  void set_path( const std::string& path );
226 
227  typedef std::multimap<std::string, InterfaceProxy::pointer> Interfaces;
228 
229  const Interfaces& interfaces() const;
230 
232  InterfaceProxy::pointer interface( const std::string& name ) const;
233 
235  InterfaceProxy::pointer operator[]( const std::string& name ) const;
236 
239 
245  InterfaceProxy::pointer create_interface( const std::string& name );
246 
248  void remove_interface( const std::string& name );
249 
252 
253  bool has_interface( const std::string& name ) const;
254 
256 
258 
259  bool set_default_interface( const std::string& new_default_name );
260 
262 
264 
266  bool add_method( const std::string& interface, MethodProxyBase::pointer method );
267 
269  bool add_method( MethodProxyBase::pointer method );
270 
271  CallMessage::pointer create_call_message( const std::string& interface_name, const std::string& method_name ) const;
272 
273  CallMessage::pointer create_call_message( const std::string& method_name ) const;
274 
275  ReturnMessage::const_pointer call( CallMessage::const_pointer, int timeout_milliseconds=-1 ) const;
276 
277  PendingCall::pointer call_async( CallMessage::const_pointer, int timeout_milliseconds=-1 ) const;
278 
285  template <class T_return>
286  DBusCxxPointer<MethodProxy<T_return> >
287  create_method( const std::string& interface_name, const std::string& method_name )
288  {
289  InterfaceProxy::pointer interface = this->interface(interface_name);
290  if ( not interface ) interface = this->create_interface( interface_name );
291  return interface->create_method<T_return>(method_name);
292  }
293 
300  template <class T_return, class T_arg1>
301  DBusCxxPointer<MethodProxy<T_return, T_arg1> >
302  create_method( const std::string& interface_name, const std::string& method_name )
303  {
304  InterfaceProxy::pointer interface = this->interface(interface_name);
305  if ( not interface ) interface = this->create_interface( interface_name );
306  return interface->create_method<T_return, T_arg1>(method_name);
307  }
308 
315  template <class T_return, class T_arg1,class T_arg2>
316  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2> >
317  create_method( const std::string& interface_name, const std::string& method_name )
318  {
319  InterfaceProxy::pointer interface = this->interface(interface_name);
320  if ( not interface ) interface = this->create_interface( interface_name );
321  return interface->create_method<T_return, T_arg1,T_arg2>(method_name);
322  }
323 
330  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
331  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2,T_arg3> >
332  create_method( const std::string& interface_name, const std::string& method_name )
333  {
334  InterfaceProxy::pointer interface = this->interface(interface_name);
335  if ( not interface ) interface = this->create_interface( interface_name );
336  return interface->create_method<T_return, T_arg1,T_arg2,T_arg3>(method_name);
337  }
338 
345  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
346  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4> >
347  create_method( const std::string& interface_name, const std::string& method_name )
348  {
349  InterfaceProxy::pointer interface = this->interface(interface_name);
350  if ( not interface ) interface = this->create_interface( interface_name );
351  return interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4>(method_name);
352  }
353 
360  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
361  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> >
362  create_method( const std::string& interface_name, const std::string& method_name )
363  {
364  InterfaceProxy::pointer interface = this->interface(interface_name);
365  if ( not interface ) interface = this->create_interface( interface_name );
366  return interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5>(method_name);
367  }
368 
375  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
376  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> >
377  create_method( const std::string& interface_name, const std::string& method_name )
378  {
379  InterfaceProxy::pointer interface = this->interface(interface_name);
380  if ( not interface ) interface = this->create_interface( interface_name );
381  return interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6>(method_name);
382  }
383 
390  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>
391  DBusCxxPointer<MethodProxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> >
392  create_method( const std::string& interface_name, const std::string& method_name )
393  {
394  InterfaceProxy::pointer interface = this->interface(interface_name);
395  if ( not interface ) interface = this->create_interface( interface_name );
396  return interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>(method_name);
397  }
398 
399 
406  template <class T_return>
407  DBusCxxPointer<signal_proxy<T_return> >
408  create_signal( const std::string& interface_name, const std::string& sig_name )
409  {
410  InterfaceProxy::pointer interface = this->interface(interface_name);
411  if ( not interface ) interface = this->create_interface( interface_name );
412  return interface->create_signal<T_return>(sig_name);
413  }
414 
421  template <class T_return, class T_arg1>
422  DBusCxxPointer<signal_proxy<T_return, T_arg1> >
423  create_signal( const std::string& interface_name, const std::string& sig_name )
424  {
425  InterfaceProxy::pointer interface = this->interface(interface_name);
426  if ( not interface ) interface = this->create_interface( interface_name );
427  return interface->create_signal<T_return, T_arg1>(sig_name);
428  }
429 
436  template <class T_return, class T_arg1,class T_arg2>
437  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2> >
438  create_signal( const std::string& interface_name, const std::string& sig_name )
439  {
440  InterfaceProxy::pointer interface = this->interface(interface_name);
441  if ( not interface ) interface = this->create_interface( interface_name );
442  return interface->create_signal<T_return, T_arg1,T_arg2>(sig_name);
443  }
444 
451  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
452  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3> >
453  create_signal( const std::string& interface_name, const std::string& sig_name )
454  {
455  InterfaceProxy::pointer interface = this->interface(interface_name);
456  if ( not interface ) interface = this->create_interface( interface_name );
457  return interface->create_signal<T_return, T_arg1,T_arg2,T_arg3>(sig_name);
458  }
459 
466  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
467  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4> >
468  create_signal( const std::string& interface_name, const std::string& sig_name )
469  {
470  InterfaceProxy::pointer interface = this->interface(interface_name);
471  if ( not interface ) interface = this->create_interface( interface_name );
472  return interface->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4>(sig_name);
473  }
474 
481  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
482  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> >
483  create_signal( const std::string& interface_name, const std::string& sig_name )
484  {
485  InterfaceProxy::pointer interface = this->interface(interface_name);
486  if ( not interface ) interface = this->create_interface( interface_name );
487  return interface->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5>(sig_name);
488  }
489 
496  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
497  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> >
498  create_signal( const std::string& interface_name, const std::string& sig_name )
499  {
500  InterfaceProxy::pointer interface = this->interface(interface_name);
501  if ( not interface ) interface = this->create_interface( interface_name );
502  return interface->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6>(sig_name);
503  }
504 
511  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>
512  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> >
513  create_signal( const std::string& interface_name, const std::string& sig_name )
514  {
515  InterfaceProxy::pointer interface = this->interface(interface_name);
516  if ( not interface ) interface = this->create_interface( interface_name );
517  return interface->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>(sig_name);
518  }
519 
520 
521  sigc::signal<void,InterfaceProxy::pointer> signal_interface_added();
522 
523  sigc::signal<void,InterfaceProxy::pointer> signal_interface_removed();
524 
525  sigc::signal<void,InterfaceProxy::pointer/*old default*/,InterfaceProxy::pointer/*new default*/> signal_default_interface_changed();
526 
527  protected:
528 
529  DBusCxxPointer<Connection> m_connection;
530 
531  std::string m_destination;
532 
534 
535  mutable pthread_rwlock_t m_interfaces_rwlock;
536 
537  pthread_mutex_t m_name_mutex;
538 
539  Interfaces m_interfaces;
540 
541  InterfaceProxy::pointer m_default_interface;
542 
543  sigc::signal<void,InterfaceProxy::pointer,InterfaceProxy::pointer> m_signal_default_interface_changed;
544 
545  sigc::signal<void,InterfaceProxy::pointer> m_signal_interface_added;
546 
547  sigc::signal<void,InterfaceProxy::pointer> m_signal_interface_removed;
548 
549  typedef std::map<InterfaceProxy::pointer,sigc::connection> InterfaceSignalNameConnections;
550 
551  InterfaceSignalNameConnections m_interface_signal_name_connections;
552 
553  void on_interface_name_changed(const std::string& oldname, const std::string& newname, InterfaceProxy::pointer interface);
554 
555  };
556 
557 }
558 
559 #endif
sigc::signal< void, InterfaceProxy::pointer, InterfaceProxy::pointer > signal_default_interface_changed()
Definition: objectproxy.cpp:465
ObjectProxy(DBusCxxPointer< Connection > conn, const std::string &destination, const std::string &path)
This class has a protected constructor.
Definition: objectproxy.cpp:28
DBusCxxPointer< CallMessage > pointer
Definition: callmessage.h:57
bool set_default_interface(const std::string &new_default_name)
Definition: objectproxy.cpp:324
InterfaceSignalNameConnections m_interface_signal_name_connections
Definition: objectproxy.h:551
DBusCxxPointer< signal_proxy< T_return > > create_signal(const std::string &interface_name, const std::string &sig_name)
Creates a signal proxy with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:408
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2 > > create_method(const std::string &interface_name, const std::string &method_name)
Creates a proxy method with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:317
DBusCxxPointer< Connection > connection() const
Definition: objectproxy.cpp:63
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > create_signal(const std::string &interface_name, const std::string &sig_name)
Creates a signal proxy with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:468
bool has_interface(const std::string &name) const
Definition: objectproxy.cpp:273
DBusCxxPointer< MethodProxy< T_return > > create_method(const std::string &interface_name, const std::string &method_name)
Creates a proxy method with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:287
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > create_method(const std::string &interface_name, const std::string &method_name)
Creates a proxy method with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:377
pthread_rwlock_t m_interfaces_rwlock
Definition: objectproxy.h:535
Definition: accumulators.h:24
sigc::signal< void, InterfaceProxy::pointer > signal_interface_added()
Definition: objectproxy.cpp:455
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > create_signal(const std::string &interface_name, const std::string &sig_name)
Creates a signal proxy with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:513
PendingCall::pointer call_async(CallMessage::const_pointer, int timeout_milliseconds=-1) const
Definition: objectproxy.cpp:448
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > create_signal(const std::string &interface_name, const std::string &sig_name)
Creates a signal proxy with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:483
void set_destination(const std::string &destination)
Definition: objectproxy.cpp:82
InterfaceProxy::pointer operator[](const std::string &name) const
Alias for interface(name)
Definition: objectproxy.cpp:123
InterfaceProxy::pointer interface(const std::string &name) const
Returns the first interface with the given name.
Definition: objectproxy.cpp:106
DBusCxxPointer< InterfaceProxy > pointer
Definition: interfaceproxy.h:51
InterfaceProxy::pointer default_interface() const
Definition: objectproxy.cpp:319
bool add_interface(InterfaceProxy::pointer interface)
Adds the interface to this object.
Definition: objectproxy.cpp:128
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3 > > create_signal(const std::string &interface_name, const std::string &sig_name)
Creates a signal proxy with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:453
Path m_path
Definition: objectproxy.h:533
std::map< InterfaceProxy::pointer, sigc::connection > InterfaceSignalNameConnections
Definition: objectproxy.h:549
DBusCxxPointer< PendingCall > pointer
Definition: pendingcall.h:47
static pointer create(const std::string &path)
Creates an ObjectProxy with a specific path.
Definition: objectproxy.cpp:37
DBusCxxPointer< signal_proxy< T_return, T_arg1 > > create_signal(const std::string &interface_name, const std::string &sig_name)
Creates a signal proxy with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:423
ReturnMessage::const_pointer call(CallMessage::const_pointer, int timeout_milliseconds=-1) const
Definition: objectproxy.cpp:435
sigc::signal< void, InterfaceProxy::pointer > m_signal_interface_added
Definition: objectproxy.h:545
DBusCxxPointer< ObjectProxy > pointer
Typedef to smart pointers to ObjectProxy.
Definition: objectproxy.h:194
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > create_method(const std::string &interface_name, const std::string &method_name)
Creates a proxy method with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:347
virtual ~ObjectProxy()
Definition: objectproxy.cpp:57
void set_path(const std::string &path)
Definition: objectproxy.cpp:92
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > create_method(const std::string &interface_name, const std::string &method_name)
Creates a proxy method with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:362
const Interfaces & interfaces() const
Definition: objectproxy.cpp:101
DBusCxxPointer< Connection > m_connection
Definition: objectproxy.h:529
sigc::signal< void, InterfaceProxy::pointer > signal_interface_removed()
Definition: objectproxy.cpp:460
CallMessage::pointer create_call_message(const std::string &interface_name, const std::string &method_name) const
Definition: objectproxy.cpp:403
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2, T_arg3 > > create_method(const std::string &interface_name, const std::string &method_name)
Creates a proxy method with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:332
DBusCxxPointer< MethodProxyBase > pointer
Definition: methodproxybase.h:56
InterfaceProxy::pointer create_interface(const std::string &name)
Creates and adds the named interface to this object.
Definition: objectproxy.cpp:167
std::multimap< std::string, InterfaceProxy::pointer > Interfaces
Definition: objectproxy.h:227
void on_interface_name_changed(const std::string &oldname, const std::string &newname, InterfaceProxy::pointer interface)
Definition: objectproxy.cpp:470
InterfaceProxy::pointer m_default_interface
Definition: objectproxy.h:541
sigc::signal< void, InterfaceProxy::pointer > m_signal_interface_removed
Definition: objectproxy.h:547
std::string m_destination
Definition: objectproxy.h:531
const Path & path() const
Definition: objectproxy.cpp:87
void set_connection(DBusCxxPointer< Connection > conn)
Definition: objectproxy.cpp:68
Definition: path.h:31
DBusCxxPointer< MethodProxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > create_method(const std::string &interface_name, const std::string &method_name)
Creates a proxy method with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:392
void remove_interface(const std::string &name)
Removes the first interface with the given name.
Definition: objectproxy.cpp:178
void remove_default_interface()
Definition: objectproxy.cpp:367
DBusCxxPointer< const ReturnMessage > const_pointer
Definition: returnmessage.h:54
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > create_signal(const std::string &interface_name, const std::string &sig_name)
Creates a signal proxy with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:498
Interfaces m_interfaces
Definition: objectproxy.h:539
Object proxies are local proxies that provide local methods and signals for remote objects with dbus ...
Definition: objectproxy.h:177
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2 > > create_signal(const std::string &interface_name, const std::string &sig_name)
Creates a signal proxy with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:438
DBusCxxPointer< const CallMessage > const_pointer
Definition: callmessage.h:59
DBusCxxPointer< MethodProxy< T_return, T_arg1 > > create_method(const std::string &interface_name, const std::string &method_name)
Creates a proxy method with a signature based on the template parameters and adds it to the named int...
Definition: objectproxy.h:302
pthread_mutex_t m_name_mutex
Definition: objectproxy.h:537
sigc::signal< void, InterfaceProxy::pointer, InterfaceProxy::pointer > m_signal_default_interface_changed
Definition: objectproxy.h:543
const std::string & destination() const
Definition: objectproxy.cpp:77
bool add_method(const std::string &interface, MethodProxyBase::pointer method)
Adds the method to the named interface.
Definition: objectproxy.cpp:376

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