dbus-cxx logo

DBus::Interface Class Reference
[ObjectsLocal Objects]

#include <interface.h>

List of all members.

Public Types

typedef DBusCxxPointer< Interfacepointer
typedef DBusCxxWeakPointer
< Interface
weak_pointer
typedef std::multimap
< std::string,
MethodBase::pointer
Methods
typedef std::set
< signal_base::pointer
Signals

Public Member Functions

virtual ~Interface ()
Objectobject () const
 Returns the object associated with this interface.
Path path () const
 Returns the path of the object associated with this interface or a null string if no object is associated.
DBusCxxPointer< Connectionconnection () const
 Returns the connection associated with this interface's object or a null pointer if no object is associated.
HandlerResult handle_call_message (DBusCxxPointer< Connection > connection, CallMessage::const_pointer message)
const std::string & name () const
void set_name (const std::string &new_name)
const Methodsmethods () const
MethodBase::pointer method (const std::string &name) const
 Returns the first method with the given name.
template<class T_return >
DBusCxxPointer< Method
< T_return > > 
create_method (const std::string &name)
template<class T_return , class T_arg1 >
DBusCxxPointer< Method
< T_return, T_arg1 > > 
create_method (const std::string &name)
template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer< Method
< T_return, T_arg1, T_arg2 > > 
create_method (const std::string &name)
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 &name)
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 &name)
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 &name)
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 &name)
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 &name)
template<class T_return >
DBusCxxPointer< Method
< T_return > > 
create_method (const std::string &name, sigc::slot0< T_return > slot)
template<class T_return , class T_arg1 >
DBusCxxPointer< Method
< T_return, T_arg1 > > 
create_method (const std::string &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 &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 &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 &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 &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 &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 &name, sigc::slot7< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > slot)
bool add_method (MethodBase::pointer method)
 Adds the named method.
void remove_method (const std::string &name)
 Removes the first method with the given name.
bool has_method (const std::string &name) const
 True if the interface has a method with the given name.
bool add_signal (signal_base::pointer signal)
 Adds the given signal.
bool remove_signal (signal_base::pointer signal)
 Removes the given signal.
bool remove_signal (const std::string &name)
 Removes all signals with the given name.
bool has_signal (signal_base::pointer signal) const
 True if the given signal is part of this interface.
bool has_signal (const std::string &name) const
 True if this interface has at least one signal with the given name.
template<class T_return >
DBusCxxPointer< signal
< T_return > > 
create_signal (const std::string &name)
template<class T_return , class T_arg1 >
DBusCxxPointer< signal
< T_return, T_arg1 > > 
create_signal (const std::string &name)
template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer< signal
< T_return, T_arg1, T_arg2 > > 
create_signal (const std::string &name)
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)
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)
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)
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)
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)
const Signalssignals ()
 Returns the signals associated with this interface.
signal_base::pointer signal (const std::string &signal_name)
 Returns the first signal found with a matching name.
sigc::signal< void, const
std::string &, const
std::string & > 
signal_name_changed ()
 Signal emitted when the name is changed.
sigc::signal< void,
MethodBase::pointer
signal_method_added ()
 Signal emitted when a method of the given name is added.
sigc::signal< void,
MethodBase::pointer
signal_method_removed ()
 Signal emitted when a method of the given name is removed.
std::string introspect (int space_depth=0) const
 Returns a DBus XML description of this interface.

Static Public Member Functions

static pointer create (const std::string &name=std::string())

Protected Types

typedef std::map
< MethodBase::pointer,
sigc::connection > 
MethodSignalNameConnections

Protected Member Functions

 Interface (const std::string &name)
void set_object (Object *object)
void on_method_name_changed (const std::string &oldname, const std::string &newname, MethodBase::pointer method)
void set_connection (DBusCxxPointer< Connection > conn)
void set_path (const std::string &new_path)

Protected Attributes

std::string m_name
Methods m_methods
Signals m_signals
pthread_rwlock_t m_methods_rwlock
pthread_rwlock_t m_signals_rwlock
pthread_mutex_t m_name_mutex
 Ensures that the name doesn't change while the name changed signal is emitting.
sigc::signal< void, const
std::string &, const
std::string & > 
m_signal_name_changed
sigc::signal< void,
MethodBase::pointer
m_signal_method_added
sigc::signal< void,
MethodBase::pointer
m_signal_method_removed
MethodSignalNameConnections m_method_signal_name_connections

Private Attributes

Objectm_object

Friends

class Object

Detailed Description

Todo:
Do something about the signals when the interface name is changed
Author:
Rick L Vinyard Jr <rvinyard@cs.nmsu.edu>

Member Typedef Documentation

