Chombo + EB  3.0
MayDay.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _MAYDAY_H_
12 #define _MAYDAY_H_
13 #include "BaseNamespaceHeader.H"
14 
15 #define CH_DEFAULT_ERROR_CODE 255
16 
17 /// Error-reporting Functions
18 /**
19  This class consists entirely of static error-reporting functions that are
20  used throughout the MayDay implementation together with a version string.
21  In the best of all possible worlds we'd use a namespace, but we aren't
22  there, yet :-) Note that all the output functions add a terminating
23  exclamation mark, so there is no need to add any punction to sentences
24  that get output explicitly.
25 */
26 class MayDay
27 {
28 public:
29 
30  static bool s_debugSpew;
31  /// Print out message to cerr and exit with the specified exit code.
32  static void Error(const char * const a_msg = m_nullString, int m_exitCode = CH_DEFAULT_ERROR_CODE);
33 
34  /// Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel).
35  /** The exit code depends on the compiler and MPI implementation.
36  */
37  static void Abort(const char * const a_msg = m_nullString);
38 
39  /// Print out message to cerr and continue
40  static void Warning(const char * const a_msg = m_nullString);
41 
42  static const char * const version;
43 
44 protected:
45  /// A null string used as a default argument by the other member functions
46  static const char * const m_nullString;
47 };
48 
49 #include "BaseNamespaceFooter.H"
50 #endif
Error-reporting Functions.
Definition: MayDay.H:26
static bool s_debugSpew
Definition: MayDay.H:30
static const char *const m_nullString
A null string used as a default argument by the other member functions.
Definition: MayDay.H:46
#define CH_DEFAULT_ERROR_CODE
Definition: MayDay.H:15
static const char *const version
Definition: MayDay.H:42
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
static void Warning(const char *const a_msg=m_nullString)
Print out message to cerr and continue.
static void Abort(const char *const a_msg=m_nullString)
Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel).