Go to the documentation of this file.
24 #ifndef __TUM_UTILS_H__
25 #define __TUM_UTILS_H__
30 #define PRINT_ERROR(msg, ...) \
31 fprintf(stderr, "[ERROR] " msg, ##__VA_ARGS__); \
32 fprintf(stderr, " @-> %s:%d, %s\n", __FILE__, __LINE__, __func__)
int rbuf_put_buffer(rbuf_handle_t rbuf)
Used when a reference to the next buffer item is already filled, incrementing the next buffer item sh...
Definition: TUM_Utils.c:340
void rbuf_free(rbuf_handle_t rbuf)
Frees a ring buffer.
Definition: TUM_Utils.c:313
unsigned char rbug_full(rbuf_handle_t rbuf)
Checks if the buffer is full.
Definition: TUM_Utils.c:461
char * tumUtilGetBinFolderPath(char *bin_path)
Gets the execution folder of the current program, assumes that program is executing from a folder "bi...
Definition: TUM_Utils.c:93
unsigned char rbuf_empty(rbuf_handle_t rbuf)
Checks if the buffer is empty or not.
Definition: TUM_Utils.c:450
size_t rbuf_capacity(rbuf_handle_t rbuf)
Returns the maximum number of elements that the ring buffer can store.
Definition: TUM_Utils.c:494
size_t rbuf_size(rbuf_handle_t rbuf)
Returns the number of elements currently stored in the ring buffer.
Definition: TUM_Utils.c:473
int rbuf_put(rbuf_handle_t rbuf, void *data)
Fills the next available buffer slot, if a slot is free.
Definition: TUM_Utils.c:354
int rbuf_get(rbuf_handle_t rbuf, void *data)
Returns a copy of the next buffer item's data.
Definition: TUM_Utils.c:427
void * rbuf_handle_t
A handle to a ring buffer object, created using rbuf_init()
Definition: TUM_Utils.h:90
void rbuf_reset(rbuf_handle_t rbuf)
Resets the ring buffer to it's initial state.
Definition: TUM_Utils.c:324
char * tumUtilFindResourcePath(char *resource_name)
Similar to tumUtilFindResource() only returning the file's path instead of the opened FILE's referenc...
Definition: TUM_Utils.c:207
FILE * tumUtilFindResource(char *resource_name, const char *mode)
Searches for a file in the RESOURCES_DIRECTORY and returns a FILE * if found.
Definition: TUM_Utils.c:193
int tumUtilIsCurGLThread(void)
Checks if the calling thread is the thread that currently holds the GL context.
Definition: TUM_Utils.c:61
rbuf_handle_t rbuf_init(size_t item_size, size_t item_count)
Initialized a ring buffer object with a certain number of objects of a given size.
Definition: TUM_Utils.c:257
char * tumUtilPrependPath(char *path, char *file)
Prepends a path string to a filename.
Definition: TUM_Utils.c:79
int rbuf_fput(rbuf_handle_t rbuf, void *data)
Fills the next available buffer, overwriting data if the ring buffer is full.
Definition: TUM_Utils.c:378
void * rbuf_get_buffer(rbuf_handle_t rbuf)
Returns a reference to the data of the next ring buffer entry.
Definition: TUM_Utils.c:399
void tumUtilSetGLThread(void)
The calling thread is registered as holding the current GL context.
Definition: TUM_Utils.c:72
rbuf_handle_t rbuf_init_static(size_t item_size, size_t item_count, void *buffer)
Initialized a ring buffer object with a certain number of objects of a given size into a statically a...
Definition: TUM_Utils.c:285