00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 #ifndef _MAYDAY_H_ 00012 #define _MAYDAY_H_ 00013 #include "BaseNamespaceHeader.H" 00014 00015 #define CH_DEFAULT_ERROR_CODE 255 00016 00017 /// Error-reporting Functions 00018 /** 00019 This class consists entirely of static error-reporting functions that are 00020 used throughout the MayDay implementation together with a version string. 00021 In the best of all possible worlds we'd use a namespace, but we aren't 00022 there, yet :-) Note that all the output functions add a terminating 00023 exclamation mark, so there is no need to add any punction to sentences 00024 that get output explicitly. 00025 */ 00026 class MayDay 00027 { 00028 public: 00029 00030 static bool s_debugSpew; 00031 /// Print out message to cerr and exit with the specified exit code. 00032 [[noreturn]] static void Error(const char * const a_msg = m_nullString, int m_exitCode = CH_DEFAULT_ERROR_CODE); 00033 00034 /// Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel). 00035 /** The exit code depends on the compiler and MPI implementation. 00036 */ 00037 [[noreturn]] static void Abort(const char * const a_msg = m_nullString); 00038 00039 /// Print out message to cerr and continue 00040 static void Warning(const char * const a_msg = m_nullString); 00041 00042 static const char * const version; 00043 00044 protected: 00045 /// A null string used as a default argument by the other member functions 00046 static const char * const m_nullString; 00047 }; 00048 00049 #include "BaseNamespaceFooter.H" 00050 #endif