VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtAssert.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 // If this is is 1, the asserts are enabled. Else they are compiled out
12 // The developer can turn them on for development (locally)
13 #define DT_ASSERT_ENABLED 0
14 
15 #if DT_ASSERT_ENABLED
16 #ifdef NDEBUG
17  #undef NDEBUG
18 #endif
19  // do the assert
20  #include <cassert>
21  #define Assert assert
22 #else
23  #define Assert(exp) static_cast<void>(0)
24 #endif
25 
26 #define ASSERT_PREDICATE(p) Assert(p);
27 
28 #define ASSERT_RETURN(p) Assert(p); \
29  if (p==0)\
30  return;
31 #define ASSERT_RETURN_ZERO(p) Assert(p); \
32  if (p==0)\
33  return 0;
34 
35 #define ASSERT_PREDICATE_RETURN(p) Assert((p)); \
36  if ((p)==false)\
37  return;
38 
39 #define ASSERT_PREDICATE_RETURN_ZERO(p) Assert((p)); \
40  if ((p)==false)\
41  return 0;
42 
43 #define ASSERT_PREDICATE_RETURN_DEFAULT_CONSTRUCTOR(V, p) Assert((p)); \
44  if ((p)==false)\
45  return V();
46 
47 #define ASSERT_PREDICATE_RETURN_FALSE(p) Assert((p)); \
48  if ((p)==false)\
49  return false;
50 
51 #define ASSERT_PREDICATE_RETURN_TRUE(p) Assert((p)); \
52  if ((p)==false)\
53  return true;
54 
55 #define ASSERT_RETURN_EMPTY_STRING(p) Assert(p); \
56  if (p==0)\
57  return "";
58 
59 #define ASSERT_RETURN_FALSE(p) Assert(p); \
60  if (p==0)\
61  return false;
62 #define ASSERT_RETURN_TRUE(p) Assert(p); \
63  if (p==0)\
64  return true;
65 
66 #define ASSERT_EQUAL_RETURN_ZERO(x,y) Assert(x==y);\
67  if (x!=y) \
68  return 0;
69 
70 

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)