![]() |
This is Unofficial EPICS BASE Doxygen Site
|
A circular buffer to store bytes. More...
#include "libComAPI.h"
Go to the source code of this file.
Typedefs | |
typedef void * | epicsRingBytesId |
An identifier for a ring buffer. More... | |
typedef void const * | epicsRingBytesIdConst |
Functions | |
LIBCOM_API epicsRingBytesId epicsStdCall | epicsRingBytesCreate (int nbytes) |
Create a new ring buffer. More... | |
LIBCOM_API epicsRingBytesId epicsStdCall | epicsRingBytesLockedCreate (int nbytes) |
Create a new ring buffer, secured by a spinlock. More... | |
LIBCOM_API void epicsStdCall | epicsRingBytesDelete (epicsRingBytesId id) |
Delete the ring buffer and free any associated memory. More... | |
LIBCOM_API int epicsStdCall | epicsRingBytesGet (epicsRingBytesId id, char *value, int nbytes) |
Read data out of the ring buffer. More... | |
LIBCOM_API int epicsStdCall | epicsRingBytesPut (epicsRingBytesId id, char *value, int nbytes) |
Write data into the ring buffer. More... | |
LIBCOM_API void epicsStdCall | epicsRingBytesFlush (epicsRingBytesId id) |
Make the ring buffer empty. More... | |
LIBCOM_API int epicsStdCall | epicsRingBytesFreeBytes (epicsRingBytesId id) |
Return the number of free bytes in the ring buffer. More... | |
LIBCOM_API int epicsStdCall | epicsRingBytesUsedBytes (epicsRingBytesId id) |
Return the number of bytes currently stored in the ring buffer. More... | |
LIBCOM_API int epicsStdCall | epicsRingBytesSize (epicsRingBytesId id) |
Return the size of the ring buffer. More... | |
LIBCOM_API int epicsStdCall | epicsRingBytesIsEmpty (epicsRingBytesId id) |
Test if the ring buffer is currently empty. More... | |
LIBCOM_API int epicsStdCall | epicsRingBytesIsFull (epicsRingBytesId id) |
Test if the ring buffer is currently full. More... | |
LIBCOM_API int epicsStdCall | epicsRingBytesHighWaterMark (epicsRingBytesIdConst id) |
See how full a ring buffer has been since it was last checked. More... | |
LIBCOM_API void epicsStdCall | epicsRingBytesResetHighWaterMark (epicsRingBytesId id) |
Reset the Highwater mark of the ring buffer. More... | |
A circular buffer to store bytes.
EpicsRingBytes provides a C API for creating and using ring buffers (first in first out circular buffers) that store bytes. The unlocked variant is designed so that one writer thread and one reader thread can access the ring simultaneously without requiring mutual exclusion. The locked variant uses an epicsSpinLock, and works with any numbers of writer and reader threads.
Definition in file epicsRingBytes.h.
typedef void* epicsRingBytesId |
An identifier for a ring buffer.
Definition at line 37 of file epicsRingBytes.h.
typedef void const* epicsRingBytesIdConst |
Definition at line 38 of file epicsRingBytes.h.
LIBCOM_API epicsRingBytesId epicsStdCall epicsRingBytesCreate | ( | int | nbytes | ) |
Create a new ring buffer.
nbytes | Size of ring buffer to create |
Definition at line 44 of file epicsRingBytes.c.
LIBCOM_API void epicsStdCall epicsRingBytesDelete | ( | epicsRingBytesId | id | ) |
Delete the ring buffer and free any associated memory.
id | RingbufferID returned by epicsRingBytesCreate() |
Definition at line 66 of file epicsRingBytes.c.
LIBCOM_API void epicsStdCall epicsRingBytesFlush | ( | epicsRingBytesId | id | ) |
Make the ring buffer empty.
id | RingbufferID returned by epicsRingBytesCreate() |
Definition at line 169 of file epicsRingBytes.c.
LIBCOM_API int epicsStdCall epicsRingBytesFreeBytes | ( | epicsRingBytesId | id | ) |
Return the number of free bytes in the ring buffer.
id | RingbufferID returned by epicsRingBytesCreate() |
Definition at line 178 of file epicsRingBytes.c.
LIBCOM_API int epicsStdCall epicsRingBytesGet | ( | epicsRingBytesId | id, |
char * | value, | ||
int | nbytes | ||
) |
Read data out of the ring buffer.
id | RingbufferID returned by epicsRingBytesCreate() |
value | Where to put the data fetched from the buffer |
nbytes | Maximum number of bytes to get |
Definition at line 73 of file epicsRingBytes.c.
LIBCOM_API int epicsStdCall epicsRingBytesHighWaterMark | ( | epicsRingBytesIdConst | id | ) |
See how full a ring buffer has been since it was last checked.
Returns the maximum amount of data the ring buffer has held in bytes since the water mark was last reset. A new ring buffer starts with a water mark of 0.
id | RingbufferID returned by epicsRingBytesCreate() |
Definition at line 235 of file epicsRingBytes.c.
LIBCOM_API int epicsStdCall epicsRingBytesIsEmpty | ( | epicsRingBytesId | id | ) |
Test if the ring buffer is currently empty.
id | RingbufferID returned by epicsRingBytesCreate() |
Definition at line 218 of file epicsRingBytes.c.
LIBCOM_API int epicsStdCall epicsRingBytesIsFull | ( | epicsRingBytesId | id | ) |
Test if the ring buffer is currently full.
id | RingbufferID returned by epicsRingBytesCreate() |
Definition at line 230 of file epicsRingBytes.c.
LIBCOM_API epicsRingBytesId epicsStdCall epicsRingBytesLockedCreate | ( | int | nbytes | ) |
Create a new ring buffer, secured by a spinlock.
nbytes | Size of ring buffer to create |
Definition at line 57 of file epicsRingBytes.c.
LIBCOM_API int epicsStdCall epicsRingBytesPut | ( | epicsRingBytesId | id, |
char * | value, | ||
int | nbytes | ||
) |
Write data into the ring buffer.
id | RingbufferID returned by epicsRingBytesCreate() |
value | Source of the data to be put into the buffer |
nbytes | How many bytes to put |
Definition at line 117 of file epicsRingBytes.c.
LIBCOM_API void epicsStdCall epicsRingBytesResetHighWaterMark | ( | epicsRingBytesId | id | ) |
Reset the Highwater mark of the ring buffer.
The Highwater mark will be set to the current usage
id | RingbufferID returned by epicsRingBytesCreate() |
Definition at line 241 of file epicsRingBytes.c.
LIBCOM_API int epicsStdCall epicsRingBytesSize | ( | epicsRingBytesId | id | ) |
Return the size of the ring buffer.
id | RingbufferID returned by epicsRingBytesCreate() |
Definition at line 211 of file epicsRingBytes.c.
LIBCOM_API int epicsStdCall epicsRingBytesUsedBytes | ( | epicsRingBytesId | id | ) |
Return the number of bytes currently stored in the ring buffer.
id | RingbufferID returned by epicsRingBytesCreate() |
Definition at line 194 of file epicsRingBytes.c.