src/c/so3_error.h Source File

# so3_error.h

Go to the documentation of this file.

    00001 // S03 package to perform Wigner transform on the rotation group SO(3)
    00002 // Copyright (C) 2013 Martin Büttner and Jason McEwen
    00003 // See LICENSE.txt for license details
    00004
    00012 #ifndef SO3_ERROR
    00013 #define SO3_ERROR
    00014
    00015 #include <stdio.h>
    00016
    00017 // Put this macro in a block so that it can be used with single-line
    00018 // if-statements.
    00019 #define SO3_ERROR_GENERIC(comment)                                      \
    00020 {                                                                       \
    00021   printf("ERROR: %s.\n", comment);                                      \
    00022   printf("ERROR: %s <%s> %s %s %s %d.\n",                               \
    00023          "Occurred in function",                                        \
    00024            __PRETTY_FUNCTION__,                                         \
    00025            "of file", __FILE__,                                         \
    00026            "on line", __LINE__);                                        \
    00027   exit(1);                                                              \
    00028 }
    00029
    00030 #define SO3_ERROR_MEM_ALLOC_CHECK(pointer)                              \
    00031   if(pointer == NULL) {                                                 \
    00032     SO3_ERROR_GENERIC("Memory allocation failed")                       \
    00033   }
    00034
    00035 #endif