| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/include/dbus-cxx-0.4/dbus-cxx/ |
Upload File : |
// -*- c++ -*-
/* Do not edit! -- generated file */
#ifndef DBUSCXXOBJECTPROXY_H
#define DBUSCXXOBJECTPROXY_H
#include <sigc++/sigc++.h>
#include <string>
#include <map>
#include <dbus-cxx/signal_proxy.h>
#include <dbus-cxx/interfaceproxy.h>
namespace DBus
{
class Connection;
/**
* @example calculator_client.cpp
*
* This example is one part of three example applications that demonstrate
* client, server and watcher applications that use adapters and proxies
* generated by dbus-cxx-xml2cpp from a modified dbus introspection XML
* document.
*
* These three examples are:
* <ul>
* <li> @c calculator_server.cpp
* <li> @c calculator_client.cpp
* <li> @c calculator_watcher.cpp
* </ul>
*
* This particular piece is the client that uses the generated ObjectProxy
* derived class to call upon the calculator server to perform calculations.
*
* The client and watcher both use the same proxy generated from the XML
* document (see the calculator server example for the modified document).
*
* The proxy is generated with this command:
* @code
* dbus-cxx-xml2cpp --xml calculator.xml --proxy -f
* @endcode
*
* Here is the generated proxy file:
* @include xml2cpp/calculator/calculator_proxy.h
*
* And here is the client application:
*
*/
/**
* @example calculator_watcher.cpp
*
* This example is one part of three example applications that demonstrate
* client, server and watcher applications that use adapters and proxies
* generated by dbus-cxx-xml2cpp from a modified dbus introspection XML
* document.
*
* These three examples are:
* <ul>
* <li> @c calculator_server.cpp
* <li> @c calculator_client.cpp
* <li> @c calculator_watcher.cpp
* </ul>
*
* This particular piece is the watcher that uses the generated ObjectProxy
* derived class to observe calculation signals from the server.
*
* The client and watcher both use the same proxy generated from the XML
* document (see the calculator server example for the modified document).
*
* The proxy is generated with this command:
* @code
* dbus-cxx-xml2cpp --xml calculator.xml --proxy -f
* @endcode
*
* Here is the generated proxy file:
* @include xml2cpp/calculator/calculator_proxy.h
*
* And here is the watcher application:
*
*/
/**
* @example hal_proxy.cpp
*
* This is an example of an ObjectProxy generated by dbus-cxx-xml2cpp from a
* modified dbus introspection XML document.
*
* \par dbus-cxx-xml2cpp
*
* \par
* The command used to generate hal_manager_proxy.h from
* hal_manager_introspection.xml is:
* @code
* dbus-cxx-xml2cpp --xml hal_manager_introspection.xml --proxy -f --prefix="hal_"
* @endcode
*
* \par Modifying the DBus introspected XML
*
* \par
* dbus-cxx-xml2cpp uses a modified XML document obtained via introspection.
* In this example several attributes were added to the node tag and the
* introspection interface tag.
*
* \par
* The node tag was changed from this:
* @code
* <node>
* @endcode
* to this:
* @code
* <node gen-namespace="DBus::Hal" cppname="Manager" dest="org.freedesktop.Hal" path="/org/freedesktop/Hal/Manager" >
* @endcode
*
* \par
* The introspection interface tag had the @em ignored attribute added to
* prevent the interface from being built changing it from this:
* @code
* <interface name="org.freedesktop.DBus.Introspectable">
* @endcode
* to this:
* @code
* <interface name="org.freedesktop.DBus.Introspectable" ignored="1">
* @endcode
*
* \par Source xml
* Here is the modified xml document:
* @include xml2cpp/hal-proxy/hal_manager_introspection.xml
*
* \par Generated Proxy Object
* After running dbus-cxx-xml2cpp results in a .h file containing the definition
* of the proxy class. Here is the resulting hal_manager_proxy.h:
* @include xml2cpp/hal-proxy/hal_manager_proxy.h
*
* And finally, here is the example application that uses the proxy to watch for
* device added/removed signals.
*
*/
/**
* @defgroup proxy Proxy
*
* This group contains items that are of interest in creating local proxies
* for dbus objects, interfaces, methods and signals.
*/
/**
* Provides a mechanism for creating local proxies for objects with dbus interfaces
*
* @ingroup proxy
* @ingroup objects
* @author Rick L Vinyard Jr <rvinyard@cs.nmsu.edu>
*/
class ObjectProxy
{
protected:
ObjectProxy( DBusCxxPointer<Connection> conn, const std::string& destination, const std::string& path );
public:
typedef DBusCxxPointer<ObjectProxy> pointer;
static pointer create( const std::string& path );
static pointer create( const std::string& destination, const std::string& path );
static pointer create( DBusCxxPointer<Connection> conn, const std::string& path );
static pointer create( DBusCxxPointer<Connection> conn, const std::string& destination, const std::string& path );
virtual ~ObjectProxy();
DBusCxxPointer<Connection> connection() const;
void set_connection( DBusCxxPointer<Connection> conn );
const std::string& destination() const;
void set_destination( const std::string& destination );
const Path& path() const;
void set_path( const std::string& path );
typedef std::multimap<std::string, InterfaceProxy::pointer> Interfaces;
const Interfaces& interfaces() const;
/** Returns the first interface with the given name */
InterfaceProxy::pointer interface( const std::string& name ) const;
/** Alias for interface(name) */
InterfaceProxy::pointer operator[]( const std::string& name ) const;
/** Adds the interface to this object */
bool add_interface( InterfaceProxy::pointer interface );
/**
* Creates and adds the named interface to this object
*
* @return the newly created interface
*/
InterfaceProxy::pointer create_interface( const std::string& name );
/** Removes the first interface with the given name */
void remove_interface( const std::string& name );
/** Removes the given interface */
void remove_interface( InterfaceProxy::pointer interface );
bool has_interface( const std::string& name ) const;
bool has_interface( InterfaceProxy::pointer interface ) const;
InterfaceProxy::pointer default_interface() const;
bool set_default_interface( const std::string& new_default_name );
bool set_default_interface( InterfaceProxy::pointer new_default );
void remove_default_interface();
/** Adds the method to the named interface */
bool add_method( const std::string& interface, MethodProxyBase::pointer method );
/** Adds the method to the default interface */
bool add_method( MethodProxyBase::pointer method );
CallMessage::pointer create_call_message( const std::string& interface_name, const std::string& method_name ) const;
CallMessage::pointer create_call_message( const std::string& method_name ) const;
ReturnMessage::const_pointer call( CallMessage::const_pointer, int timeout_milliseconds=-1 ) const;
PendingCall::pointer call_async( CallMessage::const_pointer, int timeout_milliseconds=-1 ) const;
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>
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 )
{
InterfaceProxy::pointer interface = this->interface(interface_name);
if ( not interface ) interface = this->create_interface( interface_name );
return interface->create_method<T_return,T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>(method_name);
}
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>
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 )
{
InterfaceProxy::pointer interface = this->interface(interface_name);
if ( not interface ) interface = this->create_interface( interface_name );
return interface->create_signal<T_return,T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>(sig_name);
}
sigc::signal<void,InterfaceProxy::pointer> signal_interface_added();
sigc::signal<void,InterfaceProxy::pointer> signal_interface_removed();
sigc::signal<void,InterfaceProxy::pointer/*old default*/,InterfaceProxy::pointer/*new default*/> signal_default_interface_changed();
protected:
DBusCxxPointer<Connection> m_connection;
std::string m_destination;
Path m_path;
mutable pthread_rwlock_t m_interfaces_rwlock;
pthread_mutex_t m_name_mutex;
Interfaces m_interfaces;
InterfaceProxy::pointer m_default_interface;
sigc::signal<void,InterfaceProxy::pointer,InterfaceProxy::pointer> m_signal_default_interface_changed;
sigc::signal<void,InterfaceProxy::pointer> m_signal_interface_added;
sigc::signal<void,InterfaceProxy::pointer> m_signal_interface_removed;
typedef std::map<InterfaceProxy::pointer,sigc::connection> InterfaceSignalNameConnections;
InterfaceSignalNameConnections m_interface_signal_name_connections;
void on_interface_name_changed(const std::string& oldname, const std::string& newname, InterfaceProxy::pointer interface);
};
}
#endif