dbus-cxx logo

DBus::Object Class Reference
[Local ObjectsObjects]

#include <object.h>

Inherits DBus::ObjectPathHandler.

List of all members.

Public Types

typedef DBusCxxPointer< Objectpointer
typedef std::multimap
< std::string,
Interface::pointer
Interfaces
typedef std::map< std::string,
Object::pointer
Children

Public Member Functions

virtual ~Object ()
virtual bool register_with_connection (DBusCxxPointer< Connection > conn)
 Extends base version to include registering signals.
const Interfacesinterfaces () const
Interface::pointer interface (const std::string &name) const
 Returns the first interface with the given name.
bool add_interface (Interface::pointer interface)
 Adds the interface to this object.
Interface::pointer create_interface (const std::string &name)
 Creates and adds the named interface to this object.
template<class T_return >
DBusCxxPointer< Method
< T_return > > 
create_method (const std::string &method_name, sigc::slot0< T_return > slot)
 Creates a method with the given signature and adds it to the default interface.
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 the given signature and adds it to the default interface.
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 the given signature and adds it to the 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 > > 
create_method (const std::string &method_name, sigc::slot3< T_return, T_arg1, T_arg2, T_arg3 > slot)
 Creates a method with the given signature and adds it to the 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 > > 
create_method (const std::string &method_name, sigc::slot4< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > slot)
 Creates a method with the given signature and adds it to the 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 > > 
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 the given signature and adds it to the 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 > > 
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 the given signature and adds it to the 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 > > 
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 the given signature and adds it to the default interface.
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)
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)
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)
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)
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)
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)
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)
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)
void remove_interface (const std::string &name)
 Removes the first interface with the given name.
bool has_interface (const std::string &name)
Interface::pointer default_interface () const
bool set_default_interface (const std::string &new_default_name)
void remove_default_interface ()
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
< T_return, T_arg1, T_arg2,
T_arg3, T_arg4, T_arg5, T_arg6,
T_arg7 > > 
create_signal (const std::string &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
< 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)
const Childrenchildren () const
Object::pointer child (const std::string &name) const
bool add_child (const std::string &name, Object::pointer child)
bool remove_child (const std::string &name)
bool has_child (const std::string &name) const
std::string introspect (int space_depth=0) const
 Returns a DBus XML description of this interface.
sigc::signal< void,
Interface::pointer
signal_interface_added ()
sigc::signal< void,
Interface::pointer
signal_interface_removed ()
sigc::signal< void,
Interface::pointer,
Interface::pointer
signal_default_interface_changed ()
virtual HandlerResult handle_message (DBusCxxPointer< Connection >, Message::const_pointer)

Static Public Member Functions

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

Protected Types

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

Protected Member Functions

 Object (const std::string &path, PrimaryFallback pf=PRIMARY)
void on_interface_name_changed (const std::string &oldname, const std::string &newname, Interface::pointer interface)

Protected Attributes

Children m_children
pthread_rwlock_t m_interfaces_rwlock
pthread_mutex_t m_name_mutex
Interfaces m_interfaces
Interface::pointer m_default_interface
sigc::signal< void,
Interface::pointer,
Interface::pointer
m_signal_default_interface_changed
sigc::signal< void,
Interface::pointer
m_signal_interface_added
sigc::signal< void,
Interface::pointer
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 <rvinyard@cs.nmsu.edu>
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 std::multimap<std::string, Interface::pointer> DBus::Object::Interfaces
typedef std::map<Interface::pointer,sigc::connection> DBus::Object::InterfaceSignalNameConnections [protected]
typedef DBusCxxPointer<Object> DBus::Object::pointer

Reimplemented from DBus::MessageHandler.

Examples:
callee.cpp, callee_2.cpp, and callee_object.cpp.

Constructor & Destructor Documentation

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

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 
)

References has_child(), and m_children.

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

References m_children.

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

References m_children.

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

References Object().

Referenced by create_interface().

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(), create(), and interface().

Referenced by create_method(), and create_signal().

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 
) [inline]

References create_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<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 
) [inline]

References create_interface(), and 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 
) [inline]

References create_interface(), and 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 
) [inline]

References create_interface(), and 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 
) [inline]

References create_interface(), and 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 
) [inline]

References create_interface(), and 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 
) [inline]

References create_interface(), and 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 
) [inline]

References create_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<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 
) [inline]

Creates a method with the given signature and adds it to the default interface.

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 
) [inline]

Creates a method with the given signature and adds it to the default interface.

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 
) [inline]

Creates a method with the given signature and adds it to the default interface.

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 
) [inline]

Creates a method with the given signature and adds it to the default interface.

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 
) [inline]

Creates a method with the given signature and adds it to the default interface.

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 
) [inline]

Creates a method with the given signature and adds it to the default interface.

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 
) [inline]

Creates a method with the given signature and adds it to the default interface.

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 &  method_name,
sigc::slot0< T_return >  slot 
) [inline]

Creates a method with the given signature and adds it to the default interface.

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

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<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 
) [inline]
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<T_return,T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > DBus::Object::create_signal ( const std::string &  name  )  [inline]
Interface::pointer DBus::Object::default_interface (  )  const

References m_default_interface.

Referenced by create_signal().

virtual HandlerResult DBus::Object::handle_message ( DBusCxxPointer< Connection ,
Message::const_pointer   
) [virtual]

Reimplemented from DBus::MessageHandler.

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

References m_children.

Referenced by add_child().

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

References m_interfaces, and m_interfaces_rwlock.

Referenced by create_signal().

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

Returns the first interface with the given name.

References m_interfaces, and m_interfaces_rwlock.

Referenced by create_interface(), create_method(), create_signal(), and remove_interface().

const Object::Interfaces & DBus::Object::interfaces (  )  const

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.

void DBus::Object::on_interface_name_changed ( const std::string &  oldname,
const std::string &  newname,
Interface::pointer  interface 
) [protected]
virtual bool DBus::Object::register_with_connection ( DBusCxxPointer< Connection conn  )  [virtual]

Extends base version to include registering signals.

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

References m_children.

void DBus::Object::remove_default_interface (  ) 
void DBus::Object::remove_interface ( const std::string &  name  ) 
bool DBus::Object::set_default_interface ( const std::string &  new_default_name  ) 
sigc::signal< void, Interface::pointer, Interface::pointer > DBus::Object::signal_default_interface_changed (  ) 
sigc::signal< void, Interface::pointer > DBus::Object::signal_interface_added (  ) 
sigc::signal< void, Interface::pointer > DBus::Object::signal_interface_removed (  ) 

Member Data Documentation

pthread_rwlock_t DBus::Object::m_interfaces_rwlock [mutable, protected]
pthread_mutex_t DBus::Object::m_name_mutex [protected]

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


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

Generated on Mon Sep 21 11:00:15 2009 for dbus-cxx by doxygen 1.6.1