VR-Link API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vlAssert.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 *******************************************************************************/
6 #pragma once
7 
8 #include "vlExceptions.h"
9 #include "vlPrint.h"
10 
11 
12 #ifdef DtUSE_UTILITIES_NAMESPACE
13 namespace DtUSE_UTILITIES_NAMESPACE
14 {
15 #endif
16 
19 
20 
29 {
30 public:
31 
32  typedef void (*DtAssertFunc)
33  (const char* fName, const char *func, int fLine, const char*operation);
34 
39  static DtAssertFunc theAssertFunction;
40 
43 
46  static const DtAssertFunc theNoAssertFunction;
47 
48  static DtAssertFunc getAssertFunction();
49  static void setAssertFunction(DtAssertFunc func);
50 
52  static void warn();
53 
56  static void fatal();
57 
59  static void ignore();
60 
61 
62 protected:
63 
64  static void defaultFatal(const char* file, const char *func, int line, const char *operation);
65  static void defaultNonFatal(const char* file, const char *func, int line, const char *operation);
66 
67 private:
68 
70  DtAssert();
71 
73  DtAssert(const DtAssert&other);
74 
76  DtAssert &operator=(const DtAssert&);
77 
78 };
79 
81 #if defined(__GNUC__)
82 #define __DTFUNC__ __PRETTY_FUNCTION__
83 #elif defined(_WIN32) && (_MSC_VER != 1200)
84 #define __DTFUNC__ __FUNCTION__
85 #else
86 #define __DTFUNC__ "-Unknown Function-"
87 #endif
88 
100 #define DtAssert(a) \
101 ((DtAssert::theAssertFunction != DtAssert::theNoAssertFunction && !(a)) ? \
102  DtAssert::theAssertFunction(__FILE__,__DTFUNC__, __LINE__, #a) : ((void)0 ) )
103 
104 
105 #ifdef DtUSE_UTILITIES_NAMESPACE
106 }
107 #endif
108 
This file declares vlException.
static const DtAssertFunc theNoAssertFunction
always set to null, when theAssertFunction is set to this value then DtAssert is a no-op ...
Definition: vlAssert.h:46
#define DtAssert(a)
DtAssert is a more flexible version of std::assert.
Definition: vlAssert.h:100
Functions in vlPrint.h provide an error and print facility for vrlink.
DtAssert (the class) helps implement DtAssert (the MACRO) by storing static member variables...
Definition: vlAssert.h:28
DtOutputStream is used for all toolkit output.
Definition: vlPrint.h:282
static DtAssertFunc theAssertFunction
The function to call when a DtAssert fails.
Definition: vlAssert.h:39
#define DT_DLL_VLUTIL
Definition: vlMachineTypes.h:109
static DtOutputStream & theAssertStream
the DtOutputStream to use for DtAssert() warnings
Definition: vlAssert.h:42

Document ID: Generated on Tue Feb 2 21:02:17 EST 2021 from SVN revision 223668
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)