Flow123d  release_3.0.0-1025-gd4d7c13
Classes | Namespaces | Macros
asserts.hh File Reference

Definitions of ASSERTS. More...

#include <iostream>
#include <string>
#include <vector>
#include "system/exceptions.hh"

Go to the source code of this file.

Classes

class  feal::Exc_assert
 Helper class. More...
 
class  feal::Assert
 Class defining debugging messages. More...
 
class  feal::AssertNull
 

Namespaces

 feal
 

Macros

#define _FEAL_ASSERT_A(x)   _FEAL_ASSERT_OP(x, B)
 Internal clever macro A. More...
 
#define _FEAL_ASSERT_B(x)   _FEAL_ASSERT_OP(x, A)
 Internal clever macro B. More...
 
#define _FEAL_ASSERT_OP(x, next)   _FEAL_ASSERT_A.add_value((x), #x)._FEAL_ASSERT_ ## next
 Internal clever macro recursion. More...
 
#define FEAL_ASSERT(expr)
 Definition of assert for debug and release mode. More...
 
#define FEAL_ASSERT_DBG(expr)
 Definition of assert for debug mode only. More...
 
#define ASSERT_LT(a, b)   FEAL_ASSERT(a < b)(a)(b)
 Definition of comparative assert macro (Less Than) More...
 
#define ASSERT_LT_DBG(a, b)   FEAL_ASSERT_DBG(a < b)(a)(b)
 Definition of comparative assert macro (Less Than) only for debug mode. More...
 
#define ASSERT_LE(a, b)   FEAL_ASSERT(a <= b)(a)(b)
 Definition of comparative assert macro (Less or Equal) More...
 
#define ASSERT_LE_DBG(a, b)   FEAL_ASSERT_DBG(a <= b)(a)(b)
 Definition of comparative assert macro (Less or Equal) only for debug mode. More...
 
#define ASSERT_GT(a, b)   FEAL_ASSERT(a > b)(a)(b)
 Definition of comparative assert macro (Greater Than) More...
 
#define ASSERT_GT_DBG(a, b)   FEAL_ASSERT_DBG(a > b)(a)(b)
 Definition of comparative assert macro (Greater Than) only for debug mode. More...
 
#define ASSERT_GE(a, b)   FEAL_ASSERT(a >= b)(a)(b)
 Definition of comparative assert macro (Greater or Equal) More...
 
#define ASSERT_GE_DBG(a, b)   FEAL_ASSERT_DBG(a >= b)(a)(b)
 Definition of comparative assert macro (Greater or Equal) only for debug mode. More...
 
#define ASSERT_EQ(a, b)   FEAL_ASSERT(a == b)(a)(b)
 Definition of comparative assert macro (EQual) More...
 
#define ASSERT_EQ_DBG(a, b)   FEAL_ASSERT_DBG(a == b)(a)(b)
 Definition of comparative assert macro (EQual) only for debug mode. More...
 
#define ASSERT_PTR(ptr)   FEAL_ASSERT( (ptr) != nullptr )
 Definition of assert macro checking non-null pointer (PTR) More...
 
#define ASSERT_PTR_DBG(ptr)   FEAL_ASSERT_DBG( (ptr) != nullptr )
 Definition of assert macro checking non-null pointer (PTR) only for debug mode. More...
 
#define ASSERT(expr)   FEAL_ASSERT( expr)
 Allow use shorter versions of macro names if these names is not used with external library. More...
 
#define ASSERT_DBG(expr)   FEAL_ASSERT_DBG( expr)
 

Detailed Description

Definitions of ASSERTS.

 * Copyright (C) 2015 Technical University of Liberec. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Definition in file asserts.hh.

Macro Definition Documentation

#define _FEAL_ASSERT_A (   x)    _FEAL_ASSERT_OP(x, B)

Internal clever macro A.

Definitions of internal macros

Definition at line 221 of file asserts.hh.

#define _FEAL_ASSERT_B (   x)    _FEAL_ASSERT_OP(x, A)

