VR-Link API Documentation for HLA 1.3
vlAssert.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 *******************************************************************************/
00006 #pragma once
00007 
00008 #include "vlExceptions.h"
00009 #include "vlPrint.h"
00010 
00011 
00012 #ifdef DtUSE_UTILITIES_NAMESPACE
00013 namespace DtUSE_UTILITIES_NAMESPACE
00014 {
00015 #endif
00016 
00019 
00020 
00028 class DT_DLL_VLUTIL DtAssert
00029 {
00030 public:
00031 
00032    typedef void (*DtAssertFunc)
00033       (const char* fName, const char *func, int fLine, const char*operation);
00034 
00039    static DtAssertFunc theAssertFunction;
00040 
00042    static DtOutputStream& theAssertStream;
00043 
00046    static const DtAssertFunc theNoAssertFunction;
00047 
00048    static DtAssertFunc getAssertFunction();
00049    static void setAssertFunction(DtAssertFunc func);
00050 
00052    static void warn();
00053 
00056    static void fatal();
00057 
00059    static void ignore();
00060 
00061 
00062 protected:
00063 
00064    static void defaultFatal(const char* file, const char *func, int line, const char *operation);
00065    static void defaultNonFatal(const char* file, const char *func, int line, const char *operation);
00066    
00067 private:
00068 
00070    DtAssert();
00071 
00073    DtAssert(const DtAssert&other);
00074 
00076    DtAssert &operator=(const DtAssert&);
00077 
00078 };
00079 
00081 #if defined(__GNUC__) 
00082 #define __DTFUNC__ __PRETTY_FUNCTION__
00083 #elif defined(_WIN32) && (_MSC_VER != 1200)
00084 #define __DTFUNC__ __FUNCTION__
00085 #else
00086 #define __DTFUNC__ "-Unknown Function-"
00087 #endif
00088 
00100 #define DtAssert(a) \
00101 ((DtAssert::theAssertFunction != DtAssert::theNoAssertFunction && !(a)) ? \
00102     DtAssert::theAssertFunction(__FILE__,__DTFUNC__, __LINE__, #a) : ((void)0 )  )
00103 
00104 
00105 #ifdef DtUSE_UTILITIES_NAMESPACE
00106 } 
00107 #endif
00108 

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)