Open Lighting Architecture  0.9.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
ola::PluginAdaptor Class Reference
Inheritance diagram for ola::PluginAdaptor:
ola::io::SelectServerInterface ola::thread::SchedulingExecutorInterface ola::thread::ExecutorInterface ola::thread::SchedulerInterface

Public Member Functions

 PluginAdaptor (class DeviceManager *device_manager, ola::io::SelectServerInterface *select_server, ExportMap *export_map, class PreferencesFactory *preferences_factory, class PortBrokerInterface *port_broker)
bool AddReadDescriptor (ola::io::ReadFileDescriptor *descriptor)
 Register a ReadFileDescriptor for read-events.
bool AddReadDescriptor (ola::io::ConnectedDescriptor *descriptor, bool delete_on_close=false)
 Register a ConnectedDescriptor for read-events.
void RemoveReadDescriptor (ola::io::ReadFileDescriptor *descriptor)
 Remove a RemoveReadDescriptor for read-events.
void RemoveReadDescriptor (ola::io::ConnectedDescriptor *descriptor)
 Remove a ConnectedDescriptor for read-events.
bool AddWriteDescriptor (ola::io::WriteFileDescriptor *descriptor)
void RemoveWriteDescriptor (ola::io::WriteFileDescriptor *descriptor)
 Remove a WriteFileDescriptor for write-events.
ola::thread::timeout_id RegisterRepeatingTimeout (unsigned int ms, Callback0< bool > *closure)
 Execute a callback periodically.
ola::thread::timeout_id RegisterRepeatingTimeout (const TimeInterval &interval, Callback0< bool > *closure)
 Execute a callback periodically.
ola::thread::timeout_id RegisterSingleTimeout (unsigned int ms, SingleUseCallback0< void > *closure)
 Execute a callback after a certain time interval.
ola::thread::timeout_id RegisterSingleTimeout (const TimeInterval &interval, SingleUseCallback0< void > *closure)
 Execute a callback after a certain time interval.
void RemoveTimeout (ola::thread::timeout_id id)
 Cancel an existing timeout.
void Execute (ola::BaseCallback0< void > *closure)
 Execute the supplied callback at some point in the future.
const TimeStampWakeUpTime () const
 The time when this SelectServer was woken up.
ExportMapGetExportMap () const
bool RegisterDevice (class AbstractDevice *device) const
bool UnregisterDevice (class AbstractDevice *device) const
class PreferencesNewPreference (const std::string &name) const
class PortBrokerInterfaceGetPortBroker () const

Member Function Documentation

bool ola::PluginAdaptor::AddReadDescriptor ( ola::io::ReadFileDescriptor descriptor)
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.

Implements ola::io::SelectServerInterface.

bool ola::PluginAdaptor::AddReadDescriptor ( ola::io::ConnectedDescriptor descriptor,
bool  delete_on_close = false 
)
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.

Implements ola::io::SelectServerInterface.

bool ola::PluginAdaptor::AddWriteDescriptor ( ola::io::WriteFileDescriptor descriptor)
virtual

Register a WriteFileDescriptor with the SelectServer

Implements ola::io::SelectServerInterface.

void ola::PluginAdaptor::Execute ( ola::BaseCallback0< void > *  callback)
virtual

Execute the supplied callback at some point in the future.

Parameters
callbackthe callback to run.

This method guarantees the callback will not be run immediately.

Implements ola::thread::ExecutorInterface.

timeout_id ola::PluginAdaptor::RegisterRepeatingTimeout ( unsigned int  period,
Callback0< bool > *  callback 
)
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::io::SelectServerInterface.

timeout_id ola::PluginAdaptor::RegisterRepeatingTimeout ( const TimeInterval period,
Callback0< bool > *  callback 
)
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::io::SelectServerInterface.

timeout_id ola::PluginAdaptor::RegisterSingleTimeout ( unsigned int  delay,
SingleUseCallback0< void > *  callback 
)
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::io::SelectServerInterface.

timeout_id ola::PluginAdaptor::RegisterSingleTimeout ( const TimeInterval delay,
SingleUseCallback0< void > *  callback 
)
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::io::SelectServerInterface.

void ola::PluginAdaptor::RemoveReadDescriptor ( ola::io::ReadFileDescriptor descriptor)
virtual

Remove a RemoveReadDescriptor 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.

Implements ola::io::SelectServerInterface.

void ola::PluginAdaptor::RemoveReadDescriptor ( ola::io::ConnectedDescriptor descriptor)
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.

Implements ola::io::SelectServerInterface.

void ola::PluginAdaptor::RemoveTimeout ( ola::thread::timeout_id  id)
virtual

Cancel an existing timeout.

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

Implements ola::io::SelectServerInterface.

void ola::PluginAdaptor::RemoveWriteDescriptor ( ola::io::WriteFileDescriptor descriptor)
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.

Implements ola::io::SelectServerInterface.

const TimeStamp * ola::PluginAdaptor::WakeUpTime ( ) const
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.

Implements ola::io::SelectServerInterface.


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