Drive Engine
1.0.0
Plateforme de reconstruction 3D
|
The precondition utilities. More...
#include <Precondition.h>
Static Public Member Functions | |
static bool | IsTrue (bool condition, const std::string &message) |
static bool | IsFalse (bool condition, const std::string &message) |
static bool | IsNotNull (const IExportable &object, const std::string &message) |
static bool | IsNotNull (const void *object, const std::string &message) |
The precondition utilities.
Precondition must be used in a conditionnal block. The internal exception handling system does not (and cannot) halt the execution flow. Developpers must check if an exception has been thrown, like the following example.
if (Precondition::IsTrue(x >= 0, "The X-axis value must be positive.") && Precondition::IsTrue(x <= MAX_VALUE, "The X-axis value must not exceed 32 767.") && Precondition::IsTrue(y >= 0, "The Y-axis value must be positive.") && Precondition::IsTrue(y <= MAX_VALUE, "The Y-axis value must not exceed 32 767.")) { this->x = x; this->y = y; }