Zth (libzth)
Loading...
Searching...
No Matches
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 () 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 () override=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 188 of file poller.h.

Constructor & Destructor Documentation

◆ ~PollerInterface()

virtual zth::PollerInterface::~PollerInterface ( )
overridevirtualdefault

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::PollerServer< zmq_pollitem_t >, zth::PollerServer< PollItem_ >, zth::PollerClient, and zth::PollerServerBase.

◆ 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 22 of file poller.cpp.

◆ empty()

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

Checks if there is any pollable registered.

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

◆ remove()

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

Remove a pollable object.

Returns
0 on success, otherwise an errno

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

◆ 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::PollerServer< zmq_pollitem_t >, zth::PollerServer< PollItem_ >, and zth::PollerClient.


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