Zth (libzth)
zth::PollerInterface Class Referenceabstract

Abstract base class of a poller. More...

#include <poller.h>

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

Public Member Functions

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.

Definition at line 191 of file poller.h.

Constructor & Destructor Documentation

◆ ~PollerInterface()

virtual zth::PollerInterface::~PollerInterface ( )
virtualdefault

Dtor.

Member Function Documentation

◆ add() [1/2]

virtual int zth::PollerInterface::add ( Pollable p)
pure virtualnoexcept

Add a pollable object.

Once a pollable is added, do not modify its properties, except for user_data.

Returns
0 on success, otherwise an errno

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

◆ add() [2/2]

int zth::PollerInterface::add ( std::initializer_list< std::reference_wrapper< Pollable >>  l)
noexcept

Add pollable objects.

Returns
0 on success, otherwise an errno

Definition at line 25 of file poller.cpp.

◆ empty()

virtual bool zth::PollerInterface::empty ( ) const
pure virtualnoexcept

Checks if there is any pollable registered.

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

◆ remove()

virtual int zth::PollerInterface::remove ( Pollable p)
pure virtualnoexcept

Remove a pollable object.

Returns
0 on success, otherwise an errno

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

◆ reserve()

virtual void zth::PollerInterface::reserve ( size_t  more)
pure virtual

Reserve memory to add more pollables.

Exceptions
std::bad_allocwhen allocation fails

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


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