dbus-cxx logo

objectproxy.h

Go to the documentation of this file.
00001 
00002 // -*- c++ -*-
00003 /* Do not edit! -- generated file */
00004 
00005 #ifndef DBUSCXXOBJECTPROXY_H
00006 #define DBUSCXXOBJECTPROXY_H
00007 
00008 #include <sigc++/sigc++.h>
00009 
00010 #include <string>
00011 #include <map>
00012 
00013 #include <dbus-cxx/signal_proxy.h>
00014 #include <dbus-cxx/interfaceproxy.h>
00015 
00016 namespace DBus
00017 {
00018 
00019   class Connection;
00020 
00158   class ObjectProxy
00159   {
00160     protected:
00161 
00162       ObjectProxy( DBusCxxPointer<Connection> conn, const std::string& destination, const std::string& path );
00163 
00164     public:
00165 
00166       typedef DBusCxxPointer<ObjectProxy> pointer;
00167 
00168       static pointer create( const std::string& path );
00169 
00170       static pointer create( const std::string& destination, const std::string& path );
00171 
00172       static pointer create( DBusCxxPointer<Connection> conn, const std::string& path );
00173 
00174       static pointer create( DBusCxxPointer<Connection> conn, const std::string& destination, const std::string& path );
00175 
00176       virtual ~ObjectProxy();
00177 
00178       DBusCxxPointer<Connection> connection() const;
00179 
00180       void set_connection( DBusCxxPointer<Connection> conn );
00181 
00182       const std::string& destination() const;
00183 
00184       void set_destination( const std::string& destination );
00185 
00186       const Path& path() const;
00187 
00188       void set_path( const std::string& path );
00189 
00190       typedef std::multimap<std::string, InterfaceProxy::pointer> Interfaces;
00191 
00192       const Interfaces& interfaces() const;
00193 
00195       InterfaceProxy::pointer interface( const std::string& name ) const;
00196 
00198       InterfaceProxy::pointer operator[]( const std::string& name ) const;
00199 
00201       bool add_interface( InterfaceProxy::pointer interface );
00202 
00208       InterfaceProxy::pointer create_interface( const std::string& name );
00209 
00211       void remove_interface( const std::string& name );
00212 
00214       void remove_interface( InterfaceProxy::pointer interface );
00215 
00216       bool has_interface( const std::string& name ) const;
00217 
00218       bool has_interface( InterfaceProxy::pointer interface ) const;
00219 
00220       InterfaceProxy::pointer default_interface() const;
00221 
00222       bool set_default_interface( const std::string& new_default_name );
00223 
00224       bool set_default_interface( InterfaceProxy::pointer new_default );
00225 
00226       void remove_default_interface();
00227 
00229       bool add_method( const std::string& interface, MethodProxyBase::pointer method );
00230 
00232       bool add_method( MethodProxyBase::pointer method );
00233 
00234       CallMessage::pointer create_call_message( const std::string& interface_name, const std::string& method_name ) const;
00235 
00236       CallMessage::pointer create_call_message( const std::string& method_name ) const;
00237 
00238       ReturnMessage::const_pointer call( CallMessage::const_pointer, int timeout_milliseconds=-1 ) const;
00239 
00240       PendingCall::pointer call_async( CallMessage::const_pointer, int timeout_milliseconds=-1 ) const;
00241 
00242       template <class T_return, class T_arg1=nil, class T_arg2=nil, class T_arg3=nil, class T_arg4=nil, class T_arg5=nil, class T_arg6=nil, class T_arg7=nil>
00243       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 )
00244       {
00245         InterfaceProxy::pointer interface = this->interface(interface_name);
00246         if ( not interface ) interface = this->create_interface( interface_name );
00247         return interface->create_method<T_return,T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>(method_name);
00248       }
00249 
00250       template <class T_return, class T_arg1=nil, class T_arg2=nil, class T_arg3=nil, class T_arg4=nil, class T_arg5=nil, class T_arg6=nil, class T_arg7=nil>
00251       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 )
00252       {
00253         InterfaceProxy::pointer interface = this->interface(interface_name);
00254         if ( not interface ) interface = this->create_interface( interface_name );
00255         return interface->create_signal<T_return,T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>(sig_name);
00256       }
00257 
00258 
00259       
00260       sigc::signal<void,InterfaceProxy::pointer> signal_interface_added();
00261 
00262       sigc::signal<void,InterfaceProxy::pointer> signal_interface_removed();
00263 
00264       sigc::signal<void,InterfaceProxy::pointer/*old default*/,InterfaceProxy::pointer/*new default*/> signal_default_interface_changed();
00265 
00266     protected:
00267 
00268       DBusCxxPointer<Connection> m_connection;
00269 
00270       std::string m_destination;
00271 
00272       Path m_path;
00273       
00274       mutable pthread_rwlock_t m_interfaces_rwlock;
00275 
00276       pthread_mutex_t m_name_mutex;
00277 
00278       Interfaces m_interfaces;
00279 
00280       InterfaceProxy::pointer m_default_interface;
00281 
00282       sigc::signal<void,InterfaceProxy::pointer,InterfaceProxy::pointer> m_signal_default_interface_changed;
00283 
00284       sigc::signal<void,InterfaceProxy::pointer> m_signal_interface_added;
00285 
00286       sigc::signal<void,InterfaceProxy::pointer> m_signal_interface_removed;
00287 
00288       typedef std::map<InterfaceProxy::pointer,sigc::connection> InterfaceSignalNameConnections;
00289 
00290       InterfaceSignalNameConnections m_interface_signal_name_connections;
00291 
00292       void on_interface_name_changed(const std::string& oldname, const std::string& newname, InterfaceProxy::pointer interface);
00293 
00294   };
00295 
00296 }
00297 
00298 #endif

Generated on Fri Jun 26 15:50:38 2009 for dbus-cxx by doxygen 1.5.8