#pragma once #include #include typedef struct int_ring_buf* int_ring_buf; /* Creates a new int_ring_buf of the given capacity. */ int_ring_buf irb_create(size_t capacity); /* Frees the memory of an int_ring_buf. */ void irb_destroy(int_ring_buf irb); /* Returns the capacity of the int_ring_buf. */ size_t irb_capacity(int_ring_buf irb); /* Returns the current number of elements in the int_ring_buf. */ size_t irb_size(int_ring_buf irb); /* Returns whether the int_ring_buf is empty. */ bool irb_is_empty(int_ring_buf irb); /* Returns whether the int_ring_buf is full. */ bool irb_is_full(int_ring_buf irb); /* Adds an element to the end of the int_ring_buf. UB if the int_ring_buf * is already full. */ void irb_enqueue(int_ring_buf irb, int element); /* Removes and returns an element from the front of the int_ring_buf. * UB if the int_ring_buf is already empty. */ int irb_dequeue(int_ring_buf irb);