Utility that administers the process‐wide assertion‐failure handler.
Synopsis
Declared in <bsls_assert.h>
class Assert;
Description
This "utility" class maintains a pointer containing the address of the current assertion‐failure handler function (of type Assert::ViolationHandler) and provides methods to administer this function pointer. The invokeHandler method calls the currently‐installed failure handler. This class also provides a suite of standard failure‐handler functions that are suitable to be installed as the current Assert::ViolationHandler function. Note that clients are free to install any of these ("off‐the‐shelf") handlers, or to provide their own ("custom") assertion‐failure handler functions when using this facility. Also note that assertion‐failure handler functions must not return (i.e., they must abort, exit, terminate, throw, or hang).
Finally, this class defines the constant strings that are passed as the reviewLevel to the bsls_review handler for checks that failed in "review mode" (see {Assertion Modes}).
Type Aliases
Name |
Description |
Alias for a legacy assertion‐failure handler function pointer. |
|
Alias for a pointer to an assertion‐failure handler taking a violation. |
Static Member Functions
Name |
Description |
Return whether returning from an assertion‐failure handler must abort. |
|
|
DEPRECATED: Use |
|
Abort after logging a message for the specified assertion violation. |
|
Hang forever after logging a message for the specified violation. |
|
Throw an exception describing the specified assertion violation. |
|
DEPRECATED: Use |
|
DEPRECATED: Use |
Return the address of the currently installed assertion‐failure handler function if it is a |
|
|
|
|
Invoke the installed handler, aborting if it returns normally. |
Disable all subsequent calls to |
|
DO NOT USE! It is a violation of Bloomberg policy to invoke this function without having prior authorization from senior management. |
|
Make the specified handler |
|
Install the specified violation handler as the current assert handler. |
|
Return the address of the currently installed assertion‐failure handler function. |
Static Data Members
Name |
Description |
String identifier ("DBG") for |
|
String identifier ("INV") for |
|
String identifier ("OPT") for |
|
String identifier ("SAF") for |
|
Build key used to enforce assertion handler return policy; has value "No". See {Assertion Handler Policy}. |
Friends
Name |
Description |
Guard that temporarily replaces the assertion‐failure handler. |
Created with MrDocs