dbus-cxx logo
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
DBus::Object Class Reference

#include <object.h>

Inherits DBus::ObjectPathHandler.

Public Types

typedef DBusCxxPointer< Objectpointer
 Typedef to smart pointers to Object. More...
 
typedef std::multimap
< std::string, DBusCxxPointer
< Interface > > 
Interfaces
 Typedef to the storage structure for an Object instance's interfaces. More...
 
typedef std::map< std::string,
Object::pointer
Children
 Typedef to storage structure for an Object instance's children. More...
 

Public Member Functions

virtual ~Object ()
 
virtual bool register_with_connection (DBusCxxPointer< Connection > conn)
 Extends base version to include registering signals. More...
 
const Interfacesinterfaces () const
 Get all the interfaces associated with this Object instance. More...
 
DBusCxxPointer< Interfaceinterface (const std::string &name) const
 Returns the first interface with the given name. More...
 
bool add_interface (DBusCxxPointer< Interface > interface)
 Adds the interface to this object. More...
 
DBusCxxPointer< Interfacecreate_interface (const std::string &name)
 Creates and adds the named interface to this object. More...
 
template<class T_return >
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. More...
 
template<class T_return , class T_arg1 >
DBusCxxPointer< Method
< T_return, T_arg1 > > 
create_method (const std::string &method_name, sigc::slot1< T_return, T_arg1 > slot)
 Creates a method with a signature based on the. More...
 
template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer< Method
< T_return, T_arg1, T_arg2 > > 
create_method (const std::string &method_name, sigc::slot2< T_return, T_arg1, T_arg2 > slot)
 Creates a method with a signature based on the. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 >
DBusCxxPointer< Method
< T_return, T_arg1, T_arg2,
T_arg3 > > 
create_method (const std::string &method_name, sigc::slot3< T_return, T_arg1, T_arg2, T_arg3 > slot)
 Creates a method with a signature based on the. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 >
DBusCxxPointer< Method
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4 > > 
create_method (const std::string &method_name, sigc::slot4< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > slot)
 Creates a method with a signature based on the. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 >
DBusCxxPointer< Method
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4, T_arg5 > > 
create_method (const std::string &method_name, sigc::slot5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > slot)
 Creates a method with a signature based on the. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_arg6 >
DBusCxxPointer< Method
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4, T_arg5, T_arg6 > > 
create_method (const std::string &method_name, sigc::slot6< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > slot)
 Creates a method with a signature based on the. More...
 
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 >
DBusCxxPointer< Method
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4, T_arg5, T_arg6,
T_arg7 > > 
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)
 Creates a method with a signature based on the. More...
 
template<class T_return >
DBusCxxPointer< Method
< T_return > > 
create_method (const std::string &interface_name, const std::string &method_name, sigc::slot0< T_return > slot)
 Creates a method with a signature based on the. More...
 
template<class T_return , class T_arg1 >
DBusCxxPointer< Method
< T_return, T_arg1 > > 
create_method (const std::string &interface_name, const std::string &method_name, sigc::slot1< T_return, T_arg1 > slot)
 Creates a method with a signature based on the. More...
 
template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer< Method
< T_return, T_arg1, T_arg2 > > 
create_method (const std::string &interface_name, const std::string &method_name, sigc::slot2< T_return, T_arg1, T_arg2 > slot)
 Creates a method with a signature based on the. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 >
DBusCxxPointer< Method
< T_return, T_arg1, T_arg2,
T_arg3 > > 
create_method (const std::string &interface_name, const std::string &method_name, sigc::slot3< T_return, T_arg1, T_arg2, T_arg3 > slot)
 Creates a method with a signature based on the. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 >
DBusCxxPointer< Method
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4 > > 
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)
 Creates a method with a signature based on the. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 >
DBusCxxPointer< Method
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4, T_arg5 > > 
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)
 Creates a method with a signature based on the. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_arg6 >
DBusCxxPointer< Method
< 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, sigc::slot6< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > slot)
 Creates a method with a signature based on the. More...
 
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 >
DBusCxxPointer< Method
< 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, sigc::slot7< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > slot)
 Creates a method with a signature based on the. More...
 
