Open Lighting Architecture  0.10.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | List of all members
ola::io::SelectServerInterface Class Referenceabstract

Detailed Description

The interface for the SelectServer.

The SelectServerInterface is used to register Descriptors for events. It's the core of the event manager system, and should really be called IOManager.

SelectServerInterface implementations are required to be reentrant. Descriptors may be added / removed and timeouts set / canceled from within callbacks executed by the SelectServer.

Inheritance diagram for ola::io::SelectServerInterface:
Inheritance graph
[legend]
Collaboration diagram for ola::io::SelectServerInterface:
Collaboration graph
[legend]

Public Member Functions

virtual bool AddReadDescriptor (class ReadFileDescriptor *descriptor)=0
 Register a ReadFileDescriptor for read-events. More...
 
virtual bool AddReadDescriptor (class ConnectedDescriptor *descriptor, bool delete_on_close=false)=0
 Register a ConnectedDescriptor for read-events. More...
 
virtual void RemoveReadDescriptor (class ReadFileDescriptor *descriptor)=0
 Remove a ReadFileDescriptor for read-events. More...
 
virtual void RemoveReadDescriptor (class ConnectedDescriptor *descriptor)=0
 Remove a ConnectedDescriptor for read-events. More...
 
virtual bool AddWriteDescriptor (class WriteFileDescriptor *descriptor)=0
 Register a WriteFileDescriptor for write-events. More...
 
virtual void RemoveWriteDescriptor (class WriteFileDescriptor *descriptor)=0
 Remove a WriteFileDescriptor for write-events. More...
 
virtual ola::thread::timeout_id RegisterRepeatingTimeout (unsigned int ms, Callback0< bool > *closure)=0
 Execute a callback periodically. More...
 
virtual ola::thread::timeout_id RegisterRepeatingTimeout (const ola::TimeInterval &interval, ola::Callback0< bool > *closure)=0
 Execute a callback periodically. More...
 
virtual ola::thread::timeout_id RegisterSingleTimeout (unsigned int ms, SingleUseCallback0< void > *closure)=0
 Execute a callback after a certain time interval. More...
 
virtual ola::thread::timeout_id RegisterSingleTimeout (const ola::TimeInterval &interval, SingleUseCallback0< void > *closure)=0
 Execute a callback after a certain time interval. More...
 
virtual void RemoveTimeout (ola::thread::timeout_id id)=0
 Cancel an existing timeout. More...
 
virtual const TimeStampWakeUpTime () const =0
 The time when this SelectServer was woken up. More...
 
- Public Member Functions inherited from ola::thread::ExecutorInterface
virtual void Execute (ola::BaseCallback0< void > *callback)=0
 Execute the supplied callback at some point in the future. More...
 
virtual void DrainCallbacks ()=0
 Run all callbacks until there are none left.
 

Member Function Documentation

virtual bool ola::io::SelectServerInterface::AddReadDescriptor ( class ReadFileDescriptor descriptor)
pure virtual

Register a ReadFileDescriptor for read-events.

Parameters
descriptorthe ReadFileDescriptor to add.
Returns
true if the descriptor was added, false if the descriptor was previously added.

When the descriptor is ready for reading, PerformRead() will be called.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.

virtual bool ola::io::SelectServerInterface::AddReadDescriptor ( class ConnectedDescriptor descriptor,
bool  delete_on_close = false 
)
pure virtual

Register a ConnectedDescriptor for read-events.

Parameters
descriptorthe ConnectedDescriptor to add.
delete_on_closeif true, ownership of the ConnectedDescriptor is transferred to the SelectServer.
Returns
true if the descriptor was added, false if the descriptor was previously added.

When the descriptor is ready for reading, PerformRead() will be called. Prior to PerformRead(), IsClosed() is called. If this returns true, and delete_on_close was set, the descriptor will be deleted.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.

virtual bool ola::io::SelectServerInterface::AddWriteDescriptor ( class WriteFileDescriptor descriptor)
pure virtual

