Thread-safe event loop supporting I/O multiplexing and Timers. More...

#include <cxxtools/eventloop.h>

Inheritance diagram for cxxtools::EventLoopBase:
cxxtools::SelectorBase cxxtools::EventSink cxxtools::Connectable cxxtools::NonCopyable cxxtools::NonCopyable cxxtools::EventLoop

Public Member Functions

virtual ~EventLoopBase ()
 Destructs the EventLoop.
void run ()
 Starts the event loop.
void processEvents ()
 Processes all events which are currently in the event queue.
void exit ()
 Stops the EventLoop.
void setIdleTimeout (size_t msecs)
 Sets the idle timeout.
unsigned int idleTimeout () const
 Returns the idle timeout.
- Public Member Functions inherited from cxxtools::SelectorBase
virtual ~SelectorBase ()
 Destructor.
void add (Selectable &s)
 Adds an IOResult.
void remove (Selectable &s)
 Cancel an IOResult.
void add (Timer &timer)
 Adds a Timer.
void remove (Timer &timer)
 Removes a Timer.
bool wait (std::size_t msecs=WaitInfinite)
 Wait for activity.
void wake ()
 Wakes the selctor from waiting.
- Public Member Functions inherited from cxxtools::Connectable
 Connectable ()
 Default constructor.
virtual ~Connectable ()
 Closes all connections.
virtual void onConnectionOpen (const Connection &c)
 Registers a Connection with the Connectable.
virtual void onConnectionClose (const Connection &c)
 Unregisters a Connection from the Connectable.
size_t connectionCount () const
- Public Member Functions inherited from cxxtools::EventSink
 EventSink ()
virtual ~EventSink ()
void commitEvent (const Event &event)

Public Attributes

Signal timeout
 Notifies about wait timeouts This signal is send when the timeout given to a wait call of the selector expires and no activity occured.
Signal< const Event & > event
 Reports all events TODO: rename to eventReady.
Signal exited
 Emited when the eventloop is exited.

Protected Member Functions

 EventLoopBase ()
 Constructs the EventLoop.
virtual void onRun ()=0
virtual void onExit ()=0
virtual void onProcessEvents ()=0
- Protected Member Functions inherited from cxxtools::SelectorBase
 SelectorBase ()
 Default constructor.
void onAddTimer (Timer &timer)
void onRemoveTimer (Timer &timer)
void onTimerChanged (Timer &timer)
virtual void onAdd (Selectable &)=0
 A Selectable is added to this Selector.
virtual void onRemove (Selectable &)=0
 A Selectable is removed from this Selector.
virtual void onReinit (Selectable &)=0
 A Selectable is reinitialised and needs to be updated.
virtual void onChanged (Selectable &s)=0
 A Selectable in this Selector has changed.
virtual bool onWait (std::size_t msecs)=0
virtual void onWake ()=0
- Protected Member Functions inherited from cxxtools::Connectable
 Connectable (const Connectable &c)
 Copy constructor.
Connectableoperator= (const Connectable &rhs)
 Assignment operator.
const std::list< Connection > & connections () const
 Returns a list of all current connections.
std::list< Connection > & connections ()
 Returns a list of all current connections.
void clear ()
- Protected Member Functions inherited from cxxtools::NonCopyable
 NonCopyable ()
- Protected Member Functions inherited from cxxtools::EventSink
virtual void onCommitEvent (const Event &event)=0

Additional Inherited Members

- Static Public Attributes inherited from cxxtools::SelectorBase
static const std::size_t WaitInfinite = static_cast<const std::size_t>(-1)
- Protected Attributes inherited from cxxtools::Connectable
std::list< Connection_connections
 A list of all current connections.

Detailed Description

Thread-safe event loop supporting I/O multiplexing and Timers.

Constructor & Destructor Documentation

virtual cxxtools::EventLoopBase::~EventLoopBase ( )
inlinevirtual

Destructs the EventLoop.

cxxtools::EventLoopBase::EventLoopBase ( )
inlineprotected

Constructs the EventLoop.

Member Function Documentation

void cxxtools::EventLoopBase::exit ( )
inline

Stops the EventLoop.

unsigned int cxxtools::EventLoopBase::idleTimeout ( ) const
inline

Returns the idle timeout.

virtual void cxxtools::EventLoopBase::onExit ( )
protectedpure virtual

Implemented in cxxtools::EventLoop.

virtual void cxxtools::EventLoopBase::onProcessEvents ( )
protectedpure virtual

Implemented in cxxtools::EventLoop.

virtual void cxxtools::EventLoopBase::onRun ( )
protectedpure virtual

Implemented in cxxtools::EventLoop.

void cxxtools::EventLoopBase::processEvents ( )
inline

Processes all events which are currently in the event queue.

void cxxtools::EventLoopBase::run ( )
inline

Starts the event loop.

void cxxtools::EventLoopBase::setIdleTimeout ( size_t  msecs)
inline

Sets the idle timeout.

Member Data Documentation

Signal<const Event&> cxxtools::EventLoopBase::event

Reports all events TODO: rename to eventReady.

Signal cxxtools::EventLoopBase::exited

Emited when the eventloop is exited.

Signal cxxtools::EventLoopBase::timeout

Notifies about wait timeouts This signal is send when the timeout given to a wait call of the selector expires and no activity occured.


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