assert1.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2008 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 //**************************************************************************/
00011 
00012 #pragma once
00013 
00014 #include "buildver.h"   // Pulls in ALPHABETA
00015 #include "utilexp.h"
00016 #include "maxheap.h"
00017 
00027 UtilExport int assert1(int line, char* file, char* function = NULL, char* expr = NULL );
00028 
00029 #undef assert
00030 
00031 // The following macro's have been deprecated.
00032 // Use DbgAssert instead
00033 #pragma deprecated("MaxAssert")
00034 #pragma deprecated("assert64")
00035 #pragma deprecated("DbgAssert64")
00036 #pragma deprecated("MaxAssert64")
00037 
00062 // @{
00063 #if !defined( NDEBUG ) || defined( MAX_ASSERTS_ACTIVE_IN_RELEASE_BUILD )
00064 #  define assert( expr )    ( (expr) || assert1( __LINE__, __FILE__, __FUNCTION__, (#expr) ) )
00065 #  define DbgAssert( expr ) ( (expr) || assert1( __LINE__, __FILE__, __FUNCTION__, (#expr) ) )
00066 #  define DbgVerify( expr ) ( (expr) || assert1( __LINE__, __FILE__, __FUNCTION__, (#expr) ) )
00067 #  define MAX_ASSERTS_ACTIVE
00068 #else    
00069 #  define assert( expr )      ((void *)0)
00070 #  define DbgAssert( expr )
00071 #  define DbgVerify( expr ) ( expr )
00072 #  undef  MAX_ASSERTS_ACTIVE
00073 #endif
00074 // @}
00075 
00076 //-----------------------------------------------------------------------------
00077 
00085 class CAssertCB : public MaxHeapOperators 
00086 {
00087     public:
00091     enum AssertResult 
00092     {
00093         ASSERTCB_IGNORE,    
00094         ASSERTCB_CANCEL,    
00095         ASSERTCB_CONTINUE   
00096     };
00097 
00106     virtual AssertResult AssertEx(int line, char* file, char* function = NULL, char* expression = NULL) =0;
00107 };
00108 
00122 UtilExport CAssertCB* SetAssertCB(CAssertCB* cb);
00123