FEI Version of the Day
fei_ErrMacros.hpp
00001 #ifndef _fei_ErrMacros_hpp_
00002 #define _fei_ErrMacros_hpp_
00003 /*--------------------------------------------------------------------*/
00004 /*    Copyright 2005 Sandia Corporation.                              */
00005 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00006 /*    non-exclusive license for use of this work by or on behalf      */
00007 /*    of the U.S. Government.  Export of this program may require     */
00008 /*    a license from the United States Government.                    */
00009 /*--------------------------------------------------------------------*/
00010 
00011 #include "fei_iostream.hpp"
00012 
00013 //
00014 //This file simply holds the macros used to check error returns
00015 //and print appropriate output using cerr.
00016 //
00017 
00018 #ifdef CHK_ERR
00019 #undef CHK_ERR
00020 #endif
00021 
00022 #ifndef fei_file
00023 #define fei_file "unknown_fei_file"
00024 #endif
00025 
00026 #define CHK_ERR(a) { int fei_ErrorCode = a; \
00027                     if (fei_ErrorCode != 0) { \
00028                       fei::console_out() << " FEI ERROR, " << fei_file << ", line " \
00029                            << __LINE__ << " " << fei_ErrorCode << FEI_ENDL; \
00030                       return(fei_ErrorCode); \
00031                    } }
00032 
00033 #ifdef ERReturn
00034 #undef ERReturn
00035 #endif
00036 
00037 #define ERReturn(a) { fei::console_out() << " FEI ERROR, " << fei_file << ", line " \
00038                            << __LINE__ << FEI_ENDL; \
00039          return(-1); }
00040 
00041 #ifdef voidERReturn
00042 #undef voidERReturn
00043 #endif
00044 
00045 #define voidERReturn { fei::console_out() << " FEI ERROR, " << fei_file \
00046          << ", line " << __LINE__ << FEI_ENDL; \
00047          return; }
00048 
00049 #endif
00050 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends