Classes | Defines | Functions

assert1.h File Reference

#include "buildver.h"
#include "utilexp.h"
#include "maxheap.h"

Go to the source code of this file.

Classes

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

Defines

#define  assert(expr)   ( (expr) || assert1( __LINE__, __FILE__, __FUNCTION__, (#expr) ) )
#define  DbgAssert(expr)   ( (expr) || assert1( __LINE__, __FILE__, __FUNCTION__, (#expr) ) )
#define  DbgVerify(expr)   ( (expr) || assert1( __LINE__, __FILE__, __FUNCTION__, (#expr) ) )
#define  MAX_ASSERTS_ACTIVE

Functions

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

Function Documentation

UtilExport int assert1 ( int  line,
char *  file,
char *  function = NULL,
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 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