Register a WriteFileDescriptor for write-events.

Parameters
descriptorthe WriteFileDescriptor to add.

When the descriptor is writeable, PerformWrite() is called.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.

virtual ola::thread::timeout_id ola::io::SelectServerInterface::RegisterRepeatingTimeout ( unsigned int  period,
Callback0< bool > *  callback 
)
pure virtual

Execute a callback periodically.

Parameters
periodthe number of milliseconds between each execution of the callback.
callbackthe callback to run. Ownership is transferred.
Returns
a timeout_id which can be used later to cancel the timeout.
Deprecated:
Use the version that takes a TimeInterval instead.

Returning false from the callback will cause it to be cancelled.

Implements ola::thread::SchedulerInterface.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.

virtual ola::thread::timeout_id ola::io::SelectServerInterface::RegisterRepeatingTimeout ( const ola::TimeInterval period,
ola::Callback0< bool > *  callback 
)
pure virtual

Execute a callback periodically.

Parameters
periodthe time interval between each execution of the callback.
callbackthe callback to run. Ownership is transferred.
Returns
a timeout_id which can be used later to cancel the timeout.

Returning false from the callback will cause it to be cancelled.

Implements ola::thread::SchedulerInterface.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.

virtual ola::thread::timeout_id ola::io::SelectServerInterface::RegisterSingleTimeout ( unsigned int  delay,
SingleUseCallback0< void > *  callback 
)
pure virtual

Execute a callback after a certain time interval.

Parameters
delaythe number of milliseconds before the callback is executed.
callbackthe callback to run. Ownership is transferred.
Returns
a timeout_id which can be used later to cancel the timeout.
Deprecated:
Use the version that takes a TimeInterval instead.

Implements ola::thread::SchedulerInterface.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.

virtual ola::thread::timeout_id ola::io::SelectServerInterface::RegisterSingleTimeout ( const ola::TimeInterval delay,
SingleUseCallback0< void > *  callback 
)
pure virtual

Execute a callback after a certain time interval.

Parameters
delaythe time interval to wait before the callback is executed.
callbackthe callback to run. Ownership is transferred.
Returns
a timeout_id which can be used later to cancel the timeout.

Implements ola::thread::SchedulerInterface.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.

virtual void ola::io::SelectServerInterface::RemoveReadDescriptor ( class ReadFileDescriptor descriptor)
pure virtual

Remove a ReadFileDescriptor for read-events.

Parameters
descriptorthe descriptor to remove.
Warning
Descriptors must be removed from the SelectServer before they are closed. Not doing so will result in hard to debug failures.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.

virtual void ola::io::SelectServerInterface::RemoveReadDescriptor ( class ConnectedDescriptor descriptor)
pure virtual

Remove a ConnectedDescriptor for read-events.

Parameters
descriptorthe descriptor to remove.
Warning
Descriptors must be removed from the SelectServer before they are closed. Not doing so will result in hard to debug failures.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.

virtual void ola::io::SelectServerInterface::RemoveTimeout ( ola::thread::timeout_id  id)
pure virtual

Cancel an existing timeout.

Parameters
idthe timeout_id returned by a call to RegisterRepeatingTimeout or RegisterSingleTimeout.

Implements ola::thread::SchedulerInterface.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.

virtual void ola::io::SelectServerInterface::RemoveWriteDescriptor ( class WriteFileDescriptor descriptor)
pure virtual

Remove a WriteFileDescriptor for write-events.

Parameters
descriptorthe descriptor to remove.
Warning
Descriptors must be removed from the SelectServer before they are closed. Not doing so will result in hard to debug failures.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.

virtual const TimeStamp* ola::io::SelectServerInterface::WakeUpTime ( ) const
pure virtual

The time when this SelectServer was woken up.

Returns
The TimeStamp of when the SelectServer was woken up.

If running within the same thread as the SelectServer, this is a efficient way to get the current time.

Implemented in ola::io::SelectServer, and ola::PluginAdaptor.


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