BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
assert.hpp File Reference
#include <sstream>
#include <stdexcept>
#include <vector>
#include "typedefs.hpp"
#include "fn_sprint.hpp"
Include dependency graph for assert.hpp:

Go to the source code of this file.

Namespaces

namespace  belfem
 USER GUIDES:
namespace  belfem::assert

Macros

#define BELFEM_ASSERTIONS_ACTIVE   1
#define BELFEM_ASSERT(aCheck, ...)
#define BELFEM_ERROR(aCheck, ...)

Functions

std::vector< std::string > belfem::assert::wrap_lines (std::size_t aMaxWidth, const std::string &aLine)
void belfem::assert::hatch_dragon (std::vector< std::string > &aDragon)
void belfem::assert::print_line (const std::vector< std::string > &aDragon, std::size_t &aCounter)
void belfem::assert::print_line (const std::vector< std::string > &aDragon, const string &aLine, std::size_t &aCounter)
void belfem::assert::print_line (const string &aLine)
void belfem::assert::get_lines (const string &aWhat, std::vector< std::string > &aLines)
void belfem::assert::print_errorbox (const std::string &aLocation, const std::string &aTask, const std::string &aCheck, const std::vector< std::string > &aMessage)
void belfem::assert::error_abort ()
bool belfem::assert::throw_on_error ()
 How a failed check reacts: true throws the exception, false calls error_abort().
void belfem::assert::set_throw_on_error (const bool aValue)
bool belfem::assert::syslog_on_error ()
 Whether a failed check also writes its message to the system log ( syslog, identity "belfem", LOG_CRIT ).
void belfem::assert::set_syslog_on_error (const bool aValue)
void belfem::assert::log_to_syslog (const std::string &aLocation, const std::string &aCheck, const std::vector< std::string > &aMessage)
template<typename Exception>
void belfem::assert::error (const std::string &aLocation, const std::string &aTask, const std::string &aCheck, const Exception &aException=Exception())
std::string belfem::assert::extract_function_name (const std::string &aPrettyFunction)
template<typename ... Args>
void belfem::assert::belfem_assert (const std::string &aFile, const std::size_t &aLine, const std::string &aFunction, const std::string &aCheck, const Args ... aArgs)

Macro Definition Documentation

◆ BELFEM_ASSERT

#define BELFEM_ASSERT ( aCheck,
... )
Value:
do \
{ \
if ( ! ( aCheck ) ) \
{ \
belfem::assert::belfem_assert( \
__FILE__, \
__LINE__, \
__PRETTY_FUNCTION__, \
#aCheck, \
__VA_ARGS__ \
); \
} \
} while ( false )

◆ BELFEM_ASSERTIONS_ACTIVE

#define BELFEM_ASSERTIONS_ACTIVE   1

◆ BELFEM_ERROR

#define BELFEM_ERROR ( aCheck,
... )
Value:
do \
{ \
if ( ! ( aCheck ) ) \
{ \
belfem::assert::belfem_assert( \
__FILE__, \
__LINE__, \
__PRETTY_FUNCTION__, \
#aCheck, \
__VA_ARGS__ \
); \
} \
} while ( false )