Zth (libzth)
zth::Pollable Struct Reference

A pollable thing. More...

#include <poller.h>

Inheritance diagram for zth::Pollable:
zth::PollableFd

Public Types

enum  EventsFlags {
  PollInIndex , PollOutIndex , PollErrIndex , PollPriIndex ,
  PollHupIndex , FlagCount
}
 Flags to be used with events and revents. More...
 
typedef std::bitset< FlagCountEvents
 Type of events and revents. More...
 

Public Member Functions

constexpr Pollable (Events const &e, void *user=nullptr) noexcept
 Ctor. More...
 

Public Attributes

void * user_data
 User data. More...
 
Events events
 Events to poll. More...
 
Events revents
 Returned events by a poll. More...
 

Static Public Attributes

static const unsigned long PollIn = 1UL << PollInIndex
 
static const unsigned long PollOut = 1UL << PollOutIndex
 
static const unsigned long PollErr = 1UL << PollErrIndex
 
static const unsigned long PollPri = 1UL << PollPriIndex
 
static const unsigned long PollHup = 1UL << PollHupIndex
 

Detailed Description

A pollable thing.

Only file descriptors (or even only sockets in Windows) are supported by Zth. Use zth::PollableFd instead. The generic Pollable class exists for extending by your application.

If you implement more Pollables, you must provide and register your own PollerServer.

Definition at line 75 of file poller.h.

Member Typedef Documentation

◆ Events

typedef std::bitset<FlagCount> zth::Pollable::Events

Type of events and revents.

Definition at line 89 of file poller.h.

Member Enumeration Documentation

◆ EventsFlags

Flags to be used with events and revents.

Enumerator
PollInIndex 
PollOutIndex 
PollErrIndex 
PollPriIndex 
PollHupIndex 
FlagCount 

Definition at line 79 of file poller.h.

Constructor & Destructor Documentation

◆ Pollable()

constexpr zth::Pollable::Pollable ( Events const &  e,
void *  user = nullptr 
)
inlineexplicitconstexprnoexcept

Ctor.

Definition at line 101 of file poller.h.

Member Data Documentation

◆ events

Events zth::Pollable::events

Events to poll.

Do not change these events after adding the Pollable to a Poller.

Not every PollerServer may support all flags.

Definition at line 121 of file poller.h.

◆ PollErr

const unsigned long zth::Pollable::PollErr = 1UL << PollErrIndex
static

Definition at line 94 of file poller.h.

◆ PollHup

const unsigned long zth::Pollable::PollHup = 1UL << PollHupIndex
static

Definition at line 96 of file poller.h.

◆ PollIn

const unsigned long zth::Pollable::PollIn = 1UL << PollInIndex
static

Definition at line 92 of file poller.h.

◆ PollOut

const unsigned long zth::Pollable::PollOut = 1UL << PollOutIndex
static

Definition at line 93 of file poller.h.

◆ PollPri

const unsigned long zth::Pollable::PollPri = 1UL << PollPriIndex
static

Definition at line 95 of file poller.h.

◆ revents

Events zth::Pollable::revents

Returned events by a poll.

Do not set manually, let the Poller do that.

Definition at line 128 of file poller.h.

◆ user_data

void* zth::Pollable::user_data

User data.

This can be changed, even after adding a Pollable to a Poller.

Definition at line 112 of file poller.h.


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