# DBus-C++

## Desktop Communication Bus System

libdbus-c-- Documentation 0.9.0

- Files
- Data Structures
- Globals
- Main Page

Public Member Functions | Private Member Functions | Private Attributes | List of all members
DBus::Watch Class Referenceabstract

`#include <dispatcher.h>`

Inheritance diagram for DBus::Watch:

## 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

## ◆ Watch() [1/2]

DBus::Watch::Watch | ( | Internal * | i | ) |

Referenced by DBus::BusWatch::BusWatch(), DBus::Ecore::BusWatch::BusWatch(), DBus::Glib::BusWatch::BusWatch(), and Watch().

## ◆ ~Watch()

virtual DBus::Watch::~Watch | ( |  | ) |

inline virtual

Definition at line 94 of file dispatcher.h.

## ◆ Watch() [2/2]

DXXAPILOCAL DBus::Watch::Watch | ( | const Watch & |  | ) |

private

References DXXAPILOCAL, and Watch().

## Member Function Documentation

## ◆ descriptor()

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::Ecore::BusWatch::_enable(), DBus::Glib::BusWatch::_enable(), DBus::Ecore::BusDispatcher::add_watch(), DBus::Glib::BusDispatcher::add_watch(), and DBus::BusWatch::BusWatch().

## ◆ enabled()

bool Watch::enabled | ( |  | ) | const

Definition at line 91 of file dispatcher.cpp.

References _int.

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

## ◆ flags()

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::Ecore::BusDispatcher::add_watch(), DBus::Glib::BusDispatcher::add_watch(), DBus::BusWatch::BusWatch(), handle(), DBus::Ecore::BusWatch::watch_dispatch(), and DBus::Glib::BusWatch::watch_handler().

## ◆ handle()

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

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

## ◆ toggle()

virtual void DBus::Watch::toggle | ( |  | ) |

pure virtual

Implemented in DBus::BusWatch, DBus::Ecore::BusWatch, and DBus::Glib::BusWatch.

Referenced by DBus::Dispatcher::Private::on_toggle_watch().

## Member Data Documentation

## ◆ _int

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:

- dispatcher.h
- dispatcher.cpp