Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MDL API Assertions

Assertions. More...

Macros

#define mi_neuray_assert(expr)   mi_base_assert(expr)
 If expr evaluates to true this macro shall have no effect. More...
 
#define mi_neuray_assert_msg(expr, msg)   mi_base_assert_msg(expr, msg)
 If expr evaluates to true this macro shall have no effect. More...
 

Detailed Description

Assertions.

Include File:
#include <mi/neuraylib/assert.h>

MDL API supports quality software development with assertions. They are contained in various places in the MDL API include files.

These tests are mapped to corresponding base API assertions by default, which in turn are switched off by default to have the performance of a release build. To activate the tests, you need to define the two macros mi_neuray_assert and mi_neuray_assert_msg, or correspondingly the mi_base_assert and mi_base_assert_msg macros, before including the relevant include files. Defining only one of the two macros is considered an error.

See also Math API Configuration Options and Base API Configuration Options in general.

Macro Definition Documentation

#define mi_neuray_assert (   expr)    mi_base_assert(expr)

If expr evaluates to true this macro shall have no effect.

If expr evaluates to false this macro may print a diagnostic message and change the control flow of the program, such as aborting the program or throwing an exception. But it may also have no effect at all, for example if assertions are configured to be disabled.

By default, this macro maps to mi_base_assert, which in turn does nothing by default. You can (re-)define this macro to perform possible checks and diagnostics within the specification given in the previous paragraph.

See Also
Math API Configuration Options, Base API Configuration Options
#define mi_neuray_assert_msg (   expr,
  msg 
)    mi_base_assert_msg(expr, msg)

If expr evaluates to true this macro shall have no effect.

If expr evaluates to false this macro may print a diagnostic message and change the control flow of the program, such as aborting the program or throwing an exception. But it may also have no effect at all, for example if assertions are configured to be disabled.

the msg text string contains additional diagnostic information that may be shown with a diagnostic message. Typical usages would contain "precondition" or "postcondition" as clarifying context information in the msg parameter.

By default, this macro maps to mi_base_assert_msg, which in turn does nothing by default. You can (re-)define this macro to perform possible checks and diagnostics within the specification given in the previous paragraph.

See Also
Math API Configuration Options, Base API Configuration Options