typedef std::multimap<std::string, MethodBase::pointer> DBus::Interface::Methods
typedef std::map<MethodBase::pointer,sigc::connection> DBus::Interface::MethodSignalNameConnections [protected]
typedef DBusCxxPointer<Interface> DBus::Interface::pointer
typedef DBusCxxWeakPointer<Interface> DBus::Interface::weak_pointer

Constructor & Destructor Documentation

DBus::Interface::Interface ( const std::string &  name  )  [protected]

References m_methods_rwlock, m_name_mutex, and m_signals_rwlock.

Referenced by create().

DBus::Interface::~Interface (  )  [virtual]

Member Function Documentation

bool DBus::Interface::add_method ( MethodBase::pointer  method  ) 
bool DBus::Interface::add_signal ( signal_base::pointer  signal  ) 

Adds the given signal.

Returns:
true if the signal was successfully added, false otherwise

References connection(), DBUS_CXX_DEBUG, m_name, m_signals, m_signals_rwlock, name(), and path().

Referenced by create_signal().

Connection::pointer DBus::Interface::connection (  )  const

Returns the connection associated with this interface's object or a null pointer if no object is associated.

References m_object.

Referenced by add_signal().

Interface::pointer DBus::Interface::create ( const std::string &  name = std::string()  )  [static]

References 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::Interface::create_method ( const std::string &  name,
sigc::slot7< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >  slot 
) [inline]

References add_method(), create(), and method().

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::Interface::create_method ( const std::string &  name,
sigc::slot6< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 >  slot 
) [inline]

References add_method(), create(), and method().

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::Interface::create_method ( const std::string &  name,
sigc::slot5< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 >  slot 
) [inline]

References add_method(), create(), and method().

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::Interface::create_method ( const std::string &  name,
sigc::slot4< T_return, T_arg1, T_arg2, T_arg3, T_arg4 >  slot 
) [inline]

References add_method(), create(), and method().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 >
DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3> > DBus::Interface::create_method ( const std::string &  name,
sigc::slot3< T_return, T_arg1, T_arg2, T_arg3 >  slot 
) [inline]

References add_method(), create(), and method().

template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer<Method<T_return, T_arg1,T_arg2> > DBus::Interface::create_method ( const std::string &  name,
sigc::slot2< T_return, T_arg1, T_arg2 >  slot 
) [inline]

References add_method(), create(), and method().

template<class T_return , class T_arg1 >
DBusCxxPointer<Method<T_return, T_arg1> > DBus::Interface::create_method ( const std::string &  name,
sigc::slot1< T_return, T_arg1 >  slot 
) [inline]

References add_method(), create(), and method().

template<class T_return >
DBusCxxPointer<Method<T_return> > DBus::Interface::create_method ( const std::string &  name,
sigc::slot0< T_return >  slot 
) [inline]

References add_method(), create(), and method().

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::Interface::create_method ( const std::string &  name  )  [inline]

References add_method(), create(), and method().

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::Interface::create_method ( const std::string &  name  )  [inline]

References add_method(), create(), and method().

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::Interface::create_method ( const std::string &  name  )  [inline]

References add_method(), create(), and method().

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::Interface::create_method ( const std::string &  name  )  [inline]

References add_method(), create(), and method().

template<class T_return , class T_arg1 , class T_arg2 , class T_arg3 >
DBusCxxPointer<Method<T_return, T_arg1,T_arg2,T_arg3> > DBus::Interface::create_method ( const std::string &  name  )  [inline]

References add_method(), create(), and method().

template<class T_return , class T_arg1 , class T_arg2 >
DBusCxxPointer<Method<T_return, T_arg1,T_arg2> > DBus::Interface::create_method ( const std::string &  name  )  [inline]

References add_method(), create(), and method().

template<class T_return , class T_arg1 >
DBusCxxPointer<Method<T_return, T_arg1> > DBus::Interface::create_method ( const std::string &  name  )  [inline]

References add_method(), create(), and method().

template<class T_return >
DBusCxxPointer<Method<T_return> > DBus::Interface::create_method ( const std::string &  name  )  [inline]

References add_method(), create(), and method().

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::Interface::create_signal ( const std::string &  name  )  [inline]

References add_signal(), create(), and m_name.

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::Interface::create_signal ( const std::string &  name  )  [inline]

References add_signal(), create(), and m_name.

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::Interface::create_signal ( const std::string &  name  )  [inline]

References add_signal(), create(), and m_name.

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::Interface::create_signal ( const std::string &  name  )  [inline]

References add_signal(), create(), and m_name.

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

References add_signal(), create(), and m_name.

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

References add_signal(), create(), and m_name.

