Proto  3.2
Proto_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 _Proto_MAYDAY_H_
12 #define _Proto_MAYDAY_H_
13 #include <cstdio>
14 #include "Proto_Parstream.H"
15 
16 #define CH_DEFAULT_ERROR_CODE 255
17 namespace Proto
18 {
19  /// Error-reporting Functions
20  /**
21  This class consists entirely of static error-reporting functions that are
22  used throughout the MayDay implementation together with a version string.
23  In the best of all possible worlds we'd use a namespace, but we aren't
24  there, yet :-) Note that all the output functions add a terminating
25  exclamation mark, so there is no need to add any punction to sentences
26  that get output explicitly.
27  */
28  template <typename T=void>
29  class MayDay
30  {
31  public:
32 
33  static bool s_debugSpew;
34  /// Print out message to cerr and exit with the specified exit code.
35  [[noreturn]] inline static void Error(const char * const a_msg = m_nullString, int exit_code = CH_DEFAULT_ERROR_CODE);
36 
37  /// Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel).
38  /** The exit code depends on the compiler and MPI implementation. */
39  inline static void Abort(const char * const a_msg = m_nullString);
40 
41  /// Print out message to cerr and continue
42  inline static void Warning(const char * const a_msg = m_nullString);
43 
44  static const char * const version;
45 
46  protected:
47  static const char * const m_nullString;
48  };
49 } // end Proto namespace.
50 #endif
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).
static void Error(const char *const a_msg=m_nullString, int exit_code=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
static const char *const version
Definition: Proto_MayDay.H:44
static const char *const m_nullString
Definition: Proto_MayDay.H:47
static void Warning(const char *const a_msg=m_nullString)
Print out message to cerr and continue.
#define CH_DEFAULT_ERROR_CODE
Definition: Proto_MayDay.H:16
static bool s_debugSpew
Definition: Proto_MayDay.H:33
Error-reporting Functions.
Definition: Proto_MayDay.H:29
Definition: Proto_Array.H:17