VR-Vantage API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtAssert.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #ifdef _DEBUG
12  #include <cassert>
13  #define Assert assert
14 #else
15  #ifdef ASSERT_IN_RELEASE
16  // undefine the ndebug first
17  #ifdef NDEBUG
18  #undef NDEBUG
19  #define RESET_NDEBUG
20  #endif
21 
22  // do the assert
23  #include <cassert>
24  #define Assert assert
25 
26  //redefine ndebug if it has been defined previously
27  #ifdef RESET_NDEBUG
28  #undef RESET_NDEBUG
29  #define NDEBUG
30  #endif
31  #else
32  #define Assert(exp) static_cast<void>(0)
33  #endif
34 #endif
35 
36  #define ASSERT_PREDICATE(p) Assert(p);
37 
38  #define ASSERT_RETURN(p) Assert(p); \
39  if (p==0)\
40  return;
41  #define ASSERT_RETURN_ZERO(p) Assert(p); \
42  if (p==0)\
43  return 0;
44 
45  #define ASSERT_PREDICATE_RETURN(p) Assert((p)); \
46  if ((p)==false)\
47  return;
48 
49  #define ASSERT_PREDICATE_RETURN_ZERO(p) Assert((p)); \
50  if ((p)==false)\
51  return 0;
52 
53  #define ASSERT_PREDICATE_RETURN_DEFAULT_CONSTRUCTOR(V, p) Assert((p)); \
54  if ((p)==false)\
55  return V();
56 
57  #define ASSERT_PREDICATE_RETURN_FALSE(p) Assert((p)); \
58  if ((p)==false)\
59  return false;
60 
61  #define ASSERT_PREDICATE_RETURN_TRUE(p) Assert((p)); \
62  if ((p)==false)\
63  return true;
64 
65  #define ASSERT_RETURN_EMPTY_STRING(p) Assert(p); \
66  if (p==0)\
67  return "";
68 
69  #define ASSERT_RETURN_FALSE(p) Assert(p); \
70  if (p==0)\
71  return false;
72  #define ASSERT_RETURN_TRUE(p) Assert(p); \
73  if (p==0)\
74  return true;
75 
76  #define ASSERT_EQUAL_RETURN_ZERO(x,y) Assert(x==y);\
77  if (x!=y) \
78  return 0;
79 
80 ;


Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)