Zth (libzth)
zth::PollerServerBase Class Referenceabstract

Abstract base class of a Poller server. More...

#include <poller.h>

Inheritance diagram for zth::PollerServerBase:
zth::PollerInterface zth::UniqueID< PollerInterface > zth::UniqueIDBase zth::PollerServer< zmq_pollitem_t > zth::PollerServer< PollItem_ > zth::ZmqPoller

Public Types

typedef PollerClientBase Client
 

Public Member Functions

virtual ~PollerServerBase () override=default
 
virtual int poll (int timeout_ms) noexcept=0
 Poll. More...
 
virtual int migrateTo (PollerServerBase &p) noexcept=0
 Move all registered Pollables to another server. More...
 
virtual int add (Pollable &p, Client *client) noexcept=0
 Add a Pollable, that belongs to a given client. More...
 
virtual int remove (Pollable &p, Client *client) noexcept=0
 Remove the given Pollable, belonging to the given client. More...
 
- Public Member Functions inherited from zth::PollerInterface
virtual ~PollerInterface ()=default
 Dtor. More...
 
virtual int add (Pollable &p) noexcept=0
 Add a pollable object. More...
 
int add (std::initializer_list< std::reference_wrapper< Pollable >> l) noexcept
 Add pollable objects. More...
 
virtual int remove (Pollable &p) noexcept=0
 Remove a pollable object. More...
 
virtual void reserve (size_t more)=0
 Reserve memory to add more pollables. More...
 
virtual bool empty () const noexcept=0
 Checks if there is any pollable registered. More...
 
- 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 ()=default
 
void const * normptr () const noexcept
 
uint64_t id () const noexcept
 
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 override
 

Additional Inherited Members

- Static Public Member Functions inherited from zth::UniqueID< PollerInterface >
static uint64_t getID () noexcept
 
- Protected Member Functions inherited from zth::UniqueIDBase
virtual ~UniqueIDBase ()=default
 

Detailed Description

Abstract base class of a Poller server.

Definition at line 273 of file poller.h.

Member Typedef Documentation

◆ Client

Definition at line 275 of file poller.h.

Constructor & Destructor Documentation

◆ ~PollerServerBase()

virtual zth::PollerServerBase::~PollerServerBase ( )
overridevirtualdefault

Member Function Documentation

◆ add()

virtual int zth::PollerServerBase::add ( Pollable p,
Client client 
)
pure virtualnoexcept

Add a Pollable, that belongs to a given client.

client can be nullptr.

Returns
0 on success, otherwise an errno

Implemented in zth::PollerServer< PollItem_ >, and zth::PollerServer< zmq_pollitem_t >.

◆ migrateTo()

virtual int zth::PollerServerBase::migrateTo ( PollerServerBase p)
pure virtualnoexcept

Move all registered Pollables to another server.

Returns
0 on success, otherwise an errno

Implemented in zth::PollerServer< PollItem_ >, and zth::PollerServer< zmq_pollitem_t >.

◆ poll()

virtual int zth::PollerServerBase::poll ( int  timeout_ms)
pure virtualnoexcept

Poll.

The Pollables with events are not saved in the server, but these are forwarded to the registered Client.

Returns
0 when a Pollable returned an event, otherwise an errno

Implemented in zth::PollerServer< PollItem_ >, and zth::PollerServer< zmq_pollitem_t >.

◆ remove()

virtual int zth::PollerServerBase::remove ( Pollable p,
Client client 
)
pure virtualnoexcept

Remove the given Pollable, belonging to the given client.

client must match the one that was specified during add().

Returns
0 on success, otherwise an errno

Implemented in zth::PollerServer< PollItem_ >, and zth::PollerServer< zmq_pollitem_t >.


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