fwRPC
 All Files Functions Variables
fwRPC_RingBuffer.ctl File Reference

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_read (string dp_rb, string &value)
 

Variables

private global const string DPE_VALUE = ":_original.._value"
 
public global const string fwRPC_RingBuffer_DPT = "_FwRPC_RingBuffer"
 
public global const string fwRPC_RingBuffer_DPE_READ = ".read_idx"
 
public global const string fwRPC_RingBuffer_DPE_WRITE = ".write_idx"
 
public global const string fwRPC_RingBuffer_DPE_SIZE = ".size"
 
public global const string fwRPC_RingBuffer_DPE_VALUES = ".values"
 
public global const int fwRPC_RingBuffer_ESUCCESS = 0
 
public global const int fwRPC_RingBuffer_EERROR = -1
 
public global const int fwRPC_RingBuffer_EFULL = -2
 
public global const int fwRPC_RingBuffer_EEMPTY = -2
 
public global const int fwRPC_RingBuffer_ENODP = -1
 
public global const int fwRPC_RingBuffer_DEFAULT_SIZE = 50
 

Detailed Description

Datapoint-based ring buffer implementation.

Function Documentation

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.

Parameters
dp_rb(IN, string) DP name
size(IN, uint) size of the ring buffer
Returns
0 on success
Exceptions
ifthe 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

Parameters
dp_rb(IN, string) ring buffer DP
value(IN, string) value read
Returns
0 on success -1 if the DP doesn't exist -2 if there are no new values to read
Exceptions
ifthe 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.

Parameters
dp_rb(IN, string) ring buffer DP
value(IN, string) value to write
Returns
0 on success -1 if the DP doesn't exist -2 if the buffer is full
Exceptions
ifthe DP could not be written to if the DP could not be read