|
Open Model Railroad Network (OpenMRN)
|
Helper for DeviceBuffer which allows for methods to not be inlined. More...
#include <DeviceBuffer.hxx>
Public Member Functions | |
| void | signal_condition () |
| Signal the wakeup condition. | |
| void | signal_condition_from_isr () |
| Signal the wakeup condition from an ISR context. | |
| void | flush () |
| flush all the data out of the buffer and reset the buffer. | |
| size_t | pending () |
| Return the number of items in the queue. | |
| size_t | space () |
| Return the number of items for which space is available. | |
| void | select_insert () |
| Add client to list of clients needing woken. | |
| size_t | consume (size_t items) |
| Remove a number of items from the buffer by advancing the readIndex. | |
| size_t | advance (size_t items) |
| Add a number of items to the buffer by advancing the writeIndex. | |
Protected Member Functions | |
| DeviceBufferBase (size_t size, size_t level) | |
| Constructor. | |
| ~DeviceBufferBase () | |
| Destructor. | |
Protected Attributes | |
| uint16_t | level |
| level of space required in buffer in order to wakeup, 0 if unused | |
| uint16_t | size |
| size in items of buffer | |
| uint16_t | count |
| total number of items in buffer | |
| uint16_t | readIndex |
| read index | |
| uint16_t | writeIndex |
| write index | |
Private Member Functions | |
| DISALLOW_COPY_AND_ASSIGN (DeviceBufferBase) | |
Helper for DeviceBuffer which allows for methods to not be inlined.
Definition at line 52 of file DeviceBuffer.hxx.
|
inlineprotected |
Constructor.
| size | size in items for the buffer. |
| level | minimum amount of space required in buffer to restart transmitting, unused for receive. |
Definition at line 170 of file DeviceBuffer.hxx.
|
inlineprotected |
Destructor.
Definition at line 181 of file DeviceBuffer.hxx.
|
inline |
Add a number of items to the buffer by advancing the writeIndex.
| items | total number of items to add |
Definition at line 146 of file DeviceBuffer.hxx.
|
inline |
Remove a number of items from the buffer by advancing the readIndex.
| items | total number of items to remove |
Definition at line 124 of file DeviceBuffer.hxx.
|
inline |
flush all the data out of the buffer and reset the buffer.
It is assumed that an interrupt cannot occur which would access the buffer asynchronous to the execution of this method and any thread level mutual exclusion is handled by the caller.
Definition at line 88 of file DeviceBuffer.hxx.
|
inline |
Return the number of items in the queue.
Definition at line 98 of file DeviceBuffer.hxx.
|
inline |
Add client to list of clients needing woken.
Definition at line 113 of file DeviceBuffer.hxx.
|
inline |
Signal the wakeup condition.
This will also wakeup select.
Definition at line 65 of file DeviceBuffer.hxx.
|
inline |
Signal the wakeup condition from an ISR context.
This will also wakeup select.
Definition at line 75 of file DeviceBuffer.hxx.
|
inline |
Return the number of items for which space is available.
Definition at line 106 of file DeviceBuffer.hxx.
|
protected |
total number of items in buffer
Definition at line 197 of file DeviceBuffer.hxx.
|
protected |
level of space required in buffer in order to wakeup, 0 if unused
Definition at line 191 of file DeviceBuffer.hxx.
|
protected |
read index
Definition at line 200 of file DeviceBuffer.hxx.
|
protected |
size in items of buffer
Definition at line 194 of file DeviceBuffer.hxx.
|
protected |
write index
Definition at line 203 of file DeviceBuffer.hxx.