dbus-cxx logo
object.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/forward_decls.h>
30 #include <dbus-cxx/dbus_signal.h>
31 
32 #ifndef DBUSCXXOBJECT_H
33 #define DBUSCXXOBJECT_H
34 
35 namespace DBus
36 {
96  class Object: public ObjectPathHandler
97  {
98  protected:
99 
104  Object( const std::string& path, PrimaryFallback pf=PRIMARY );
105 
106  public:
107 
113  typedef DBusCxxPointer<Object> pointer;
114 
125  typedef std::multimap<std::string, DBusCxxPointer<Interface> > Interfaces;
126 
137  typedef std::map<std::string, Object::pointer> Children;
138 
144  static pointer create( const std::string& path = std::string(), PrimaryFallback pf=PRIMARY );
145 
146  virtual ~Object();
147 
149  virtual bool register_with_connection(DBusCxxPointer<Connection> conn);
150 
152  const Interfaces& interfaces() const;
153 
155  DBusCxxPointer<Interface> interface( const std::string& name ) const;
156 
158  bool add_interface( DBusCxxPointer<Interface> interface );
159 
165  DBusCxxPointer<Interface> create_interface( const std::string& name );
166 
175  template <class T_return>
176  DBusCxxPointer<Method<T_return> >
177  create_method( const std::string& method_name, sigc::slot0<T_return> slot );
178 
187  template <class T_return, class T_arg1>
188  DBusCxxPointer<Method<T_return, T_arg1> >
189  create_method( const std::string& method_name, sigc::slot1<T_return, T_arg1> slot );
190 
199  template <class T_return, class T_arg1,class T_arg2>
200  DBusCxxPointer<Method<T_return, T_arg1,T_arg2> >
201  create_method( const std::string& method_name, sigc::slot2<T_return, T_arg1,T_arg2> slot );
202 
211  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
212  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3> >
213  create_method( const std::string& method_name, sigc::slot3<T_return, T_arg1,T_arg2,T_arg3> slot );
214 
223  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
224  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4> >
225  create_method( const std::string& method_name, sigc::slot4<T_return, T_arg1,T_arg2,T_arg3,T_arg4> slot );
226 
235  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
236  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> >
237  create_method( const std::string& method_name, sigc::slot5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> slot );
238 
247  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
248  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> >
249  create_method( const std::string& method_name, sigc::slot6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> slot );
250 
259  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>
260  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> >
261  create_method( const std::string& method_name, sigc::slot7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> slot );
262 
263 
272  template <class T_return>
273  DBusCxxPointer<Method<T_return> >
274  create_method( const std::string& interface_name, const std::string& method_name, sigc::slot0<T_return> slot );
275 
284  template <class T_return, class T_arg1>
285  DBusCxxPointer<Method<T_return, T_arg1> >
286  create_method( const std::string& interface_name, const std::string& method_name, sigc::slot1<T_return, T_arg1> slot );
287 
296  template <class T_return, class T_arg1,class T_arg2>
297  DBusCxxPointer<Method<T_return, T_arg1,T_arg2> >
298  create_method( const std::string& interface_name, const std::string& method_name, sigc::slot2<T_return, T_arg1,T_arg2> slot );
299 
308  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
309  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3> >
310  create_method( const std::string& interface_name, const std::string& method_name, sigc::slot3<T_return, T_arg1,T_arg2,T_arg3> slot );
311 
320  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
321  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4> >
322  create_method( const std::string& interface_name, const std::string& method_name, sigc::slot4<T_return, T_arg1,T_arg2,T_arg3,T_arg4> slot );
323 
332  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
333  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> >
334  create_method( const std::string& interface_name, const std::string& method_name, sigc::slot5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> slot );
335 
344  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
345  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> >
346  create_method( const std::string& interface_name, const std::string& method_name, sigc::slot6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> slot );
347 
356  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>
357  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> >
358  create_method( const std::string& interface_name, const std::string& method_name, sigc::slot7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> slot );
359 
360 
362  void remove_interface( const std::string& name );
363 
369  bool has_interface( const std::string& name );
370 
375  DBusCxxPointer<Interface> default_interface() const;
376 
386  bool set_default_interface( const std::string& new_default_name );
387 
393 
401  template <class T_return>
402  DBusCxxPointer<signal<T_return> >
403  create_signal( const std::string& name );
404 
412  template <class T_return, class T_arg1>
413  DBusCxxPointer<signal<T_return, T_arg1> >
414  create_signal( const std::string& name );
415 
423  template <class T_return, class T_arg1,class T_arg2>
424  DBusCxxPointer<signal<T_return, T_arg1,T_arg2> >
425  create_signal( const std::string& name );
426 
434  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
435  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3> >
436  create_signal( const std::string& name );
437 
445  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
446  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4> >
447  create_signal( const std::string& name );
448 
456  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
457  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> >
458  create_signal( const std::string& name );
459 
467  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
468  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> >
469  create_signal( const std::string& name );
470 
478  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>
479  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> >
480  create_signal( const std::string& name );
481 
482 
490  template <class T_return>
491  DBusCxxPointer<signal<T_return> >
492  create_signal( const std::string& iface, const std::string& name );
493 
501  template <class T_return, class T_arg1>
502  DBusCxxPointer<signal<T_return, T_arg1> >
503  create_signal( const std::string& iface, const std::string& name );
504 
512  template <class T_return, class T_arg1,class T_arg2>
513  DBusCxxPointer<signal<T_return, T_arg1,T_arg2> >
514  create_signal( const std::string& iface, const std::string& name );
515 
523  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
524  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3> >
525  create_signal( const std::string& iface, const std::string& name );
526 
534  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
535  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4> >
536  create_signal( const std::string& iface, const std::string& name );
537 
545  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
546  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> >
547  create_signal( const std::string& iface, const std::string& name );
548 
556  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
557  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> >
558  create_signal( const std::string& iface, const std::string& name );
559 
567  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>
568  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> >
569  create_signal( const std::string& iface, const std::string& name );
570 
571 
572 
574  const Children& children() const;
575 
581  Object::pointer child(const std::string& name) const;
582 
592  bool add_child(const std::string& name, Object::pointer child, bool force=false);
593 
599  bool remove_child(const std::string& name);
600 
606  bool has_child(const std::string& name) const;
607 
609  std::string introspect(int space_depth=0) const;
610 
616  sigc::signal<void,DBusCxxPointer<Interface> > signal_interface_added();
617 
623  sigc::signal<void,DBusCxxPointer<Interface> > signal_interface_removed();
624 
632  sigc::signal<void,DBusCxxPointer<Interface> /*old default*/,DBusCxxPointer<Interface> /*new default*/> signal_default_interface_changed();
633 
655  virtual HandlerResult handle_message( DBusCxxPointer<Connection> conn, Message::const_pointer msg);
656 
657  protected:
658 
659  Children m_children;
660 
661  mutable pthread_rwlock_t m_interfaces_rwlock;
662 
663  pthread_mutex_t m_name_mutex;
664 
665  Interfaces m_interfaces;
666 
667  DBusCxxPointer<Interface> m_default_interface;
668 
669  sigc::signal<void,DBusCxxPointer<Interface> ,DBusCxxPointer<Interface> > m_signal_default_interface_changed;
670 
671  sigc::signal<void,DBusCxxPointer<Interface> > m_signal_interface_added;
672 
673  sigc::signal<void,DBusCxxPointer<Interface> > m_signal_interface_removed;
674 
675  typedef std::map<DBusCxxPointer<Interface> ,sigc::connection> InterfaceSignalNameConnections;
676 
677  InterfaceSignalNameConnections m_interface_signal_name_connections;
678 
683  void on_interface_name_changed(const std::string& oldname, const std::string& newname, DBusCxxPointer<Interface> interface);
684 
685  };
686 
687 }
688 
689 #include <dbus-cxx/interface.h>
690 
691 /************************
692  * Template definitions *
693  ************************/
694 
695 namespace DBus {
696 
697  template <class T_return>
698  DBusCxxPointer<Method<T_return> >
699  Object::create_method( const std::string& method_name, sigc::slot0<T_return> slot )
700  {
701  if ( not m_default_interface )
702  {
703  this->create_interface("");
704  this->set_default_interface("");
705  }
706  // TODO throw an error if the default interface still doesn't exist
707 
708  DBusCxxPointer< Method<T_return> > method;
709  method = m_default_interface->create_method<T_return>(method_name);
710  method->set_method( slot );
711  return method;
712  }
713 
714  template <class T_return, class T_arg1>
715  DBusCxxPointer<Method<T_return, T_arg1> >
716  Object::create_method( const std::string& method_name, sigc::slot1<T_return, T_arg1> slot )
717  {
718  if ( not m_default_interface )
719  {
720  this->create_interface("");
721  this->set_default_interface("");
722  }
723  // TODO throw an error if the default interface still doesn't exist
724 
725  DBusCxxPointer< Method<T_return, T_arg1> > method;
726  method = m_default_interface->create_method<T_return, T_arg1>(method_name);
727  method->set_method( slot );
728  return method;
729  }
730 
731  template <class T_return, class T_arg1,class T_arg2>
732  DBusCxxPointer<Method<T_return, T_arg1,T_arg2> >
733  Object::create_method( const std::string& method_name, sigc::slot2<T_return, T_arg1,T_arg2> slot )
734  {
735  if ( not m_default_interface )
736  {
737  this->create_interface("");
738  this->set_default_interface("");
739  }
740  // TODO throw an error if the default interface still doesn't exist
741 
742  DBusCxxPointer< Method<T_return, T_arg1,T_arg2> > method;
743  method = m_default_interface->create_method<T_return, T_arg1,T_arg2>(method_name);
744  method->set_method( slot );
745  return method;
746  }
747 
748  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
749  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3> >
750  Object::create_method( const std::string& method_name, sigc::slot3<T_return, T_arg1,T_arg2,T_arg3> slot )
751  {
752  if ( not m_default_interface )
753  {
754  this->create_interface("");
755  this->set_default_interface("");
756  }
757  // TODO throw an error if the default interface still doesn't exist
758 
759  DBusCxxPointer< Method<T_return, T_arg1,T_arg2,T_arg3> > method;
760  method = m_default_interface->create_method<T_return, T_arg1,T_arg2,T_arg3>(method_name);
761  method->set_method( slot );
762  return method;
763  }
764 
765  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
766  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4> >
767  Object::create_method( const std::string& method_name, sigc::slot4<T_return, T_arg1,T_arg2,T_arg3,T_arg4> slot )
768  {
769  if ( not m_default_interface )
770  {
771  this->create_interface("");
772  this->set_default_interface("");
773  }
774  // TODO throw an error if the default interface still doesn't exist
775 
776  DBusCxxPointer< Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > method;
777  method = m_default_interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4>(method_name);
778  method->set_method( slot );
779  return method;
780  }
781 
782  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
783  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> >
784  Object::create_method( const std::string& method_name, sigc::slot5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> slot )
785  {
786  if ( not m_default_interface )
787  {
788  this->create_interface("");
789  this->set_default_interface("");
790  }
791  // TODO throw an error if the default interface still doesn't exist
792 
793  DBusCxxPointer< Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > method;
794  method = m_default_interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5>(method_name);
795  method->set_method( slot );
796  return method;
797  }
798 
799  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
800  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> >
801  Object::create_method( const std::string& method_name, sigc::slot6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> slot )
802  {
803  if ( not m_default_interface )
804  {
805  this->create_interface("");
806  this->set_default_interface("");
807  }
808  // TODO throw an error if the default interface still doesn't exist
809 
810  DBusCxxPointer< Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > method;
811  method = m_default_interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6>(method_name);
812  method->set_method( slot );
813  return method;
814  }
815 
816  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>
817  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> >
818  Object::create_method( const std::string& method_name, sigc::slot7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> slot )
819  {
820  if ( not m_default_interface )
821  {
822  this->create_interface("");
823  this->set_default_interface("");
824  }
825  // TODO throw an error if the default interface still doesn't exist
826 
827  DBusCxxPointer< Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > method;
828  method = m_default_interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>(method_name);
829  method->set_method( slot );
830  return method;
831  }
832 
833 
834  template <class T_return>
835  DBusCxxPointer<Method<T_return> >
836  Object::create_method( const std::string& interface_name, const std::string& method_name, sigc::slot0<T_return> slot )
837  {
839  interface = this->interface(interface_name);
840  if ( not interface ) interface = this->create_interface(interface_name);
841  // TODO throw an error if the interface still doesn't exist
842 
843  DBusCxxPointer< Method<T_return> > method;
844  method = interface->create_method<T_return>(method_name);
845  method->set_method( slot );
846  return method;
847  }
848 
849  template <class T_return, class T_arg1>
850  DBusCxxPointer<Method<T_return, T_arg1> >
851  Object::create_method( const std::string& interface_name, const std::string& method_name, sigc::slot1<T_return, T_arg1> slot )
852  {
854  interface = this->interface(interface_name);
855  if ( not interface ) interface = this->create_interface(interface_name);
856  // TODO throw an error if the interface still doesn't exist
857 
858  DBusCxxPointer< Method<T_return, T_arg1> > method;
859  method = interface->create_method<T_return, T_arg1>(method_name);
860  method->set_method( slot );
861  return method;
862  }
863 
864  template <class T_return, class T_arg1,class T_arg2>
865  DBusCxxPointer<Method<T_return, T_arg1,T_arg2> >
866  Object::create_method( const std::string& interface_name, const std::string& method_name, sigc::slot2<T_return, T_arg1,T_arg2> slot )
867  {
869  interface = this->interface(interface_name);
870  if ( not interface ) interface = this->create_interface(interface_name);
871  // TODO throw an error if the interface still doesn't exist
872 
873  DBusCxxPointer< Method<T_return, T_arg1,T_arg2> > method;
874  method = interface->create_method<T_return, T_arg1,T_arg2>(method_name);
875  method->set_method( slot );
876  return method;
877  }
878 
879  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
880  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3> >
881  Object::create_method( const std::string& interface_name, const std::string& method_name, sigc::slot3<T_return, T_arg1,T_arg2,T_arg3> slot )
882  {
884  interface = this->interface(interface_name);
885  if ( not interface ) interface = this->create_interface(interface_name);
886  // TODO throw an error if the interface still doesn't exist
887 
888  DBusCxxPointer< Method<T_return, T_arg1,T_arg2,T_arg3> > method;
889  method = interface->create_method<T_return, T_arg1,T_arg2,T_arg3>(method_name);
890  method->set_method( slot );
891  return method;
892  }
893 
894  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
895  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4> >
896  Object::create_method( const std::string& interface_name, const std::string& method_name, sigc::slot4<T_return, T_arg1,T_arg2,T_arg3,T_arg4> slot )
897  {
899  interface = this->interface(interface_name);
900  if ( not interface ) interface = this->create_interface(interface_name);
901  // TODO throw an error if the interface still doesn't exist
902 
903  DBusCxxPointer< Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > method;
904  method = interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4>(method_name);
905  method->set_method( slot );
906  return method;
907  }
908 
909  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
910  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> >
911  Object::create_method( const std::string& interface_name, const std::string& method_name, sigc::slot5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> slot )
912  {
914  interface = this->interface(interface_name);
915  if ( not interface ) interface = this->create_interface(interface_name);
916  // TODO throw an error if the interface still doesn't exist
917 
918  DBusCxxPointer< Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > method;
919  method = interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5>(method_name);
920  method->set_method( slot );
921  return method;
922  }
923 
924  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
925  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> >
926  Object::create_method( const std::string& interface_name, const std::string& method_name, sigc::slot6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> slot )
927  {
929  interface = this->interface(interface_name);
930  if ( not interface ) interface = this->create_interface(interface_name);
931  // TODO throw an error if the interface still doesn't exist
932 
933  DBusCxxPointer< Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > method;
934  method = interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6>(method_name);
935  method->set_method( slot );
936  return method;
937  }
938 
939  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>
940  DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> >
941  Object::create_method( const std::string& interface_name, const std::string& method_name, sigc::slot7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> slot )
942  {
944  interface = this->interface(interface_name);
945  if ( not interface ) interface = this->create_interface(interface_name);
946  // TODO throw an error if the interface still doesn't exist
947 
948  DBusCxxPointer< Method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > method;
949  method = interface->create_method<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>(method_name);
950  method->set_method( slot );
951  return method;
952  }
953 
954 
955  template <class T_return>
956  DBusCxxPointer<signal<T_return> >
957  Object::create_signal( const std::string& name )
958  {
959  DBusCxxPointer<DBus::signal<T_return> > sig;
960  Interface::pointer iface = this->default_interface();
961  if ( not iface ) iface = this->create_interface("");
962  sig = iface->create_signal<T_return>(name);
963  return sig;
964  }
965 
966  template <class T_return, class T_arg1>
967  DBusCxxPointer<signal<T_return, T_arg1> >
968  Object::create_signal( const std::string& name )
969  {
970  DBusCxxPointer<DBus::signal<T_return, T_arg1> > sig;
971  Interface::pointer iface = this->default_interface();
972  if ( not iface ) iface = this->create_interface("");
973  sig = iface->create_signal<T_return, T_arg1>(name);
974  return sig;
975  }
976 
977  template <class T_return, class T_arg1,class T_arg2>
978  DBusCxxPointer<signal<T_return, T_arg1,T_arg2> >
979  Object::create_signal( const std::string& name )
980  {
981  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2> > sig;
982  Interface::pointer iface = this->default_interface();
983  if ( not iface ) iface = this->create_interface("");
984  sig = iface->create_signal<T_return, T_arg1,T_arg2>(name);
985  return sig;
986  }
987 
988  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
989  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3> >
990  Object::create_signal( const std::string& name )
991  {
992  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2,T_arg3> > sig;
993  Interface::pointer iface = this->default_interface();
994  if ( not iface ) iface = this->create_interface("");
995  sig = iface->create_signal<T_return, T_arg1,T_arg2,T_arg3>(name);
996  return sig;
997  }
998 
999  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
1000  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4> >
1001  Object::create_signal( const std::string& name )
1002  {
1003  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > sig;
1004  Interface::pointer iface = this->default_interface();
1005  if ( not iface ) iface = this->create_interface("");
1006  sig = iface->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4>(name);
1007  return sig;
1008  }
1009 
1010  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
1011  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> >
1012  Object::create_signal( const std::string& name )
1013  {
1014  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > sig;
1015  Interface::pointer iface = this->default_interface();
1016  if ( not iface ) iface = this->create_interface("");
1017  sig = iface->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5>(name);
1018  return sig;
1019  }
1020 
1021  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
1022  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> >
1023  Object::create_signal( const std::string& name )
1024  {
1025  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > sig;
1026  Interface::pointer iface = this->default_interface();
1027  if ( not iface ) iface = this->create_interface("");
1028  sig = iface->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6>(name);
1029  return sig;
1030  }
1031 
1032  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>
1033  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> >
1034  Object::create_signal( const std::string& name )
1035  {
1036  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > sig;
1037  Interface::pointer iface = this->default_interface();
1038  if ( not iface ) iface = this->create_interface("");
1039  sig = iface->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>(name);
1040  return sig;
1041  }
1042 
1043 
1044  template <class T_return>
1045  DBusCxxPointer<signal<T_return> >
1046  Object::create_signal( const std::string& iface, const std::string& name )
1047  {
1048  DBusCxxPointer<DBus::signal<T_return> > sig;
1049  if ( not has_interface(iface) ) this->create_interface(iface);
1050  sig = this->interface(iface)->create_signal<T_return>(name);
1051  return sig;
1052  }
1053 
1054  template <class T_return, class T_arg1>
1055  DBusCxxPointer<signal<T_return, T_arg1> >
1056  Object::create_signal( const std::string& iface, const std::string& name )
1057  {
1058  DBusCxxPointer<DBus::signal<T_return, T_arg1> > sig;
1059  if ( not has_interface(iface) ) this->create_interface(iface);
1060  sig = this->interface(iface)->create_signal<T_return, T_arg1>(name);
1061  return sig;
1062  }
1063 
1064  template <class T_return, class T_arg1,class T_arg2>
1065  DBusCxxPointer<signal<T_return, T_arg1,T_arg2> >
1066  Object::create_signal( const std::string& iface, const std::string& name )
1067  {
1068  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2> > sig;
1069  if ( not has_interface(iface) ) this->create_interface(iface);
1070  sig = this->interface(iface)->create_signal<T_return, T_arg1,T_arg2>(name);
1071  return sig;
1072  }
1073 
1074  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
1075  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3> >
1076  Object::create_signal( const std::string& iface, const std::string& name )
1077  {
1078  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2,T_arg3> > sig;
1079  if ( not has_interface(iface) ) this->create_interface(iface);
1080  sig = this->interface(iface)->create_signal<T_return, T_arg1,T_arg2,T_arg3>(name);
1081  return sig;
1082  }
1083 
1084  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
1085  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4> >
1086  Object::create_signal( const std::string& iface, const std::string& name )
1087  {
1088  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > sig;
1089  if ( not has_interface(iface) ) this->create_interface(iface);
1090  sig = this->interface(iface)->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4>(name);
1091  return sig;
1092  }
1093 
1094  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
1095  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> >
1096  Object::create_signal( const std::string& iface, const std::string& name )
1097  {
1098  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > sig;
1099  if ( not has_interface(iface) ) this->create_interface(iface);
1100  sig = this->interface(iface)->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5>(name);
1101  return sig;
1102  }
1103 
1104  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
1105  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> >
1106  Object::create_signal( const std::string& iface, const std::string& name )
1107  {
1108  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > sig;
1109  if ( not has_interface(iface) ) this->create_interface(iface);
1110  sig = this->interface(iface)->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6>(name);
1111  return sig;
1112  }
1113 
1114  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>
1115  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> >
1116  Object::create_signal( const std::string& iface, const std::string& name )
1117  {
1118  DBusCxxPointer<DBus::signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > sig;
1119  if ( not has_interface(iface) ) this->create_interface(iface);
1120  sig = this->interface(iface)->create_signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>(name);
1121  return sig;
1122  }
1123 
1124 
1125 
1126 }
1127 
1128 
1129 #endif
Object::pointer child(const std::string &name) const
Get a named child of this object.
Definition: object.cpp:241
const Children & children() const
Get the children associated with this object instance.
Definition: object.cpp:236
std::map< std::string, Object::pointer > Children
Typedef to storage structure for an Object instance's children.
Definition: object.h:137
InterfaceSignalNameConnections m_interface_signal_name_connections
Definition: object.h:677
HandlerResult
Definition: enums.h:87
virtual ~Object()
Definition: object.cpp:43
DBusCxxPointer< Interface > pointer
Typedef to smart pointers to Interface.
Definition: interface.h:61
Definition: accumulators.h:24
std::multimap< std::string, DBusCxxPointer< Interface > > Interfaces
Typedef to the storage structure for an Object instance's interfaces.
Definition: object.h:125
bool set_default_interface(const std::string &new_default_name)
Set the default interface to a specific name.
Definition: object.cpp:201
Children m_children
Definition: object.h:659
std::string introspect(int space_depth=0) const
Returns a DBus XML description of this interface.
Definition: object.cpp:270
Object(const std::string &path, PrimaryFallback pf=PRIMARY)
This class has a protected constructor.
Definition: object.cpp:31
sigc::signal< void, DBusCxxPointer< Interface > > signal_interface_added()
Signal emitted when an interface is added to this object.
Definition: object.cpp:291
Definition: enums.h:118
bool remove_child(const std::string &name)
Remove the named child from this object.
Definition: object.cpp:257
pthread_rwlock_t m_interfaces_rwlock
Definition: object.h:661
bool add_child(const std::string &name, Object::pointer child, bool force=false)
Add an object as a child with a specified name This method will fail if the object already has a chil...
Definition: object.cpp:248
void on_interface_name_changed(const std::string &oldname, const std::string &newname, DBusCxxPointer< Interface > interface)
Callback point that updates the interface name map when an interface changes its name.
Definition: object.cpp:388
bool has_child(const std::string &name) const
Test whether an object has a child with a specified name.
Definition: object.cpp:265
DBusCxxPointer< signal< T_return > > create_signal(const std::string &name)
Creates a signal with a return value (possibly void ) and 0 parameters and adds it to the default int...
Definition: object.h:957
DBusCxxPointer< Interface > interface(const std::string &name) const
Returns the first interface with the given name.
Definition: object.cpp:68
const Interfaces & interfaces() const
Get all the interfaces associated with this Object instance.
Definition: object.cpp:63
std::map< DBusCxxPointer< Interface >,sigc::connection > InterfaceSignalNameConnections
Definition: object.h:675
bool has_interface(const std::string &name)
Test whether an Object has a named interface.
Definition: object.cpp:181
virtual HandlerResult handle_message(DBusCxxPointer< Connection > conn, Message::const_pointer msg)
Handles the specified message on the specified connection.
Definition: object.cpp:306
void remove_interface(const std::string &name)
Removes the first interface found with the given name.
Definition: object.cpp:137
DBusCxxPointer< Interface > m_default_interface
Definition: object.h:667
static pointer create(const std::string &path=std::string(), PrimaryFallback pf=PRIMARY)
Creates a named Object that will register as a primary or fallback handler.
Definition: object.cpp:38
void remove_default_interface()
Removes the currently set (if any) default interface.
Definition: object.cpp:227
pthread_mutex_t m_name_mutex
Definition: object.h:663
sigc::signal< void, DBusCxxPointer< Interface > > signal_interface_removed()
Signal emitted when an interface is removed from this object.
Definition: object.cpp:296
sigc::signal< void, DBusCxxPointer< Interface > > m_signal_interface_removed
Definition: object.h:673
sigc::signal< void, DBusCxxPointer< Interface > > m_signal_interface_added
Definition: object.h:671
bool add_interface(DBusCxxPointer< Interface > interface)
Adds the interface to this object.
Definition: object.cpp:85
DBusCxxPointer< Interface > default_interface() const
Get the default interface associated with this object.
Definition: object.cpp:196
Interfaces m_interfaces
Definition: object.h:665
DBusCxxPointer< Object > pointer
Typedef to smart pointers to Object.
Definition: object.h:113
DBusCxxPointer< Method< T_return > > create_method(const std::string &method_name, sigc::slot0< T_return > slot)
Creates a method with a signature based on the.
Definition: object.h:699
sigc::signal< void, DBusCxxPointer< Interface >,DBusCxxPointer< Interface > > signal_default_interface_changed()
Signal emitted when the default interface of this object is changed.
Definition: object.cpp:301
Definition: object.h:96
DBusCxxPointer< const Message > const_pointer
Definition: message.h:62
PrimaryFallback
Definition: enums.h:116
sigc::signal< void, DBusCxxPointer< Interface >,DBusCxxPointer< Interface > > m_signal_default_interface_changed
Definition: object.h:669
virtual bool register_with_connection(DBusCxxPointer< Connection > conn)
Extends base version to include registering signals.
Definition: object.cpp:49
DBusCxxPointer< Interface > create_interface(const std::string &name)
Creates and adds the named interface to this object.
Definition: object.cpp:126

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