template<class T_return , class T_arg1 >
DBusCxxPointer<signal<T_return, T_arg1> > DBus::Interface::create_signal ( const std::string &  name  )  [inline]

References add_signal(), create(), and m_name.

template<class T_return >
DBusCxxPointer<signal<T_return> > DBus::Interface::create_signal ( const std::string &  name  )  [inline]

References add_signal(), create(), and m_name.

HandlerResult DBus::Interface::handle_call_message ( DBusCxxPointer< Connection connection,
CallMessage::const_pointer  message 
)
bool DBus::Interface::has_method ( const std::string &  name  )  const

True if the interface has a method with the given name.

References m_methods, and m_methods_rwlock.

bool DBus::Interface::has_signal ( const std::string &  name  )  const

True if this interface has at least one signal with the given name.

References m_signals, and m_signals_rwlock.

bool DBus::Interface::has_signal ( signal_base::pointer  signal  )  const

True if the given signal is part of this interface.

References m_signals, and m_signals_rwlock.

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

Returns a DBus XML description of this interface.

References m_methods, m_signals, and name().

MethodBase::pointer DBus::Interface::method ( const std::string &  name  )  const

Returns the first method with the given name.

References m_methods, and m_methods_rwlock.

Referenced by create_method(), and remove_method().

const Interface::Methods & DBus::Interface::methods (  )  const

References m_methods.

const std::string & DBus::Interface::name (  )  const

References m_name.

Referenced by add_signal(), and introspect().

Object * DBus::Interface::object (  )  const

Returns the object associated with this interface.

Note that there is no set_object() method as an interface must be added to an object through the object's add_interface() method.

References m_object.

void DBus::Interface::on_method_name_changed ( const std::string &  oldname,
const std::string &  newname,
MethodBase::pointer  method 
) [protected]
Path DBus::Interface::path (  )  const

Returns the path of the object associated with this interface or a null string if no object is associated.

References m_object.

Referenced by add_signal().

void DBus::Interface::remove_method ( const std::string &  name  ) 

Removes the first method with the given name.

References m_method_signal_name_connections, m_methods, m_methods_rwlock, m_signal_method_removed, and method().

bool DBus::Interface::remove_signal ( const std::string &  name  ) 

Removes all signals with the given name.

References m_signals, and m_signals_rwlock.

bool DBus::Interface::remove_signal ( signal_base::pointer  signal  ) 

Removes the given signal.

Returns:
true if the signal was successfully removed, false otherwise

One reason a signal couldn't be removed is if it wasn't a part of the interface.

References m_signals, and m_signals_rwlock.

void DBus::Interface::set_connection ( DBusCxxPointer< Connection conn  )  [protected]
void DBus::Interface::set_name ( const std::string &  new_name  ) 
void DBus::Interface::set_object ( Object object  )  [protected]

References m_object, and m_signals.

void DBus::Interface::set_path ( const std::string &  new_path  )  [protected]

References m_signals.

signal_base::pointer DBus::Interface::signal ( const std::string &  signal_name  ) 

Returns the first signal found with a matching name.

If more than one signal has a given name there are no guarantees as to which signal will be returned.

References m_signals, and m_signals_rwlock.

sigc::signal< void, MethodBase::pointer > DBus::Interface::signal_method_added (  ) 

Signal emitted when a method of the given name is added.

References m_signal_method_added.

sigc::signal< void, MethodBase::pointer > DBus::Interface::signal_method_removed (  ) 

Signal emitted when a method of the given name is removed.

References m_signal_method_removed.

sigc::signal< void, const std::string &, const std::string & > DBus::Interface::signal_name_changed (  ) 

Signal emitted when the name is changed.

References m_signal_name_changed.

const Interface::Signals & DBus::Interface::signals (  ) 

Returns the signals associated with this interface.

References m_signals.


Friends And Related Function Documentation

friend class Object [friend]

Member Data Documentation

pthread_rwlock_t DBus::Interface::m_methods_rwlock [mutable, protected]
std::string DBus::Interface::m_name [protected]
pthread_mutex_t DBus::Interface::m_name_mutex [protected]

Ensures that the name doesn't change while the name changed signal is emitting.

Referenced by Interface(), set_name(), and ~Interface().

Referenced by connection(), object(), path(), and set_object().

Referenced by add_method(), and signal_method_added().

sigc::signal<void,const std::string&,const std::string&> DBus::Interface::m_signal_name_changed [protected]

Referenced by set_name(), and signal_name_changed().

pthread_rwlock_t DBus::Interface::m_signals_rwlock [mutable, protected]

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

Generated on Wed Sep 30 11:15:16 2009 for dbus-cxx by doxygen 1.6.1