AcousticTracer 0.1.0
An acoustic raytracing library.
Loading...
Searching...
No Matches
at_result.h
Go to the documentation of this file.
1
5#ifndef AT_RESULT_H
6#define AT_RESULT_H
7
8#include "at.h"
9#include <stdarg.h>
10#include <stdio.h>
11#include <stdlib.h>
12
14
24static inline void AT_handle_result(const AT_Result res, const char *err_msg, ...)
25{
26 va_list args;
27 va_start(args, err_msg);
28
29 switch (res) {
30 case AT_OK:
31 break;
32
34 vfprintf(stderr, err_msg, args);
35 fprintf(stderr, "ALLOCATION ERROR\n");
36 break;
37
39 vfprintf(stderr, err_msg, args);
40 fprintf(stderr, "INVALID ARGUMENT\n");
41 break;
42
44 vfprintf(stderr, err_msg, args);
45 fprintf(stderr, "NETWORK_FAILURE\n");
46 break;
47 }
48 va_end(args);
49}
50
51#endif // AT_RESULT_H
The libraries public types and functions.
@ AT_ERR_NETWORK_FAILURE
Definition at.h:29
@ AT_OK
Definition at.h:25
@ AT_ERR_ALLOC_ERROR
Definition at.h:28
@ AT_ERR_INVALID_ARGUMENT
Definition at.h:26
AT_Result
Defines possible result types.
Definition at.h:24