Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::G::PollFD Class Reference

A C++ wrapper for the GPollFD. More...

`#include <xfc/glib/main.hh>`

List of all members.

## Public Member Functions

Constructors

- PollFD ()
    Constructs an empty PollFD object;.
- PollFD (int fd)
    Constructs a new PollFD object for the file descriptor fd;.
- PollFD (int fd, IOConditionField events)
    Constructs a new PollFD object that polls the specified events for the file descriptor fd;.

Accessors

- GPollFD * g_poll_fd () const
    Get a pointer to the GPollFD structure.
- operator GPollFD * () const
    Conversion operator; safely converts a PollFD to a GPollFD pointer.
- int fd () const
    Gets the file descriptor being polled.
- IOConditionField events () const
    Gets the events that should be polled for.
- IOConditionField revents () const
    Gets the bitwise combination of flags returned from poll() that indicate which events occurred.

Methods

- void set_fd (int fd)
    Sets the file descriptor to poll.
- void set_events (IOConditionField events)
    Sets the events that should be polled for.
- void set (int fd, IOConditionField events)
    Sets the file descriptor to poll and the events to poll for;.

## Detailed Description

A C++ wrapper for the GPollFD.

PollFD is used to hold information about a file descriptor being watched (polled) for a particular context or event source.

## Constructor & Destructor Documentation

Xfc::G::PollFD::PollFD | ( | int | fd | ) |

Constructs a new PollFD object for the file descriptor fd;.

Parameters:

  | fd | The file descriptor to poll.

Xfc::G::PollFD::PollFD | ( | int | fd,
|  | IOConditionField | events
| ) |

Constructs a new PollFD object that polls the specified events for the file descriptor fd;.

Parameters:

  | fd | The file descriptor to poll.
  | events | A bitwise combination of flags from G::IOCondition, specifying which events to poll for.

Typically for reading from a file descriptor you would use G::IO_IN | G::IO_HUP | G::IO_ERR, and for writing you would use G::IO_OUT | G::IO_ERR.

## Member Function Documentation

IOConditionField Xfc::G::PollFD::events | ( |  | ) | const

Gets the events that should be polled for.

Returns:
  A bitwise combination of flags from G::IOCondition.

int Xfc::G::PollFD::fd | ( |  | ) | const

Gets the file descriptor being polled.

Returns:
  The file descriptor.

IOConditionField Xfc::G::PollFD::revents | ( |  | ) | const

Gets the bitwise combination of flags returned from poll() that indicate which events occurred.

Returns:
  A bitwise combination of flags from G::IOCondition.

void Xfc::G::PollFD::set | ( | int | fd,
|  | IOConditionField | events
| ) |

Sets the file descriptor to poll and the events to poll for;.

Parameters:

  | fd | The file descriptor to poll.
  | events | A bitwise combination of flags from G::IOCondition, specifying which events to poll for.

Typically for reading from a file descriptor you would use G::IO_IN | G::IO_HUP | G::IO_ERR, and for writing you would use G::IO_OUT | G::IO_ERR.

void Xfc::G::PollFD::set_events | ( | IOConditionField | events | ) |

Sets the events that should be polled for.

Parameters:

  | events | A bitwise combination of flags from G::IOCondition.

Typically for reading from a file descriptor you would use G::IO_IN | G::IO_HUP | G::IO_ERR, and for writing you would use G::IO_OUT | G::IO_ERR.

void Xfc::G::PollFD::set_fd | ( | int | fd | ) |

Sets the file descriptor to poll.

Parameters:

  | fd | The file descriptor.

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

- libXFCcore/xfc/glib/main.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3