[#BloombergLP-bsls-Review]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::Review
:relfileprefix: ../../
:mrdocs:

This &quot;utility&quot; class maintains a pointer containing the address of the current review&hyphen;failure handler function (of type `Review&colon;&colon;ViolationHandler`) and provides methods to administer this function pointer&period; The `invokeHandler` method calls the currently&hyphen;installed failure handler&period; The default installed handler is the `Review&colon;&colon;failByLog` function&period;

== Synopsis

Declared in `&lt;bsls&lowbar;review&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class Review;
----

== Description

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

Finally, this class defines the constant strings that are used as the `reviewLevel` in `ReviewViolation`s associated with failed `BSLS&lowbar;REVIEW` invocations&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bsls/Review/Count.adoc[`Count`] 
| `Count` is an alias for an atomic integer&period; All `bsls&lowbar;review` macros declare a static local `Count` variable that is used to track how many times that review has failed&period; This count gets updated through the `bsls&colon;&colon;Review&colon;&colon;updateCount` function&period;
| xref:BloombergLP/bsls/Review/ViolationHandler-06.adoc[`ViolationHandler`] 
| `ViolationHandler` is an alias for a pointer to a function returning `void`, and taking, as a parameter, a `const` reference to a `ReviewViolation` instance&period; For example&colon; &grave; void myHandler(const ReviewViolation&amp; violation)&semi; &grave;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bsls/Review/failByAbort.adoc[`failByAbort`]  [.small]#[noreturn]#
| Emulate the invocation of the standard `assert` macro with a `false` argument, using the specified `violation` to generate an output message and then, after logging, unconditionally abort&period;
| xref:BloombergLP/bsls/Review/failByLog.adoc[`failByLog`] 
| Log a message to `stdout` that an assertion has failed with information on the failure from the specified `violation`&period; A suitably formatted &quot;cheap stack&quot; is included in the log message that identifies the call site where the failure occurred&period;
| xref:BloombergLP/bsls/Review/failBySleep.adoc[`failBySleep`]  [.small]#[noreturn]#
| Use the specified `violation` to generate an output message and then, after logging, spin in an infinite loop&period; Note that this handler function is useful for hanging a process so that a debugger may be attached to it&period;
| xref:BloombergLP/bsls/Review/failByThrow.adoc[`failByThrow`]  [.small]#[noreturn]#
| Throw an `AssertTestException` (whose attributes are `comment`, `filename`, and `lineNumber` from the specified `violation`), provided that `BDE&lowbar;BUILD&lowbar;TARGET&lowbar;EXC` is defined&semi; otherwise, log an appropriate message and abort the program (similar to `failByAbort`)&period;
| xref:BloombergLP/bsls/Review/invokeHandler.adoc[`invokeHandler`] 
| Invoke the currently installed review&hyphen;failure handler function with the specified `violation` as its argument&period; Note that this function is intended for use by the (BSLS) &quot;REVIEW&quot; macros, but may also be called by clients directly as needed&period;
| xref:BloombergLP/bsls/Review/lockReviewAdministration.adoc[`lockReviewAdministration`] 
| Disable all subsequent calls to `setViolationHandler`&period; Note that this method has no effect on the behavior of a `ReviewFailureHandlerGuard` object&period;
| xref:BloombergLP/bsls/Review/setViolationHandler.adoc[`setViolationHandler`] 
| Make the specified handler `function` the current review&hyphen;failure handler&period; This method has no effect if the `lockReviewAdministration` method has been called&period;
| xref:BloombergLP/bsls/Review/updateCount.adoc[`updateCount`] 
| Increment the specified `count` and return the new value&period; Instead of overflowing, when the value is sufficiently large, decrement the value so that large values repeat periodically&period;
| xref:BloombergLP/bsls/Review/violationHandler-05.adoc[`violationHandler`] 
| Return the address of the currently installed review&hyphen;failure handler function&period; Note that the initial value of the review&hyphen;failure handler is the `Review&colon;&colon;failByLog` method&period;
|===


== Static Data Members

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bsls/Review/k_LEVEL_INVOKE.adoc[`k&lowbar;LEVEL&lowbar;INVOKE`] 
| String identifier (&quot;R&hyphen;INV&quot;) for `BSLS&lowbar;REVIEW&lowbar;INVOKE` failures&period;
| xref:BloombergLP/bsls/Review/k_LEVEL_OPT.adoc[`k&lowbar;LEVEL&lowbar;OPT`] 
| Command&hyphen;line option name for the review level setting&period;
| xref:BloombergLP/bsls/Review/k_LEVEL_REVIEW.adoc[`k&lowbar;LEVEL&lowbar;REVIEW`] 
| String identifier (&quot;R&hyphen;DBG&quot;) for `BSLS&lowbar;REVIEW` failures&period;
| xref:BloombergLP/bsls/Review/k_LEVEL_SAFE.adoc[`k&lowbar;LEVEL&lowbar;SAFE`] 
| String identifier for the safe review level&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bsls/ReviewFailureHandlerGuard.adoc[BloombergLP::bsls::ReviewFailureHandlerGuard]`
| An object of this class saves the current review handler and installs the one specified on construction&period; On destruction, the original review handler is restored&period; Note that two objects of this class cannot be safely used concurrently from two separate threads (but may of course appear sequentially, including in nested blocks and function invocations within a single thread)&period; Note that the behavior of objects of this class is unaffected by the (`static`) `Review&colon;&colon;lockReviewAdministration` method (i&period;e&period;, the temporary replacement will occur, regardless of whether that method has been invoked)&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
