#include <vpr/IO/Selector_t.h>
Inheritance diagram for vpr::Selector_t< RealSelectorImp >:


Public Member Functions | |
| bool | addHandle (vpr::IOSys::Handle handle, vpr::Uint16 mask=0) |
| Adds the given handle to the selector. | |
| bool | removeHandle (vpr::IOSys::Handle handle) |
| Removes the named handle from the selector. | |
| bool | setIn (vpr::IOSys::Handle handle, vpr::Uint16 mask) |
| Sets the event flags going in to the select to mask. | |
| vpr::Uint16 | getIn (vpr::IOSys::Handle handle) |
| Gets the current in flag mask. | |
| vpr::Uint16 | getOut (vpr::IOSys::Handle handle) |
| Gets the current "out flag" mask after a call to select(). | |
| vpr::ReturnStatus | select (vpr::Uint16 &numWithEvents, const vpr::Interval &timeout=vpr::Interval::NoTimeout) |
| Poll for any ready events among the registered handles using their in flags. | |
| vpr::Uint16 | getNumHandles () |
| For iteration over the registered handles. | |
| vpr::IOSys::Handle | getHandle (vpr::Uint16 index) |
| Gets the handle at the given index within the collection of registered handles. | |
| bool | containsHandle (vpr::IOSys::Handle handle) |
| Test if the selector contain the given handle. | |
Protected Attributes | |
| RealSelectorImp | mSelectorImp |
| Platform-specific implementation. | |
A selector is used to wait on a set of Handles untils any of the events occur that the user is interested in. Given a platform-specific wrapper class, this is typedef'd to vpr::Selector.
| RealSelectorImp | The type that serves as the true wrapper around the platform-specific selector implementation. |
Definition at line 71 of file Selector_t.h.
| bool vpr::Selector_t< RealSelectorImp >::addHandle | ( | vpr::IOSys::Handle | handle, | |
| vpr::Uint16 | mask = 0 | |||
| ) | [inline] |
Adds the given handle to the selector.
handle is a valid handle. handle is added to the handle set, and initialized to a mask of no-events.| handle | The handle to be added to this selector. | |
| mask | A bitmask specifying the events of interest for this handle. This is optional and defaults to 0 (none). |
true is returned if handle is added successfully; false otherwise. Definition at line 88 of file Selector_t.h.
References vpr::Selector_t< RealSelectorImp >::mSelectorImp.
Referenced by vpr::SocketConnector::complete(), vpr::BlockIO::isReadBlocked(), and vpr::BlockIO::isWriteBlocked().
00089 { 00090 return mSelectorImp.addHandle(handle, mask); 00091 }
| bool vpr::Selector_t< RealSelectorImp >::removeHandle | ( | vpr::IOSys::Handle | handle | ) | [inline] |
Removes the named handle from the selector.
handle is in the selector. handle is removed from the set of valid handles.| handle | The handle to be removed from the selector's handle list. |
true is returned if handle is removed successfully; false otherwise. Definition at line 104 of file Selector_t.h.
References vpr::Selector_t< RealSelectorImp >::mSelectorImp.
00105 { 00106 return mSelectorImp.removeHandle(handle); 00107 }
| bool vpr::Selector_t< RealSelectorImp >::setIn | ( | vpr::IOSys::Handle | handle, | |
| vpr::Uint16 | mask | |||
| ) | [inline] |
Sets the event flags going in to the select to mask.
The flags specify which events should be selected for the given handle.
handle has already been added to the selector using addHandlei().| handle | The handle whose event flags will be updated. | |
| mask | The mask used when checking for ready events on the given handle. |
true is returned if handle's event flags are set successfully; false otherwise. Definition at line 122 of file Selector_t.h.
References vpr::Selector_t< RealSelectorImp >::mSelectorImp.
Referenced by vpr::SocketConnector::complete(), vpr::BlockIO::isReadBlocked(), and vpr::BlockIO::isWriteBlocked().
00123 { 00124 return mSelectorImp.setIn(handle, mask); 00125 }
| vpr::Uint16 vpr::Selector_t< RealSelectorImp >::getIn | ( | vpr::IOSys::Handle | handle | ) | [inline] |
Gets the current in flag mask.
handle has already been added to the selector using addHandle().| handle | The handle whose "in" event flags will be returned. |
handle. Definition at line 136 of file Selector_t.h.
References vpr::Selector_t< RealSelectorImp >::mSelectorImp.
00137 { 00138 return mSelectorImp.getIn(handle); 00139 }
| vpr::Uint16 vpr::Selector_t< RealSelectorImp >::getOut | ( | vpr::IOSys::Handle | handle | ) | [inline] |
Gets the current "out flag" mask after a call to select().
The value returned will be the bitwise OR of the "out flags". These state which of the operations named "in flags" were found to be ready.
| handle | The handle whose "out" event flags will be returned. |
handle. These flags state which requested events were detected for handle. Definition at line 154 of file Selector_t.h.
References vpr::Selector_t< RealSelectorImp >::mSelectorImp.
Referenced by vpr::SocketConnector::complete().
00155 { 00156 return mSelectorImp.getOut(handle); 00157 }
| vpr::ReturnStatus vpr::Selector_t< RealSelectorImp >::select | ( | vpr::Uint16 & | numWithEvents, | |
| const vpr::Interval & | timeout = vpr::Interval::NoTimeout | |||
| ) | [inline] |
Poll for any ready events among the registered handles using their in flags.
| numWithEvents | Upon completion, this holds the number of items that have events. | |
| timeout | The interval to wait for an event to be raised. This argument is optional and defaults to vpr::Interval::NoTimeout (wait until an event is detected withotu timing out). Passing vpr::Interval::NoWait effects a poll on the registered handles and returns immediately. |
vpr::ReturnStatus::Timeout is returned if no events were detected before the timeout expired or if vpr::Interval::NoWait was passed. In this case, numWithEvents should be checked for a value greater than 0.
vpr::ReturnStatus::Fail is returned if the select failed.
Definition at line 182 of file Selector_t.h.
References vpr::Selector_t< RealSelectorImp >::mSelectorImp.
Referenced by vpr::SocketConnector::complete(), vpr::BlockIO::isReadBlocked(), and vpr::BlockIO::isWriteBlocked().
00184 { 00185 return mSelectorImp.select(numWithEvents, timeout); 00186 }
| vpr::Uint16 vpr::Selector_t< RealSelectorImp >::getNumHandles | ( | ) | [inline] |
For iteration over the registered handles.
Definition at line 193 of file Selector_t.h.
References vpr::Selector_t< RealSelectorImp >::mSelectorImp.
00194 { 00195 return mSelectorImp.getNumHandles(); 00196 }
| vpr::IOSys::Handle vpr::Selector_t< RealSelectorImp >::getHandle | ( | vpr::Uint16 | index | ) | [inline] |
Gets the handle at the given index within the collection of registered handles.
The index is determined by the order of handle addition using addHandle().
| index | The index of the desired handle. |
Definition at line 208 of file Selector_t.h.
References vpr::Selector_t< RealSelectorImp >::mSelectorImp.
00209 { 00210 return mSelectorImp.getHandle(index); 00211 }
| bool vpr::Selector_t< RealSelectorImp >::containsHandle | ( | vpr::IOSys::Handle | handle | ) | [inline] |
Test if the selector contain the given handle.
| handle | The handle of interest. |
true is returned if handle was previously registered with this selector.
false is returned if the handle has not been registered.
Definition at line 222 of file Selector_t.h.
References vpr::Selector_t< RealSelectorImp >::mSelectorImp.
00223 { 00224 return mSelectorImp.containsHandle(handle); 00225 }
RealSelectorImp vpr::Selector_t< RealSelectorImp >::mSelectorImp [protected] |
Platform-specific implementation.
Definition at line 228 of file Selector_t.h.
Referenced by vpr::Selector_t< RealSelectorImp >::addHandle(), vpr::Selector_t< RealSelectorImp >::containsHandle(), vpr::Selector_t< RealSelectorImp >::getHandle(), vpr::Selector_t< RealSelectorImp >::getIn(), vpr::Selector_t< RealSelectorImp >::getNumHandles(), vpr::Selector_t< RealSelectorImp >::getOut(), vpr::Selector_t< RealSelectorImp >::removeHandle(), vpr::Selector_t< RealSelectorImp >::select(), and vpr::Selector_t< RealSelectorImp >::setIn().
1.5.1