FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fei_ErrMacros.hpp
Go to the documentation of this file.
1 #ifndef _fei_ErrMacros_hpp_
2 #define _fei_ErrMacros_hpp_
3 /*--------------------------------------------------------------------*/
4 /* Copyright 2005 Sandia Corporation. */
5 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
6 /* non-exclusive license for use of this work by or on behalf */
7 /* of the U.S. Government. Export of this program may require */
8 /* a license from the United States Government. */
9 /*--------------------------------------------------------------------*/
10 
11 #include "fei_iostream.hpp"
12 
13 //
14 //This file simply holds the macros used to check error returns
15 //and print appropriate output using cerr.
16 //
17 
18 #ifdef CHK_ERR
19 #undef CHK_ERR
20 #endif
21 
22 #ifndef fei_file
23 #define fei_file "unknown_fei_file"
24 #endif
25 
26 #define CHK_ERR(a) { int fei_ErrorCode = a; \
27  if (fei_ErrorCode != 0) { \
28  fei::console_out() << " FEI ERROR, " << fei_file << ", line " \
29  << __LINE__ << " " << fei_ErrorCode << FEI_ENDL; \
30  return(fei_ErrorCode); \
31  } }
32 
33 #ifdef ERReturn
34 #undef ERReturn
35 #endif
36 
37 #define ERReturn(a) { fei::console_out() << " FEI ERROR, " << fei_file << ", line " \
38  << __LINE__ << FEI_ENDL; \
39  return(-1); }
40 
41 #ifdef voidERReturn
42 #undef voidERReturn
43 #endif
44 
45 #define voidERReturn { fei::console_out() << " FEI ERROR, " << fei_file \
46  << ", line " << __LINE__ << FEI_ENDL; \
47  return; }
48 
49 #endif
50