fwRPC
|
Functions | |
int | fwRPC_RingBuffer_init (string dp_rb, uint size=fwRPC_RingBuffer_DEFAULT_SIZE) |
int | fwRPC_RingBuffer_write (string dp_rb, string value) |
int | fwRPC_RingBuffer_writeMany (string dp_rb, dyn_string values, int to_insert, int &inserted) |
int | fwRPC_RingBuffer_read (string dp_rb, string &value) |
int | fwRPC_RingBuffer_readMany (string dp_rb, dyn_string &values, int max) |
Datapoint-based ring buffer implementation.
int fwRPC_RingBuffer_init | ( | string | dp_rb, |
uint | size = fwRPC_RingBuffer_DEFAULT_SIZE |
||
) |
Initialize a ring buffer DP. Creates a new DP if the specified one does not exist.
dp_rb | (IN, string) DP name |
size | (IN, uint) size of the ring buffer |
if | the DP could not be created if the DP could not be written to |
int fwRPC_RingBuffer_read | ( | string | dp_rb, |
string & | value | ||
) |
Read from a ring buffer
dp_rb | (IN, string) ring buffer DP |
value | (OUT, string) value read |
if | the DP could not be read from if the DP could not be written to |
int fwRPC_RingBuffer_readMany | ( | string | dp_rb, |
dyn_string & | values, | ||
int | max | ||
) |
Read multiple entries from a ring buffer. Always returns ESUCCESS on successful read, even if the number of entries read does not equal the max number specified. The size of the output value should be checked.
dp_rb | (IN, string) ring buffer DP |
values | (OUT, dyn_string) values read (size may != max) |
max | (IN, int) max number of values to read |
if | the DP could not be read from if the DP could not be written to |
int fwRPC_RingBuffer_write | ( | string | dp_rb, |
string | value | ||
) |
Write to a ring buffer.
If the ring buffer is full, i.e.: read_idx == write_idx, the write will fail.
dp_rb | (IN, string) ring buffer DP |
value | (IN, string) value to write |
if | the DP could not be written to if the DP could not be read |
int fwRPC_RingBuffer_writeMany | ( | string | dp_rb, |
dyn_string | values, | ||
int | to_insert, | ||
int & | inserted | ||
) |
Write many values to a ringbuffer. Always returns fwRPC_RingBuffer_ESUCCESS on successful insertion, even if inserted != to_insert. The value of inserted should always be checked. fwRPC_RingBuffer_EFULL is not returned if only a part of values is inserted.
If to_insert is set to -1, the function will attempt to insert all the elements.
dp_rb | (IN, string) ring buffer DP |
values | (IN, dyn_string) values to insert |
to_insert | (IN, int) number of entries to insert. Attempts to insert all elements if set to -1. |
inserted | (OUT, int) number of elements actually inserted |