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::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 (Milliseconds msecs)
 Sets the idle timeout.
Milliseconds 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 (Milliseconds msecs=WaitInfinite)
 Wait for activity.
bool waitUntil (Timespan t)
 Wait for activity.
void wake ()
 Wakes the selctor from waiting.
Timespan waitTimer ()
 Wait for activity.
- 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 queueEvent (const Event &event)
 Puts a event in the queue but does not wake the loop.
void commitEvent (const Event &event)
 Puts a event in the queue and wakes the loop so that the event is processed.
void queuePriorityEvent (const Event &event)
 Puts a priority event in the queue and wakes the loop so that the event is processed.
void commitPriorityEvent (const Event &event)
 Puts a priority event in the queue and wakes the loop so that the event is processed.

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 idle
 Notifies that all events are processed and the event loop starts waiting.
Signal< const Event & > event
 Reports all events.
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 onWaitUntil (Timespan timeout)=0
virtual void onWake ()=0
- Protected Member Functions inherited from cxxtools::Connectable
 Connectable (const Connectable &)
 Copy constructor.
Connectableoperator= (const Connectable &)
 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::EventSink
virtual void onQueueEvent (const Event &event, bool priority)=0
virtual void onCommitEvent (const Event &event, bool priority)=0
- Protected Member Functions inherited from cxxtools::NonCopyable
 NonCopyable ()

Additional Inherited Members

- Static Public Attributes inherited from cxxtools::SelectorBase
static const int WaitInfinite = -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.

Milliseconds 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 ( Milliseconds  msecs)
inline

Sets the idle timeout.

Member Data Documentation

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

Reports all events.

Signal cxxtools::EventLoopBase::exited

Emited when the eventloop is exited.

Signal cxxtools::EventLoopBase::idle

Notifies that all events are processed and the event loop starts waiting.

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: