Zth (libzth)
Loading...
Searching...
No Matches
zth::PollerClientBase Class Referenceabstract

The abstract base class of a Poller client. More...

#include <poller.h>

Inheritance diagram for zth::PollerClientBase:
zth::PollerInterface zth::UniqueID< PollerInterface > zth::NamedUniqueID< Named > zth::UniqueIDBase zth::PollerClient

Public Types

typedef small_vector< Pollable * > Result
 Result of poll().
 
- Public Types inherited from zth::UniqueID< PollerInterface >
typedef NamedUniqueID base
 

Public Member Functions

virtual ~PollerClientBase () noexcept override=default
 
virtual Result const & poll (int timeout_ms=-1) noexcept=0
 Poll.
 
virtual void event (Pollable &p) noexcept=0
 Indicate that the given pollable got an event.
 
- Public Member Functions inherited from zth::PollerInterface
virtual ~PollerInterface () noexcept override=default
 Dtor.
 
virtual int add (Pollable &p) noexcept=0
 Add a pollable object.
 
int add (std::initializer_list< std::reference_wrapper< Pollable > > l) noexcept
 Add pollable objects.
 
virtual int remove (Pollable &p) noexcept=0
 Remove a pollable object.
 
virtual void reserve (size_t more)=0
 Reserve memory to add more pollables.
 
virtual bool empty () const noexcept=0
 Checks if there is any pollable registered.
 
- Public Member Functions inherited from zth::UniqueID< PollerInterface >
 UniqueID (UniqueID const &)=delete
 
 UniqueID (UniqueID &&u) noexcept
 
 UniqueID (string const &name)
 
 UniqueID (string &&name)
 
 UniqueID (char const *name=nullptr)
 
UniqueIDoperator= (UniqueID const &)=delete
 
UniqueIDoperator= (UniqueID &&u) noexcept
 
virtual ~UniqueID () noexcept override=default
 
void const * normptr () const noexcept
 
uint64_t id () const noexcept
 
- Public Member Functions inherited from zth::NamedUniqueID< Named >
virtual ~NamedUniqueID () noexcept override=default
 
string const & name () const noexcept
 
void setName (string const &name)
 
void setName (char const *name)
 
void setName (string &&name)
 
virtual char const * id_str () const noexcept override
 

Additional Inherited Members

- Static Public Member Functions inherited from zth::UniqueID< PollerInterface >
static uint64_t getID () noexcept
 
- Protected Member Functions inherited from zth::UniqueID< PollerInterface >
virtual uint64_t id_ () const noexcept final
 
- Protected Member Functions inherited from zth::NamedUniqueID< Named >
 NamedUniqueID (char const *name=nullptr)
 
 NamedUniqueID (string const &name)
 
 NamedUniqueID (string &&name)
 
- Protected Member Functions inherited from zth::UniqueIDBase
virtual ~UniqueIDBase () noexcept=default
 

Detailed Description

The abstract base class of a Poller client.

A call to poll() forwards all registered Pollables to the server. When a Pollable has an event, the server passes it to the client via event().

Definition at line 237 of file poller.h.

Member Typedef Documentation

◆ Result

Result of poll().

Definition at line 244 of file poller.h.

Constructor & Destructor Documentation

◆ ~PollerClientBase()

virtual zth::PollerClientBase::~PollerClientBase ( )
overridevirtualdefaultnoexcept

Member Function Documentation

◆ event()

virtual void zth::PollerClientBase::event ( Pollable p)
pure virtualnoexcept

Indicate that the given pollable got an event.

Implemented in zth::PollerClient.

◆ poll()

virtual Result const & zth::PollerClientBase::poll ( int  timeout_ms = -1)
pure virtualnoexcept

Poll.

When timeout_ms is -1, poll() blocks until at least one of the pollables got an event. When timeout_ms is 0, poll() never blocks. Otherwise, poll() blocks at most for timeout_ms and return with a timeout, or return earlier when a pollable got an event.

Returns
The registered pollables that have an event set. If the result is empty, errno is set to the error.

Implemented in zth::PollerClient.


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