Mir
Public Member Functions | List of all members
mir::dispatch::MultiplexingDispatchable Class Referencefinal

An adaptor that combines multiple Dispatchables into a single Dispatchable. More...

#include <multiplexing_dispatchable.h>

Inheritance diagram for mir::dispatch::MultiplexingDispatchable:
[legend]

Public Member Functions

 MultiplexingDispatchable ()
 
 MultiplexingDispatchable (std::initializer_list< std::shared_ptr< Dispatchable >> dispatchees)
 
virtual ~MultiplexingDispatchable () noexcept
 
MultiplexingDispatchableoperator= (MultiplexingDispatchable const &)=delete
 
 MultiplexingDispatchable (MultiplexingDispatchable const &)=delete
 
Fd watch_fd () const override
 Get a poll()able file descriptor. More...
 
bool dispatch (FdEvents events) override
 Dispatch one pending event. More...
 
FdEvents relevant_events () const override
 The set of file-descriptor events this Dispatchable handles. More...
 
void add_watch (std::shared_ptr< Dispatchable > const &dispatchee)
 Add a dispatchable to the adaptor. More...
 
void add_watch (std::shared_ptr< Dispatchable > const &dispatchee, DispatchReentrancy reentrancy)
 Add a dispatchable to the adaptor, specifying the reentrancy of dispatch() More...
 
void add_watch (Fd const &fd, std::function< void()> const &callback)
 Add a simple callback to the adaptor. More...
 
void remove_watch (std::shared_ptr< Dispatchable > const &dispatchee)
 Remove a watch from the dispatchable. More...
 
void remove_watch (Fd const &fd)
 Remove a watch by file-descriptor. More...
 
- Public Member Functions inherited from mir::dispatch::Dispatchable
 Dispatchable ()=default
 
virtual ~Dispatchable ()=default
 
Dispatchableoperator= (Dispatchable const &)=delete
 
 Dispatchable (Dispatchable const &)=delete
 

Detailed Description

An adaptor that combines multiple Dispatchables into a single Dispatchable.

Note
Instances are fully thread-safe.

Constructor & Destructor Documentation

mir::draw::MultiplexingDispatchable::MultiplexingDispatchable ( )
mir::draw::MultiplexingDispatchable::MultiplexingDispatchable ( std::initializer_list< std::shared_ptr< Dispatchable >>  dispatchees)
mir::draw::MultiplexingDispatchable::~MultiplexingDispatchable ( )
virtualnoexcept
mir::dispatch::MultiplexingDispatchable::MultiplexingDispatchable ( MultiplexingDispatchable const &  )
delete

Member Function Documentation

void mir::dispatch::MultiplexingDispatchable::add_watch ( std::shared_ptr< Dispatchable > const &  dispatchee)

Add a dispatchable to the adaptor.

Parameters
[in]dispatcheeDispatchable to add. The Dispatchable's dispatch() function will not be called reentrantly.
void mir::dispatch::MultiplexingDispatchable::add_watch ( std::shared_ptr< Dispatchable > const &  dispatchee,
DispatchReentrancy  reentrancy 
)

Add a dispatchable to the adaptor, specifying the reentrancy of dispatch()

void mir::draw::MultiplexingDispatchable::add_watch ( Fd const &  fd,
std::function< void()> const &  callback 
)

Add a simple callback to the adaptor.

Parameters
[in]fdFile descriptor to monitor for readability
[in]callbackCallback to fire when fd becomes readable. This callback is not called reentrantly.
bool mir::draw::MultiplexingDispatchable::dispatch ( FdEvents  events)
overridevirtual

Dispatch one pending event.

Parameters
[in]eventThe set of events current on the file-descriptor
Returns
False iff no more events will be produced by this Dispatchable. Dispatch should no longer be called.
Note
This will dispatch at most one event. If there are multiple events specified in event (eg: readable | remote_closed) then dispatch will process only one.
It is harmless to call dispatch() with an event that does not contain any of the events from relevant_events(). The function will do nothing in such a case.
An implementation of dispatch() MUST handle FdEvent::error, if only to return false and terminate further event dispatch.

Implements mir::dispatch::Dispatchable.

MultiplexingDispatchable& mir::dispatch::MultiplexingDispatchable::operator= ( MultiplexingDispatchable const &  )
delete
md::FdEvents mir::draw::MultiplexingDispatchable::relevant_events ( ) const
overridevirtual

The set of file-descriptor events this Dispatchable handles.

Implements mir::dispatch::Dispatchable.

void mir::draw::MultiplexingDispatchable::remove_watch ( std::shared_ptr< Dispatchable > const &  dispatchee)

Remove a watch from the dispatchable.

Parameters
[in]dispatcheeDispatchable to remove
void mir::draw::MultiplexingDispatchable::remove_watch ( Fd const &  fd)

Remove a watch by file-descriptor.

Parameters
[in]fdFile descriptor of watch to remove.
mir::Fd mir::draw::MultiplexingDispatchable::watch_fd ( ) const
overridevirtual

Get a poll()able file descriptor.

Returns
A file descriptor usable with poll() or equivalent function calls. relevant_events() contains the set of event types to watch for.

Implements mir::dispatch::Dispatchable.


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

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015