Robot Control Library
ring_buffer.h File Reference

Go to the source code of this file.

Data Structures

struct  rc_ringbuf_t
 Struct containing state of a ringbuffer and pointer to dynamically allocated memory. More...
 

Macros

#define RC_RINGBUF_INITIALIZER
 

Typedefs

typedef struct rc_ringbuf_t rc_ringbuf_t
 Struct containing state of a ringbuffer and pointer to dynamically allocated memory. More...
 

Functions

rc_ringbuf_t rc_ringbuf_empty (void)
 Returns an rc_ringbuf_t struct which is completely zero'd out with no memory allocated for it. More...
 
int rc_ringbuf_alloc (rc_ringbuf_t *buf, int size)
 Allocates memory for a ring buffer and initializes an rc_ringbuf_t struct. More...
 
int rc_ringbuf_free (rc_ringbuf_t *buf)
 Frees the memory allocated for buffer buf. More...
 
int rc_ringbuf_reset (rc_ringbuf_t *buf)
 Sets all values in the buffer to 0.0f and sets the buffer index back to 0. More...
 
int rc_ringbuf_insert (rc_ringbuf_t *buf, double val)
 Puts a new float into the ring buffer and updates the index accordingly. More...
 
double rc_ringbuf_get_value (rc_ringbuf_t *buf, int position)
 Fetches the float which is 'position' steps behind the last value added to the buffer. More...
 
double rc_ringbuf_std_dev (rc_ringbuf_t buf)
 Returns the standard deviation of all values in the ring buffer. More...