50 const char *pFileName,
51 const char *pFunctionName,
64 const char *pFileName,
65 const char *pFunctionName,
114 const char * pFileName
162 #define IUF_ERROR_PUSH(maj,min,msg) iufErrorPush(__FILE__, __func__, __LINE__, maj, min, msg) 166 #define IUF_ERROR_PRINT(maj,min,msg) iufErrorPush(__FILE__, __func__, __LINE__, maj, min, msg);\ 171 #define IUF_ERROR_FMT_PUSH(maj,min,fmt,...) iufErrorFormatAndPush(__FILE__, __func__, __LINE__, maj, min, fmt, __VA_ARGS__) 177 #define IUF_ERROR_FMT_PRINT(maj,min,fmt,...) iufErrorFormatAndPush(__FILE__, __func__, __LINE__, maj, min, fmt, __VA_ARGS__);\ 186 #define IUF_ERR_ALLOC_NULL_N_RETURN(var, adt, retval) if ((var) == NULL) { \ 187 IUF_ERROR_PUSH(IUF_ERR_MAJ_MEMORY, IUF_ERR_MIN_ALLOC, "calloc failed for " #adt); \ 195 #define IUF_ERR_CHECK_NULL_N_RETURN(var, retval) if ((var) == NULL) { \ 196 IUF_ERROR_PUSH(IUF_ERR_MAJ_VALUE, IUF_ERR_MIN_ARG_NULL_VALUE, "argument " #var " was NULL"); \ 203 #define IUF_ERR_CHECK_EMPTYSTR_N_RETURN(var, return_value) if (strcmp((var),"") == 0) { \ 204 IUF_ERROR_PUSH(IUF_ERR_MAJ_VALUE, IUF_ERR_MIN_ARG_VALUE, "argument " #var " was empty"); \ 205 return return_value; \ 212 #define IUF_ERR_STRP_NULL_EMPTY(var, retval) IUF_ERR_CHECK_NULL_N_RETURN(var, retval); \ 213 IUF_ERR_CHECK_EMPTYSTR_N_RETURN(var, retval) 219 #define IUF_ERR_EVAL_N_RETURN(expr, retval) if (expr) { \ 220 IUF_ERROR_PUSH(IUF_ERR_MAJ_VALUE, IUF_ERR_MIN_ARG_VALUE, #expr ""); \ 228 #define IUF_ERR_GENERAL (100001) 229 #define IUF_ERR_MEMORY (100002) 230 #define IUF_ERR_VALUE (100003) 235 #define IUF_UNUSED(x) (void)(x) 240 #define IUF_ASSERT( IN_CONDITION ) \ 242 if ( !(IN_CONDITION) )\ 244 IUF_ERROR_PUSH(IUF_ERR_MAJ_GENERAL,IUF_ERR_MIN_ASSERT_FAILED, "General error occurred, assertion failed for " #IN_CONDITION); \ 245 exit( IUF_ERR_GENERAL ); \ 252 #define IUF_ASSERT_MEMORY( IN_CONDITION ) \ 254 if ( !(IN_CONDITION) )\ 256 IUF_ERROR_PUSH(IUF_ERR_MAJ_MEMORY,IUF_ERR_MIN_ASSERT_FAILED, "Memory error occurred, assertion failed for " #IN_CONDITION); \ 257 exit( IUF_ERR_MEMORY ); \ 264 #define IUF_ASSERT_VALUE( IN_CONDITION ) \ 266 if ( !(IN_CONDITION) )\ 268 IUF_ERROR_PUSH(IUF_ERR_MAJ_VALUE,IUF_ERR_MIN_ASSERT_FAILED, "Value error occurred, assertion failed for " #IN_CONDITION); \ 269 exit( IUF_ERR_VALUE ); \ 274 #endif // _IUFERROR_H hid_t IUF_ERR_MAJ_GENERAL
Major error handling class for general errors.
Definition: iufError.c:9
char * iufErrorString()
Create a string representation of the current Error stack.
Definition: iufError.c:264
int iufErrorPrint()
Prints the Error stack.
Definition: iufError.c:240
int iufErrorLog(IUF_BOOL enable)
Enable or disable IUF library error logging.
Definition: iufError.c:272
int iufErrorPush(const char *pFileName, const char *pFunctionName, int lineNumber, hid_t maj, hid_t min, char *msg)
Pushes an Error context onto the IUF error stack.
Definition: iufError.c:142
hid_t IUF_ERR_MIN_ARG_DUPLICATE_KEY
Minor error handling class for duplicate key errors in a dictionary.
Definition: iufError.c:21
hid_t IUF_ERR_MAJ_ERROR
Major error handling class for errors.
Definition: iufError.c:12
int iufErrorLogClear(void)
Removes all messages from the error stack.
Definition: iufError.c:253
int iufErrorSetStreamToFile(const char *pFileName)
Error messages wil be printed to the file with name pFileName.
Definition: iufError.c:325
hid_t IUF_ERR_MIN_ASSERT_FAILED
Minor error handling class for assertion errors.
Definition: iufError.c:25
int iufErrorAutoReportSet(IUF_BOOL enable)
Error messages wil printed when encountered by the library calls.
Definition: iufError.c:305
hid_t IUF_ERR_MAJ_HDF5
Major error handling class for hdf5 io errors.
Definition: iufError.c:13
hid_t IUF_ERR_MIN_MEMCOPY
Minor error handling class for memory errors.
Definition: iufError.c:17
hid_t IUF_ERR_MIN_FORMAT
Minor error handling class for formatting errors.
Definition: iufError.c:19
hid_t IUF_ERR_MIN_ARG_INVALID_KEY
Minor error handling class for invalid key errors in a dictionary.
Definition: iufError.c:22
hid_t IUF_ERR_MIN_ARG_NULL_VALUE
Minor error handling class for NULL values.
Definition: iufError.c:20
hid_t IUF_ERR_MAJ_VALUE
Major error handling class for value related errors.
Definition: iufError.c:11
hid_t IUF_ERR_MIN_HDF5
Minor error handling class for invalid hdf5 file io errors.
Definition: iufError.c:23
int iufErrorSetStream(FILE *stream)
Error messages wil be printed to this FILE stream (i.e. stdout would sent the errors to console outpu...
Definition: iufError.c:315
hid_t IUF_ERR_MIN_ALLOC
Minor error handling class for memory allocation value errors.
Definition: iufError.c:16
hid_t IUF_ERR_MIN_ARG_FILENAME
Minor error handling class for filename errors.
Definition: iufError.c:15
IUF_BOOL iufErrorAutoReportGet(void)
Error messages wil printed when encountered by the library calls.
Definition: iufError.c:296
int iufErrorGetCount(void)
Get the number of errors that occurred so far.
Definition: iufError.c:186
int iufErrorFormatAndPush(const char *pFileName, const char *pFunctionName, int lineNumber, hid_t maj, hid_t min, char *msgFormat,...)
Format and Push an Error context onto the IUF error stack.
Definition: iufError.c:161
int iufHDF5ErrorLog(IUF_BOOL enable)
Enable or disable HDF5 library error logging.
Definition: iufError.c:280
int IUF_BOOL
Definition: iufTypes.h:8
Top level header file, include this file to access all public iuf function declarations.
int iufErrorCloseFileStream()
Closes the filestream opened with iufErrorSetStreamToFile() and resets the stream to stderr...
Definition: iufError.c:339
hid_t IUF_ERR_MIN_ARG_VALUE
Minor error handling class for argument value errors.
Definition: iufError.c:24
hid_t IUF_ERR_MAJ_MEMORY
Major error handling class for memory errors.
Definition: iufError.c:10