assert1.h File Reference

assert1.h File Reference
#include "buildver.h"
#include "utilexp.h"
#include "maxheap.h"
#include "strbasic.h"
#include <tchar.h>

Classes

class  CAssertCB
 Callback class that allows for hooking into 3ds Max's assertion mechanims. More...
 

Macros

#define _3DSMAX_CURRENT_FUNCTION_   (_M(__FUNCTION__))
 
#define MAX_ASSERTS_ACTIVE
 
#define assert(expr)    ( (expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr)) ) )
 
#define DbgAssert(expr)   (void((expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr)))))
 
#define DbgVerify(expr)   ( (expr) || (assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr))), false) )
 

Functions

UtilExport int assert1 (int line, const char *file, const char *function=NULL, const char *expr=NULL)
 Method to be called to signal a violation of some assumption in the code. More...
 
UtilExport int assert1 (int line, const wchar_t *file, const wchar_t *function=NULL, const wchar_t *expr=NULL)
 
UtilExport int assert1 (int line, const wchar_t *file, const char *function=NULL, const wchar_t *expr=NULL)
 
UtilExport CAssertCBSetAssertCB (CAssertCB *cb)
 Sets a callback object that allows for performing a custom action when an assertion fails (is triggered). More...
 

Macro Definition Documentation

#define _3DSMAX_CURRENT_FUNCTION_   (_M(__FUNCTION__))
#define MAX_ASSERTS_ACTIVE

Function Documentation

UtilExport int assert1 ( int  line,
const char *  file,
const char *  function = NULL,
const char *  expr = NULL 
)

Method to be called to signal a violation of some assumption in the code.

This method should not be called directly, but rather via the various assertion macros such as DbgAssert, MaxAssert, DbgVerify, etc.

Parameters
line- the line number where the assertion occurred
file- the file path and name where the assertion occurred
function- the non-decorated name of the function in which the assertion occurred
expr- the expression that was asserted
Returns
Currently, this method either returns TRUE or it triggers the shutdown of 3ds Max
UtilExport int assert1 ( int  line,
const wchar_t *  file,
const wchar_t *  function = NULL,
const wchar_t *  expr = NULL 
)
UtilExport int assert1 ( int  line,
const wchar_t *  file,
const char *  function = NULL,
const wchar_t *  expr = NULL 
)
UtilExport CAssertCB* SetAssertCB ( CAssertCB cb)

Sets a callback object that allows for performing a custom action when an assertion fails (is triggered).

A plugin can supply an object that allows for executing a custom action when an assertion fails in 3ds Max. For details on the extent of possible customization see class CAssertCB. Currently, only one callback object can be active at any given time. This means that the callback installed by a plugin can be de-installed by another plugin. Thus, plugins should keep their callbacks active for as short of a time period as possible, and restore the previous callback object when they de-activate their own.

Parameters
cb- The new callback object to use
Returns
The old callback object or NULL if there's none set