Internal clever macro B.

Definition at line 223 of file asserts.hh.

#define _FEAL_ASSERT_OP (   x,
  next 
)    _FEAL_ASSERT_A.add_value((x), #x)._FEAL_ASSERT_ ## next

Internal clever macro recursion.

Definition at line 225 of file asserts.hh.

#define ASSERT (   expr)    FEAL_ASSERT( expr)

Allow use shorter versions of macro names if these names is not used with external library.

Definition at line 346 of file asserts.hh.

#define ASSERT_DBG (   expr)    FEAL_ASSERT_DBG( expr)

Definition at line 349 of file asserts.hh.

#define ASSERT_EQ (   a,
 
)    FEAL_ASSERT(a == b)(a)(b)

Definition of comparative assert macro (EQual)

Definition at line 327 of file asserts.hh.

#define ASSERT_EQ_DBG (   a,
 
)    FEAL_ASSERT_DBG(a == b)(a)(b)

Definition of comparative assert macro (EQual) only for debug mode.

Definition at line 331 of file asserts.hh.

#define ASSERT_GE (   a,
 
)    FEAL_ASSERT(a >= b)(a)(b)

Definition of comparative assert macro (Greater or Equal)

Definition at line 319 of file asserts.hh.

#define ASSERT_GE_DBG (   a,
 
)    FEAL_ASSERT_DBG(a >= b)(a)(b)

Definition of comparative assert macro (Greater or Equal) only for debug mode.

Definition at line 323 of file asserts.hh.

#define ASSERT_GT (   a,
 
)    FEAL_ASSERT(a > b)(a)(b)

Definition of comparative assert macro (Greater Than)

Definition at line 311 of file asserts.hh.

#define ASSERT_GT_DBG (   a,
 
)    FEAL_ASSERT_DBG(a > b)(a)(b)

Definition of comparative assert macro (Greater Than) only for debug mode.

Definition at line 315 of file asserts.hh.

#define ASSERT_LE (   a,
 
)    FEAL_ASSERT(a <= b)(a)(b)

Definition of comparative assert macro (Less or Equal)

Definition at line 303 of file asserts.hh.

#define ASSERT_LE_DBG (   a,
 
)    FEAL_ASSERT_DBG(a <= b)(a)(b)

Definition of comparative assert macro (Less or Equal) only for debug mode.

Definition at line 307 of file asserts.hh.

#define ASSERT_LT (   a,
 
)    FEAL_ASSERT(a < b)(a)(b)

Definition of comparative assert macro (Less Than)

Definition at line 295 of file asserts.hh.

#define ASSERT_LT_DBG (   a,
 
)    FEAL_ASSERT_DBG(a < b)(a)(b)

Definition of comparative assert macro (Less Than) only for debug mode.

Definition at line 299 of file asserts.hh.

#define ASSERT_PTR (   ptr)    FEAL_ASSERT( (ptr) != nullptr )

Definition of assert macro checking non-null pointer (PTR)

Definition at line 335 of file asserts.hh.

#define ASSERT_PTR_DBG (   ptr)    FEAL_ASSERT_DBG( (ptr) != nullptr )

Definition of assert macro checking non-null pointer (PTR) only for debug mode.

Definition at line 339 of file asserts.hh.

#define FEAL_ASSERT (   expr)
Value:
if ( !(expr) ) \
feal::Assert( #expr).set_context( __FILE__, __func__, __LINE__)._FEAL_ASSERT_A

Definition of assert for debug and release mode.

Undefining redefinitions of comparsion macros.

You can define FEAL_OVERRIDE_ASSERTS (e.g. in unit tests) and undefine macros with same name in external libraries. Definitions of assert macros

Definition at line 279 of file asserts.hh.

#define FEAL_ASSERT_DBG (   expr)
Value:
if ( !(expr) ) \
feal::AssertNull()._FEAL_ASSERT_A

Definition of assert for debug mode only.

Definition at line 289 of file asserts.hh.