CARMA C++
checking.h
Go to the documentation of this file.
1 #ifndef CARMA_UTIL_CHECKING_H
2 #define CARMA_UTIL_CHECKING_H
3 
4 
7 
8 
14 
15 #ifndef CARMA_CHECKED_BUILD
16  #define CARMA_CHECKED_BUILD 0
17 #endif
18 
19 
20 #if CARMA_CHECKED_BUILD
21 
22 
23 namespace carma {
24 namespace util {
25 
26 void CheckingMessage( const char * messagePrefix,
27  const char * message,
28  const char * messageSuffix,
29  const char * fileName,
30  const long lineNo );
31 
32 } // namespace util
33 } // namespace carma
34 
35 
36 #define CARMA_CHECK(assertion) \
37  do { \
38  if ( !(assertion) ) { \
39  carma::util::CheckingMessage( \
40  "Assertion failed CARMA_CHECK( ", \
41  #assertion, \
42  " )", \
43  __FILE__, \
44  __LINE__); \
45  } \
46  } while ( false )
47 
48 
49 #else
50 
51 
52 #define CARMA_CHECK(assertion)
53 
54 
55 #endif
56 
57 
58 #endif