void remove_interface (const std::string &name)
 Removes the first interface found with the given name. More...
 
bool has_interface (const std::string &name)
 Test whether an Object has a named interface. More...
 
DBusCxxPointer< Interfacedefault_interface () const
 Get the default interface associated with this object. More...
 
bool set_default_interface (const std::string &new_default_name)
 Set the default interface to a specific name. More...
 
void remove_default_interface ()
 Removes the currently set (if any) default interface. More...
 
template<class T_return >
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 interface. More...
 
template<class T_return , class T_arg1 >
DBusCxxPointer< signal
< T_return, T_arg1 > > 
create_signal (const std::string &name)
 Creates a signal with a return value (possibly void ) and 1 parameters and adds it to the default interface. More...
 
template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2 > > 
create_signal (const std::string &name)
 Creates a signal with a return value (possibly void ) and 2 parameters and adds it to the default interface. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2,
T_arg3 > > 
create_signal (const std::string &name)
 Creates a signal with a return value (possibly void ) and 3 parameters and adds it to the default interface. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4 > > 
create_signal (const std::string &name)
 Creates a signal with a return value (possibly void ) and 4 parameters and adds it to the default interface. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4, T_arg5 > > 
create_signal (const std::string &name)
 Creates a signal with a return value (possibly void ) and 5 parameters and adds it to the default interface. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_arg6 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4, T_arg5, T_arg6 > > 
create_signal (const std::string &name)
 Creates a signal with a return value (possibly void ) and 6 parameters and adds it to the default interface. More...
 
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 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4, T_arg5, T_arg6,
T_arg7 > > 
create_signal (const std::string &name)
 Creates a signal with a return value (possibly void ) and 7 parameters and adds it to the default interface. More...
 
template<class T_return >
DBusCxxPointer< signal
< T_return > > 
create_signal (const std::string &iface, const std::string &name)
 Creates a signal with a return value (possibly void ) and 0 parameters and adds it to the named interface. More...
 
template<class T_return , class T_arg1 >
DBusCxxPointer< signal
< T_return, T_arg1 > > 
create_signal (const std::string &iface, const std::string &name)
 Creates a signal with a return value (possibly void ) and 1 parameters and adds it to the named interface. More...
 
template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2 > > 
create_signal (const std::string &iface, const std::string &name)
 Creates a signal with a return value (possibly void ) and 2 parameters and adds it to the named interface. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2,
T_arg3 > > 
create_signal (const std::string &iface, const std::string &name)
 Creates a signal with a return value (possibly void ) and 3 parameters and adds it to the named interface. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4 > > 
create_signal (const std::string &iface, const std::string &name)
 Creates a signal with a return value (possibly void ) and 4 parameters and adds it to the named interface. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4, T_arg5 > > 
create_signal (const std::string &iface, const std::string &name)
 Creates a signal with a return value (possibly void ) and 5 parameters and adds it to the named interface. More...
 
template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_arg6 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4, T_arg5, T_arg6 > > 
create_signal (const std::string &iface, const std::string &name)
 Creates a signal with a return value (possibly void ) and 6 parameters and adds it to the named interface. More...
 
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 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4, T_arg5, T_arg6,
T_arg7 > > 
create_signal (const std::string &iface, const std::string &name)
 Creates a signal with a return value (possibly void ) and 7 parameters and adds it to the named interface. More...
 
const Childrenchildren () const
 Get the children associated with this object instance. More...
 
Object::pointer child (const std::string &name) const
 Get a named child of this object. More...
 
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 child with the specified name and force is not set. More...
 
bool remove_child (const std::string &name)
 Remove the named child from this object. More...
 
bool has_child (const std::string &name) const
 Test whether an object has a child with a specified name. More...
 
std::string introspect (int space_depth=0) const
 Returns a DBus XML description of this interface. More...
 
sigc::signal< void,
DBusCxxPointer< Interface > > 
signal_interface_added ()
 Signal emitted when an interface is added to this object. More...
 
