#include <Checker.h>
Public Types | |
typedef bool(* | Validator )(void) |
Signature for the validation function. | |
Public Member Functions | |
StaticChecker (Validator validator, Validator pre=0, Validator post=0) | |
~StaticChecker (void) | |
bool | Check (void) const |
Loki::StaticChecker< ExceptionPolicy >::StaticChecker | ( | Validator | validator, | |
Validator | pre = 0 , |
|||
Validator | post = 0 | |||
) | [inline, explicit] |
The constructor makes sure the host is valid at the time the checker was created, thus insuring the host object was not corrupt from the start.
References Loki::StaticChecker< ExceptionPolicy >::Check().
Loki::StaticChecker< ExceptionPolicy >::~StaticChecker | ( | void | ) | [inline] |
The destructor checks if any Host invariants failed, and then calls the ExceptionPolicy's Check function to determine what to do in case of an exception.
References Loki::StaticChecker< ExceptionPolicy >::Check().
bool Loki::StaticChecker< ExceptionPolicy >::Check | ( | void | ) | const [inline] |
This first checks its own invariants, and then calls the validator function to make sure no invariants were broken by the function which created this checker. That function can call Check directly to verify the data remains valid at any time. This does not care if the pre- and post- condition validator pointers are null since a host class may pass in NULL pointers for either to indicate the pre-conditions or post-conditions are the same as the overall class invariants.
Referenced by Loki::StaticChecker< ExceptionPolicy >::StaticChecker(), and Loki::StaticChecker< ExceptionPolicy >::~StaticChecker().