csnip  0.1
Macros
ringbuf.h File Reference

Ring buffers. More...

#include <stddef.h>
#include <csnip/err.h>
#include <csnip/preproc.h>
Include dependency graph for ringbuf.h:

Go to the source code of this file.

Macros

#define csnip_ringbuf_Init(head, len, N)
 Initialize an empty ring buffer. More...
 
#define csnip_ringbuf_GetHeadIdx(head, len, N, ret, err)
 Compute the location of the head in the backing array. More...
 
#define csnip_ringbuf_GetTailIdx(head, len, N, ret, err)    csnip_ringbuf__GetTailIdx((head), (len), (N), (ret), (err))
 Compute the location of the tail in the backing array. More...
 
#define csnip_ringbuf_PushHeadIdx(head, len, N, err)    csnip_ringbuf__PushHeadIdx((head), (len), (N), (err))
 Add an element at the head. More...
 
#define csnip_ringbuf_PopHeadIdx(head, len, N, err)    csnip_ringbuf__PopHeadIdx((head), (len), (N), (err))
 Remove an element from the head.
 
#define csnip_ringbuf_PushTailIdx(head, len, N, err)    csnip_ringbuf__PushTailIdx((head), (len), (N), (err))
 Add an element to the tail. More...
 
#define csnip_ringbuf_PopTailIdx(head, len, N, err)    csnip_ringbuf__PopTailIdx((head), (len), (N), (err))
 Remove an element from the tail.
 
#define csnip_ringbuf_IsFull(head, len, N)   ((len) == (N))
 Check whether a ringbuffer is full. More...
 
#define csnip_ringbuf_IsEmpty(head, len, N)   ((len) == 0)
 Check whether a ringbuffer is empty. More...
 
#define csnip_ringbuf_CheckIdx(head, len, N, idx, err)    csnip_ringbuf__CheckIdx((head), (len), (N), (idx), (err))
 Check whether a given index is valid. More...
 
#define csnip_ringbuf_AddWrap(N, amount, idx)
 Compute the sum idx + amount with cyclic wrap. More...
 
#define csnip_ringbuf_AddWrapSet(N, amount, idx)
 Compute idx += amount. More...
 
#define csnip_ringbuf_SubWrap(N, amount, idx)
 Compute idx - amount with cyclic wrap. More...
 
#define csnip_ringbuf_SubWrapSet(N, amount, idx)
 Compute idx -= amount with cyclic wrap. More...
 
#define csnip_ringbuf_PushHead(head, len, N, arr, val, err)
 Add an element to the head. More...
 
#define csnip_ringbuf_PopHead(head, len, N, arr, ret, err)
 Remove an element from the head. More...
 
#define csnip_ringbuf_PushTail(head, len, N, arr, val, err)
 Add an element to the tail. More...
 
#define csnip_ringbuf_PopTail(head, len, N, arr, ret, err)
 Remove an element from the tail. More...
 
#define CSNIP_RINGBUF_DECL_IDX_FUNCS(scope, prefix, idx_type, gen_args)
 Generator macro to declare index functions. More...
 
#define CSNIP_RINGBUF_DECL_VAL_FUNCS(scope, prefix, val_type, gen_args)
 Declare value functions. More...
 
#define CSNIP_RINGBUF_DEF_IDX_FUNCS(scope, prefix, idx_type, gen_args, head, len, N, err)
 Define Ringbuffer index functions. More...
 
#define CSNIP_RINGBUF_DEF_VAL_FUNCS(scope, prefix, val_type, gen_args, head, len, N, arr, err)
 Define Ringbuffer value functions. More...