sigc::signal< void,
DBusCxxPointer< Interface > > 
signal_interface_removed ()
 Signal emitted when an interface is removed from this object. More...
 
sigc::signal< void,
DBusCxxPointer< Interface >
,DBusCxxPointer< Interface > > 
signal_default_interface_changed ()
 Signal emitted when the default interface of this object is changed. More...
 
virtual HandlerResult handle_message (DBusCxxPointer< Connection > conn, Message::const_pointer msg)
 Handles the specified message on the specified connection. More...
 

Static Public Member Functions

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. More...
 

Protected Types

typedef std::map
< DBusCxxPointer< Interface >
,sigc::connection > 
InterfaceSignalNameConnections
 

Protected Member Functions

 Object (const std::string &path, PrimaryFallback pf=PRIMARY)
 This class has a protected constructor. More...
 
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. More...
 

Protected Attributes

Children m_children
 
pthread_rwlock_t m_interfaces_rwlock
 
pthread_mutex_t m_name_mutex
 
Interfaces m_interfaces
 
DBusCxxPointer< Interfacem_default_interface
 
sigc::signal< void,
DBusCxxPointer< Interface >
,DBusCxxPointer< Interface > > 
m_signal_default_interface_changed
 
sigc::signal< void,
DBusCxxPointer< Interface > > 
m_signal_interface_added
 
sigc::signal< void,
DBusCxxPointer< Interface > > 
m_signal_interface_removed
 
InterfaceSignalNameConnections m_interface_signal_name_connections
 

Detailed Description

Todo:
TODO rethink whether it might be beneficial to have multiple connections for one object
Author
Rick L Vinyard Jr rviny.nosp@m.ard@.nosp@m.cs.nm.nosp@m.su.e.nosp@m.du
Examples:
calculator_server.cpp, callee_object_inherited.cpp, and signal_emitter_object.cpp.

Member Typedef Documentation

typedef std::map<std::string, Object::pointer> DBus::Object::Children

Typedef to storage structure for an Object instance's children.

The key is the child's name and the value

Data Structure - map: an object's children must be uniquely named Key - child name Value -smart pointer to a child object.

Can access type as Object::Children

typedef std::multimap<std::string, DBusCxxPointer<Interface> > DBus::Object::Interfaces

Typedef to the storage structure for an Object instance's interfaces.

Data Structure - Multimap: There is no restriction that interfaces must be uniquely named Key - interface name Value -smart pointer to an interface.

Can access type as Object::Interfaces

typedef std::map<DBusCxxPointer<Interface> ,sigc::connection> DBus::Object::InterfaceSignalNameConnections
protected
typedef DBusCxxPointer<Object> DBus::Object::pointer

Typedef to smart pointers to Object.

Can access type as Object::pointer

Examples:
callee_object_inherited.cpp, and signal_emitter_object.cpp.

Constructor & Destructor Documentation

DBus::Object::Object ( const std::string &  path,
PrimaryFallback  pf = PRIMARY 
)
protected

This class has a protected constructor.

Use the create() methods to obtain a smart pointer to a new instance.

References m_interfaces_rwlock, and m_name_mutex.

Referenced by create().

DBus::Object::~Object ( )
virtual

Member Function Documentation

bool DBus::Object::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 child with the specified name and force is not set.

Returns
True if the child was successfully added, false otherwise.
Parameters
nameThe name to use for the child.
childA smart pointer to an object to add as a child.
forceIf true a child with the same name will be replaced.

References child(), has_child(), and m_children.

bool DBus::Object::add_interface ( DBusCxxPointer< Interface interface)
Object::pointer DBus::Object::child ( const std::string &  name) const

Get a named child of this object.

Returns
A smart pointer to a child with the specified name, or a null smart pointer if no child found.
Parameters
nameThe name of the child to return

References m_children.

Referenced by add_child().

const Object::Children & DBus::Object::children ( ) const

Get the children associated with this object instance.

References m_children.

Object::pointer DBus::Object::create ( const std::string &  path = std::string(),
PrimaryFallback  pf = PRIMARY 
)
static

Creates a named Object that will register as a primary or fallback handler.

