Open Lighting Architecture
Latest Git
|
The interface for the Poller classes.
This forms the basis for the low level event management. The SelectServer will add / remove descriptors as required and then call Poll() with a timeout. The Poll() method is responsible for checking for timeouts (via the TimeoutManager) and then blocking until the descriptors are ready or a timeout event occurs. This blocking is done with select(), poll(), epoll() or kevent(), depending on the implementation.
Once the blocking wait returns. any ready descriptors should the appropriate method called: ola::io::ReadFileDescriptor::PerformRead(), ola::io::WriteFileDescriptor::PerformWrite() or the callback set in ola::io::ConnectedDescriptor::SetOnClose(). Once all descriptors and any new timeouts have been handled, Poll() returns.
Public Member Functions | |
virtual | ~PollerInterface () |
Destructor. | |
virtual bool | AddReadDescriptor (ReadFileDescriptor *descriptor)=0 |
Register a ReadFileDescriptor for read events. More... | |
virtual bool | AddReadDescriptor (ConnectedDescriptor *descriptor, bool delete_on_close)=0 |
Register a ConnectedDescriptor for read events. More... | |
virtual bool | RemoveReadDescriptor (ReadFileDescriptor *descriptor)=0 |
Unregister a ReadFileDescriptor for read events. More... | |
virtual bool | RemoveReadDescriptor (ConnectedDescriptor *descriptor)=0 |
Unregister a ConnectedDescriptor for read events. More... | |
virtual bool | AddWriteDescriptor (WriteFileDescriptor *descriptor)=0 |
Register a WriteFileDescriptor to receive ready-to-write events. More... | |
virtual bool | RemoveWriteDescriptor (WriteFileDescriptor *descriptor)=0 |
Unregister a WriteFileDescriptor for write events. More... | |
virtual const TimeStamp * | WakeUpTime () const =0 |
virtual bool | Poll (TimeoutManager *timeout_manager, const TimeInterval &poll_interval)=0 |
Poll the Descriptors for events and execute any callbacks. More... | |
Static Public Attributes | |
static const char | K_READ_DESCRIPTOR_VAR [] = "ss-read-descriptors" |
The number of descriptors registered for read events. | |
static const char | K_WRITE_DESCRIPTOR_VAR [] = "ss-write-descriptor" |
The number of descriptors registered for write events. | |
static const char | K_CONNECTED_DESCRIPTORS_VAR [] |
The number of connected descriptors registered for read events. More... | |
Static Protected Attributes | |
static const char | K_LOOP_TIME [] = "ss-loop-time" |
The time spent in the event loop. | |
static const char | K_LOOP_COUNT [] = "ss-loop-count" |
The number of iterations through the event loop. | |
|
pure virtual |
Register a ReadFileDescriptor for read events.
descriptor | the ReadFileDescriptor to register. The OnData() method will be called when there is data available for reading. |
Implemented in ola::io::EPoller, ola::io::KQueuePoller, ola::io::WindowsPoller, and ola::io::SelectPoller.
|
pure virtual |
Register a ConnectedDescriptor for read events.
descriptor | the ConnectedDescriptor to register. The OnData() method will be called when there is data available for reading. Additionally, OnClose() will be called if the other end closes the connection. |
delete_on_close | controls whether the descriptor is deleted when it's closed. |
Implemented in ola::io::EPoller, ola::io::KQueuePoller, ola::io::WindowsPoller, and ola::io::SelectPoller.
|
pure virtual |
Register a WriteFileDescriptor to receive ready-to-write events.
descriptor | the WriteFileDescriptor to register. The PerformWrite() method will be called when the descriptor is ready for writing. |
Implemented in ola::io::EPoller, ola::io::KQueuePoller, ola::io::WindowsPoller, and ola::io::SelectPoller.
|
pure virtual |
Poll the Descriptors for events and execute any callbacks.
timeout_manager | the TimeoutManager to use for timer events. |
poll_interval | the maximum time to block for. |
Implemented in ola::io::EPoller, ola::io::KQueuePoller, ola::io::WindowsPoller, and ola::io::SelectPoller.
|
pure virtual |
Unregister a ReadFileDescriptor for read events.
descriptor | the ReadFileDescriptor to unregister. |
Implemented in ola::io::EPoller, ola::io::KQueuePoller, ola::io::WindowsPoller, and ola::io::SelectPoller.
|
pure virtual |
Unregister a ConnectedDescriptor for read events.
descriptor | the ConnectedDescriptor to unregister. |
Implemented in ola::io::EPoller, ola::io::KQueuePoller, ola::io::WindowsPoller, and ola::io::SelectPoller.
|
pure virtual |
Unregister a WriteFileDescriptor for write events.
descriptor | the WriteFileDescriptor to unregister. |
Implemented in ola::io::EPoller, ola::io::KQueuePoller, ola::io::WindowsPoller, and ola::io::SelectPoller.
|
static |
The number of connected descriptors registered for read events.