#ifndef RC_RING_BUFFER_H
#define RC_RING_BUFFER_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct rc_ringbuf_t {
double* d; int size; int index; int initialized;} rc_ringbuf_t;
#define RC_RINGBUF_INITIALIZER {\
.d = NULL,\
.size = 0,\
.index = 0,\
.initialized = 0}
rc_ringbuf_t rc_ringbuf_empty(void);
int rc_ringbuf_alloc(rc_ringbuf_t* buf, int size);
int rc_ringbuf_free(rc_ringbuf_t* buf);
int rc_ringbuf_reset(rc_ringbuf_t* buf);
int rc_ringbuf_insert(rc_ringbuf_t* buf, double val);
double rc_ringbuf_get_value(rc_ringbuf_t* buf, int position);
double rc_ringbuf_std_dev(rc_ringbuf_t buf);
#ifdef __cplusplus
}
#endif
#endif