Parameters
pathThe path the object will handle
pfDetermines whether the Object will registar as a primary or fallback handler (default = PRIMARY)
Examples:
callee_object_inherited.cpp, and signal_emitter_object.cpp.

References Object().

Referenced by DBus::Connection::create_object().

Interface::pointer DBus::Object::create_interface ( const std::string &  name)

Creates and adds the named interface to this object.

Returns
the newly created interface

References add_interface(), DBus::Interface::create(), and interface().

Referenced by create_method(), and create_signal().

template<class T_return >
DBusCxxPointer< Method< T_return > > DBus::Object::create_method ( const std::string &  method_name,
sigc::slot0< T_return >  slot 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the default interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References create_interface(), m_default_interface, and set_default_interface().

template<class T_return , class T_arg1 >
DBusCxxPointer< Method< T_return, T_arg1 > > DBus::Object::create_method ( const std::string &  method_name,
sigc::slot1< T_return, T_arg1 >  slot 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the default interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References create_interface(), m_default_interface, and set_default_interface().

template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2 > > DBus::Object::create_method ( const std::string &  method_name,
sigc::slot2< T_return, T_arg1, T_arg2 >  slot 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the default interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References create_interface(), m_default_interface, and set_default_interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2, T_arg3 > > DBus::Object::create_method ( const std::string &  method_name,
sigc::slot3< T_return, T_arg1, T_arg2, T_arg3 >  slot 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the default interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References create_interface(), m_default_interface, and set_default_interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > DBus::Object::create_method ( const std::string &  method_name,
sigc::slot4< T_return, T_arg1, T_arg2, T_arg3, T_arg4 >  slot 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the default interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References create_interface(), m_default_interface, and set_default_interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > DBus::Object::create_method ( const std::string &  method_name,
sigc::slot5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 >  slot 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the default interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References create_interface(), m_default_interface, and set_default_interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_arg6 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > DBus::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 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the default interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References create_interface(), m_default_interface, and set_default_interface().

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 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > DBus::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 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the default interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References create_interface(), m_default_interface, and set_default_interface().

template<class T_return >
DBusCxxPointer< Method< T_return > > DBus::Object::create_method ( const std::string &  interface_name,
const std::string &  method_name,
sigc::slot0< T_return >  slot 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the named interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References interface().

template<class T_return , class T_arg1 >
DBusCxxPointer< Method< T_return, T_arg1 > > DBus::Object::create_method ( const std::string &  interface_name,
const std::string &  method_name,
sigc::slot1< T_return, T_arg1 >  slot 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the named interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References interface().

template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2 > > DBus::Object::create_method ( const std::string &  interface_name,
const std::string &  method_name,
sigc::slot2< T_return, T_arg1, T_arg2 >  slot 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the named interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2, T_arg3 > > DBus::Object::create_method ( const std::string &  interface_name,
const std::string &  method_name,
sigc::slot3< T_return, T_arg1, T_arg2, T_arg3 >  slot 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the named interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > DBus::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 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the named interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > DBus::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 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the named interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_arg6 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > DBus::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 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the named interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References interface().

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 >
DBusCxxPointer< Method< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > DBus::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 
)

Creates a method with a signature based on the.

Parameters
slotparameter signature and adds it to the named interface
Returns
A smart pointer to the newly created method
Parameters
slotThis slot will be called with the given signature when the method is invoked

Template parameters of the sigc::slot will determine the signature of the method created.

References interface().

template<class T_return >
DBusCxxPointer< signal< T_return > > DBus::Object::create_signal ( const std::string &  name)

Creates a signal with a return value (possibly void ) and 0 parameters and adds it to the default interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), and default_interface().

template<class T_return , class T_arg1 >
DBusCxxPointer< signal< T_return, T_arg1 > > DBus::Object::create_signal ( const std::string &  name)

Creates a signal with a return value (possibly void ) and 1 parameters and adds it to the default interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), and default_interface().

template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2 > > DBus::Object::create_signal ( const std::string &  name)

Creates a signal with a return value (possibly void ) and 2 parameters and adds it to the default interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), and default_interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3 > > DBus::Object::create_signal ( const std::string &  name)

Creates a signal with a return value (possibly void ) and 3 parameters and adds it to the default interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), and default_interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > DBus::Object::create_signal ( const std::string &  name)

Creates a signal with a return value (possibly void ) and 4 parameters and adds it to the default interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), and default_interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > DBus::Object::create_signal ( const std::string &  name)

Creates a signal with a return value (possibly void ) and 5 parameters and adds it to the default interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), and default_interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_arg6 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > DBus::Object::create_signal ( const std::string &  name)

Creates a signal with a return value (possibly void ) and 6 parameters and adds it to the default interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), and default_interface().

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 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > DBus::Object::create_signal ( const std::string &  name)

Creates a signal with a return value (possibly void ) and 7 parameters and adds it to the default interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), and default_interface().

template<class T_return >
DBusCxxPointer< signal< T_return > > DBus::Object::create_signal ( const std::string &  iface,
const std::string &  name 
)

Creates a signal with a return value (possibly void ) and 0 parameters and adds it to the named interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), has_interface(), and interface().

