CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
Macros
assert.h File Reference

warning and error makros More...

#include <iostream>
#include <sstream>

Go to the source code of this file.

Macros

#define CXZ_ERRTAG   __FILE__ << '@' << __LINE__ << '(' << __func__ << "): error"
 
#define CXZ_WARNTAG   __FILE__ << '@' << __LINE__ << ": warning"
 
#define CXZ_ERROR(errmsg)
 
#define CXZ_WARNING(errmsg)
 
#define CXZ_ASSERT(statement, errmsg)   if(not (statement)) { CXZ_ERROR(errmsg); }
 

Detailed Description

warning and error makros

Definition of macros that can be used for convenient error handling and warnings

Copyright (c) 2022 Christian Zimmermann. All rights reserved. Mail: chize.nosp@m.ta@f.nosp@m.3l.de

Definition in file assert.h.

Macro Definition Documentation

◆ CXZ_ASSERT

#define CXZ_ASSERT ( statement,
errmsg )   if(not (statement)) { CXZ_ERROR(errmsg); }

throw error if given statement is not fulfilled

Parameters
statementstatement to be checked
errmsgerror message

Definition at line 40 of file assert.h.

◆ CXZ_ERROR

#define CXZ_ERROR ( errmsg)
Value:
{ \
auto mkerr = [&](){ std::stringstream ss; ss << CXZ_ERRTAG << ": " << errmsg << std::flush; return ss.str(); }; \
throw std::runtime_error(mkerr()); }
#define CXZ_ERRTAG
Definition assert.h:18

throw error

Parameters
errmsgerror message

Definition at line 26 of file assert.h.

◆ CXZ_ERRTAG

#define CXZ_ERRTAG   __FILE__ << '@' << __LINE__ << '(' << __func__ << "): error"

library error tag

Definition at line 18 of file assert.h.

◆ CXZ_WARNING

#define CXZ_WARNING ( errmsg)
Value:
{\
std::cerr << CXZ_WARNTAG << ": " << errmsg << std::endl; }
#define CXZ_WARNTAG
Definition assert.h:21

print warning

Parameters
errmsgwarning message

Definition at line 33 of file assert.h.

◆ CXZ_WARNTAG

#define CXZ_WARNTAG   __FILE__ << '@' << __LINE__ << ": warning"

library warning tag

Definition at line 21 of file assert.h.