BloombergLP::bsls::Review

Utility that administers the process-wide review-failure handler.

Synopsis

Declared in <bsls_review.h>

class Review;

Description

This "utility" class maintains a pointer containing the address of the current review-failure handler function (of type Review::ViolationHandler) and provides methods to administer this function pointer. The invokeHandler method calls the currently-installed failure handler. The default installed handler is the Review::failByLog function.

This class also provides a suite of standard failure-handler functions that are suitable to be installed as the current Review::ViolationHandler function. Note that clients are free to install any of these ("off-the-shelf") handlers, or to provide their own ("custom") review-failure handler function when using this facility. Also note that review-failure handlers CAN return, unlike assertion failure handlers, though not returning (thus escalating review behavior implicitly to the level of asserts) is acceptable.

Finally, this class defines the constant strings that are used as the reviewLevel in ReviewViolations associated with failed BSLS_REVIEW invocations.

Type Aliases

NameDescription
Count Alias for an atomic integer used to track review failure counts.
ViolationHandler Alias for a pointer to a review-failure handler taking a violation.

Static Member Functions

NameDescription
failByAbort [noreturn]Abort after logging a message for the specified review violation.
failByLog Log a failure message for the specified review violation to stdout.
failBySleep [noreturn]Hang forever after logging a message for the specified violation.
failByThrow [noreturn]Throw an exception describing the specified review violation.
invokeHandler Invoke the installed review-failure handler with the violation.
lockReviewAdministration Disable all subsequent calls to setViolationHandler. Note that this method has no effect on the behavior of a ReviewFailureHandlerGuard object.
setViolationHandler Install the specified violation handler as the current review handler.
updateCount Increment the specified count and return its new periodic value.
violationHandler Return the address of the currently installed review-failure handler.

Static Data Members

NameDescription
k_LEVEL_INVOKE String identifier ("R-INV") for BSLS_REVIEW_INVOKE failures.
k_LEVEL_OPT Command-line option name for the review level setting.
k_LEVEL_REVIEW String identifier ("R-DBG") for BSLS_REVIEW failures.
k_LEVEL_SAFE String identifier for the safe review level.

Friends

NameDescription
BloombergLP::bsls::ReviewFailureHandlerGuardGuard that temporarily replaces the review failure handler.