template<class T_return , class T_arg1 >
DBusCxxPointer< signal< T_return, T_arg1 > > DBus::Object::create_signal ( const std::string &  iface,
const std::string &  name 
)

Creates a signal with a return value (possibly void ) and 1 parameters and adds it to the named interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), has_interface(), and interface().

template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2 > > DBus::Object::create_signal ( const std::string &  iface,
const std::string &  name 
)

Creates a signal with a return value (possibly void ) and 2 parameters and adds it to the named interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), has_interface(), and interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3 > > DBus::Object::create_signal ( const std::string &  iface,
const std::string &  name 
)

Creates a signal with a return value (possibly void ) and 3 parameters and adds it to the named interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), has_interface(), and interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > DBus::Object::create_signal ( const std::string &  iface,
const std::string &  name 
)

Creates a signal with a return value (possibly void ) and 4 parameters and adds it to the named interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), has_interface(), and interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > DBus::Object::create_signal ( const std::string &  iface,
const std::string &  name 
)

Creates a signal with a return value (possibly void ) and 5 parameters and adds it to the named interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), has_interface(), and interface().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 , class T_arg4 , class T_arg5 , class T_arg6 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > DBus::Object::create_signal ( const std::string &  iface,
const std::string &  name 
)

Creates a signal with a return value (possibly void ) and 6 parameters and adds it to the named interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), has_interface(), and interface().

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 >
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > DBus::Object::create_signal ( const std::string &  iface,
const std::string &  name 
)

Creates a signal with a return value (possibly void ) and 7 parameters and adds it to the named interface.

Returns
A smart pointer to the newly created signal

Template parameters for the create_signal() call will determine the signature of the signal created.

References create_interface(), has_interface(), and interface().

Interface::pointer DBus::Object::default_interface ( ) const

Get the default interface associated with this object.

Returns
The default interface, or a null smart pointer if no default is set

References m_default_interface.

Referenced by create_signal().

HandlerResult DBus::Object::handle_message ( DBusCxxPointer< Connection conn,
Message::const_pointer  msg 
)
virtual

Handles the specified message on the specified connection.

If msg is an introspection message, the object will rely on its introspection() method to provide a reply.

Looks for interfaces specified in the message first. If the message does not specify an interface or the specified interface is not found the default interface will be used.

If the specified interface is found, all matching interfaces will be tried until an interface handler returns HANDLED. Once an interface returns HANDLED no further interfaces will be tried.

If no interface returns HANDLED the default interface (if one is set) will be tried.

Returns
HANDLED if this object handled the message, NOT_HANDLED otherwise
Parameters
connThe Connection to send the reply message on
msgThe message to handle; must be a CallMessage or it will not be handled

Reimplemented from DBus::MessageHandler.

References DBus::CallMessage::create(), DBUS_CXX_INTROSPECTABLE_INTERFACE, DBus::HANDLED, interface(), introspect(), m_default_interface, m_interfaces, m_interfaces_rwlock, and DBus::NOT_HANDLED.

