DBus::Watch Class Reference

#include <dispatcher.h>

Inheritance diagram for DBus::Watch:

List of all members.

Public Member Functions

 Watch (Internal *i)
virtual ~Watch ()
int descriptor () const
 A main loop could poll this descriptor to integrate dbus-c++.
int flags () const
 Gets flags from DBusWatchFlags indicating what conditions should be monitored on the file descriptor.
bool enabled () const
bool handle (int flags)
 Called to notify the D-Bus library when a previously-added watch is ready for reading or writing, or has an exception such as a hangup.
virtual void toggle ()=0

Private Member Functions

DXXAPILOCAL Watch (const Watch &)

Private Attributes

Internal * _int

Detailed Description

Definition at line 86 of file dispatcher.h.


Constructor & Destructor Documentation

DBus::Watch::Watch ( Internal *  i  ) 
virtual DBus::Watch::~Watch (  )  [inline, virtual]

Definition at line 94 of file dispatcher.h.

DXXAPILOCAL DBus::Watch::Watch ( const Watch  )  [private]

Member Function Documentation

int Watch::descriptor (  )  const

A main loop could poll this descriptor to integrate dbus-c++.

This function calls dbus_watch_get_socket() on win32 and dbus_watch_get_unix_fd() on all other systems. (see dbus documentation)

Returns:
The file descriptor.

Definition at line 70 of file dispatcher.cpp.

References _int.

Referenced by DBus::Glib::BusWatch::_enable(), DBus::Ecore::BusWatch::_enable(), DBus::Glib::BusDispatcher::add_watch(), and DBus::Ecore::BusDispatcher::add_watch().

int Watch::flags (  )  const

Gets flags from DBusWatchFlags indicating what conditions should be monitored on the file descriptor.

The flags returned will only contain DBUS_WATCH_READABLE and DBUS_WATCH_WRITABLE, never DBUS_WATCH_HANGUP or DBUS_WATCH_ERROR; all watches implicitly include a watch for hangups, errors, and other exceptional conditions.

Returns:
The conditions to watch.

Definition at line 86 of file dispatcher.cpp.

References _int.

Referenced by DBus::Glib::BusWatch::_enable(), DBus::Glib::BusDispatcher::add_watch(), DBus::Ecore::BusDispatcher::add_watch(), DBus::BusWatch::BusWatch(), DBus::Ecore::BusWatch::watch_dispatch(), and DBus::Glib::BusWatch::watch_handler().

bool Watch::handle ( int  flags  ) 

Called to notify the D-Bus library when a previously-added watch is ready for reading or writing, or has an exception such as a hangup.

If this function returns FALSE, then the file descriptor may still be ready for reading or writing, but more memory is needed in order to do the reading or writing. If you ignore the FALSE return, your application may spin in a busy loop on the file descriptor until memory becomes available, but nothing more catastrophic should happen.

dbus_watch_handle() cannot be called during the DBusAddWatchFunction, as the connection will not be ready to handle that watch yet.

It is not allowed to reference a DBusWatch after it has been passed to remove_function.

Parameters:
flags The poll condition using DBusWatchFlags values.
Returns:
false If there wasn't enough memory.

Definition at line 96 of file dispatcher.cpp.

References _int.

Referenced by DBus::Ecore::BusWatch::watch_dispatch(), DBus::Glib::BusWatch::watch_handler(), and DBus::BusDispatcher::watch_ready().

virtual void DBus::Watch::toggle (  )  [pure virtual]

Member Data Documentation

Internal* DBus::Watch::_int [private]

Definition at line 148 of file dispatcher.h.

Referenced by descriptor(), enabled(), flags(), and handle().


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