OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
Macros
UtilError.hpp File Reference

Logging error and warning messages. More...

#include <iomanip>
#include <iostream>
#include <sstream>

Go to the source code of this file.

Macros

#define __ERRORLOG_HXX__
 
#define OCP_LOCATION
 Print out location at (file, line) and function name. More...
 
#define OCP_MESSAGE(msg)
 Log error messages. More...
 
#define OCP_WARNING(msg)
 Log warning messages. More...
 
#define OCP_ABORT(msg)
 Abort if critical error happens. More...
 
#define OCP_ASSERT(cond, msg)
 Assert condition and log user messages in DEBUG mode. More...
 
#define OCP_FUNCNAME
 Print Function Name. More...
 

Detailed Description

Logging error and warning messages.

Author
Ronghong Fan
Date
Nov/01/2019

Copyright (C) 2019–present by the OpenCAEPoro team. All rights reserved.

Released under the terms of the GNU Lesser General Public License 3.0 or later.

Definition in file UtilError.hpp.

Macro Definition Documentation

◆ __ERRORLOG_HXX__

#define __ERRORLOG_HXX__

indicate ErrorLog.hxx has been included before

Definition at line 13 of file UtilError.hpp.

◆ OCP_ABORT

#define OCP_ABORT (   msg)
Value:
do { \
OCP_MESSAGE("### ABORT: " << (msg)); \
std::abort(); \
} while (false)

Abort if critical error happens.

Definition at line 47 of file UtilError.hpp.

◆ OCP_ASSERT

#define OCP_ASSERT (   cond,
  msg 
)
Value:
do { \
} while (false)

Assert condition and log user messages in DEBUG mode.

Definition at line 58 of file UtilError.hpp.

◆ OCP_FUNCNAME

#define OCP_FUNCNAME
Value:
do { \
} while (false)

Print Function Name.

Definition at line 73 of file UtilError.hpp.

◆ OCP_LOCATION

#define OCP_LOCATION
Value:
"\n --> function: " << __PRETTY_FUNCTION__ \
<< "\n --> file: " << __FILE__ << "::" << __LINE__

Print out location at (file, line) and function name.

Definition at line 21 of file UtilError.hpp.

◆ OCP_MESSAGE

#define OCP_MESSAGE (   msg)
Value:
do { \
std::ostringstream info; \
info << std::setprecision(16); \
info << msg << OCP_LOCATION << '\n'; \
std::cerr << info.str().c_str(); \
} while (false)
#define OCP_LOCATION
Print out location at (file, line) and function name.
Definition: UtilError.hpp:21

Log error messages.

Definition at line 28 of file UtilError.hpp.

◆ OCP_WARNING

#define OCP_WARNING (   msg)
Value:
do { \
OCP_MESSAGE("### WARNING: " << (msg)); \
} while (false)

Log warning messages.

Definition at line 39 of file UtilError.hpp.