bool DBus::Object::has_child ( const std::string &  name) const

Test whether an object has a child with a specified name.

Returns
True if the object has the named child, false otherwise.
Parameters
nameThe name of the child to test.

References m_children.

Referenced by add_child().

bool DBus::Object::has_interface ( const std::string &  name)

Test whether an Object has a named interface.

Returns
True if the object has the named interface, false otherwise
Parameters
nameThe name of the interface to look for

References m_interfaces, and m_interfaces_rwlock.

Referenced by create_signal().

Interface::pointer DBus::Object::interface ( const std::string &  name) const
const Object::Interfaces & DBus::Object::interfaces ( ) const

Get all the interfaces associated with this Object instance.

References m_interfaces.

std::string DBus::Object::introspect ( int  space_depth = 0) const

Returns a DBus XML description of this interface.

References DBUS_CXX_INTROSPECTABLE_INTERFACE, m_children, and m_interfaces.

Referenced by handle_message().

void DBus::Object::on_interface_name_changed ( const std::string &  oldname,
const std::string &  newname,
DBusCxxPointer< Interface interface 
)
protected

Callback point that updates the interface name map when an interface changes its name.

References interface(), m_interface_signal_name_connections, m_interfaces, and m_interfaces_rwlock.

Referenced by add_interface().

bool DBus::Object::register_with_connection ( DBusCxxPointer< Connection conn)
virtual

Extends base version to include registering signals.

References m_children, and m_interfaces.

bool DBus::Object::remove_child ( const std::string &  name)

Remove the named child from this object.

Returns
True if the child was found and removed, false if no child by the name was found to remove.
Parameters
nameThe name of the child to remove.

References m_children.

void DBus::Object::remove_default_interface ( )

Removes the currently set (if any) default interface.

There wil not be a default interface set.

References m_default_interface, and m_signal_default_interface_changed.

void DBus::Object::remove_interface ( const std::string &  name)
bool DBus::Object::set_default_interface ( const std::string &  new_default_name)

Set the default interface to a specific name.

The first interface found with a matching name is used. If there is already a default interface set it will be replaced.

Returns
True if an interface with the specified name was found, false otherwise.
Parameters
new_default_nameThe name of the interface to use as the default.

References m_default_interface, m_interfaces, m_interfaces_rwlock, and m_signal_default_interface_changed.

Referenced by add_interface(), and create_method().

sigc::signal< void, Interface::pointer, Interface::pointer > DBus::Object::signal_default_interface_changed ( )

Signal emitted when the default interface of this object is changed.

The first parameter of the callback is a pointer to the old default interface, and the second parameter is a callback to the new default interface.

References m_signal_default_interface_changed.

sigc::signal< void, Interface::pointer > DBus::Object::signal_interface_added ( )

Signal emitted when an interface is added to this object.

The first parameter of the callback is a pointer to the newly added interface.

References m_signal_interface_added.

sigc::signal< void, Interface::pointer > DBus::Object::signal_interface_removed ( )

Signal emitted when an interface is removed from this object.

The first parameter of the callback is a pointer to the removed interface.

References m_signal_interface_removed.

Member Data Documentation

Children DBus::Object::m_children
protected
DBusCxxPointer<Interface> DBus::Object::m_default_interface
protected
InterfaceSignalNameConnections DBus::Object::m_interface_signal_name_connections
protected
Interfaces DBus::Object::m_interfaces
protected
pthread_rwlock_t DBus::Object::m_interfaces_rwlock
mutableprotected
pthread_mutex_t DBus::Object::m_name_mutex
protected

Referenced by Object(), and ~Object().

sigc::signal<void,DBusCxxPointer<Interface> ,DBusCxxPointer<Interface> > DBus::Object::m_signal_default_interface_changed
protected
sigc::signal<void,DBusCxxPointer<Interface> > DBus::Object::m_signal_interface_added
protected
sigc::signal<void,DBusCxxPointer<Interface> > DBus::Object::m_signal_interface_removed
protected

The documentation for this class was generated from the following files:

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