CppADCodeGen  2.4.3
A C++ Algorithmic Differentiation Package with Source Code Generation
cppadcg_assert.hpp
1 #ifndef CPPAD_CG_CPPADCG_ASSERT_INCLUDED
2 #define CPPAD_CG_CPPADCG_ASSERT_INCLUDED
3 /* --------------------------------------------------------------------------
4  * CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
5  * Copyright (C) 2012 Ciengis
6  *
7  * CppADCodeGen is distributed under multiple licenses:
8  *
9  * - Eclipse Public License Version 1.0 (EPL1), and
10  * - GNU General Public License Version 3 (GPL3).
11  *
12  * EPL1 terms and conditions can be found in the file "epl-v10.txt", while
13  * terms and conditions for the GPL3 can be found in the file "gpl3.txt".
14  * ----------------------------------------------------------------------------
15  * Author: Joao Leal
16  */
17 
18 #define CPPADCG_ASSERT_KNOWN(exp, msg) \
19 { if( ! ( exp ) ) \
20  CppAD::ErrorHandler::Call( \
21  true , \
22  __LINE__ , \
23  __FILE__ , \
24  #exp , \
25  msg ); \
26 }
27 
28 
29 #ifdef NDEBUG
30 #define CPPADCG_ASSERT_UNKNOWN(exp) // do nothing
31 #else
32 #define CPPADCG_ASSERT_UNKNOWN(exp) \
33 { if( ! ( exp ) ) \
34  CppAD::ErrorHandler::Call( \
35  false , \
36  __LINE__ , \
37  __FILE__ , \
38  #exp , \
39  "" ); \
40 }
41 #endif
42 
43 #ifndef NDEBUG
44 #define CPPADCG_IF_DEBUG(arg) arg
45 #else
46 #define CPPADCG_IF_DEBUG(arg)
47 #endif
48 
49 #endif