Library of Assembled Shared Sources
|
enforcers are release-time counterpart of assertions to ease condition verifying
Enforcers are a tool described by Alexandrescu [1] [1] ALEXANDRESCU A. & MARGINEAN P. (2003), Enforcements. June 2003, C++ Experts Forum, http://www.cuj.com/documents/s=8250/cujcexp2106alexandr/alexandr.htm
Data Structures | |
class | lass::num::lass::util::EnforceFailure |
Exception thrown by enforcers. More... | |
struct | lass::python::impl::PythonFetchRaiser |
Raiser type for enforcers that raises a Python exception. More... | |
class | lass::util::EnforceFailure |
Exception thrown by enforcers. More... | |
Macros | |
#define | LASS_ENFORCE(expression) |
Enforces the expression to be "true", by using operator! | |
#define | LASS_ENFORCE_POINTER(pointer) |
Enforces a pointer to be different than the NULL pointer. | |
#define | LASS_ENFORCE_STREAM(stream) |
Enforces a stream to be in the good state. | |
#define | LASS_ENFORCE_ZERO(expression) |
Enforces the result of the expression to be zero. | |
#define | LASS_ENFORCE_CLIB(functionCall) |
Enforces the return code of a CLIB function call to be different than -1. | |
#define | LASS_ENFORCE_CLIB_RC(errorCode) |
Enforces the return code of a CLIB function call to be zero. | |
#define | LASS_WARN_CLIB_RC(errorCode) |
Enforces the return code of a CLIB function call to be zero. | |
#define | LASS_ENFORCE_COM(comResult) |
Enforces the HRESULT of a COM call to be 0 or more. | |
#define | LASS_ENFORCE_INDEX(index, size) |
Enforces an index to be in the half open range [0, iSize). | |
#define | LASS_ENFORCE_DYNAMIC_CAST(t_DestPointer, v_pointer) |
Enforces a pointer to an object to be dynamic casted to related type. | |
#define | LASS_ENFORCE_DYNAMIC_PY_CAST(t_DestPyObjectPtr, v_pyObjectPtr) |
Enforces a python shared pointer to be dynamic casted to a related python shared pointer. | |
#define LASS_ENFORCE | ( | expression | ) |
Enforces the expression to be "true", by using operator!
taken from: ALEXANDRESCU A. & MARGINEAN P. (2003), Enforcements. June 2003, C++ Experts Forum, http://www.cuj.com.
http://www.cuj.com/documents/s=8250/cujcexp2106alexandr
Definition at line 85 of file basic_ops.h.
#define LASS_ENFORCE_CLIB | ( | functionCall | ) |
Enforces the return code of a CLIB function call to be different than -1.
Some CLIB functions return -1 on failure. An error code indicating the failure can be found using errno. LASS_ENFORCE_CLIB will enforce that the return value of the function call is not -1. If it is -1, it will rais a runtime exception with the error code errno and its string message translated by strerror().
Definition at line 141 of file basic_ops.h.
#define LASS_ENFORCE_CLIB_RC | ( | errorCode | ) |
Enforces the return code of a CLIB function call to be zero.
Some CLIB functions return zero on success and an error code on failure. This error code can be translated to a string message with strerror(). LASS_ENFORCE_CLIB_RC will enforce that the return code of the function call is zero. If it's not, it will raise a runtime exception with the translated error code.
Definition at line 174 of file basic_ops.h.
#define LASS_WARN_CLIB_RC | ( | errorCode | ) |
Enforces the return code of a CLIB function call to be zero.
Some CLIB functions return zero on success and an error code on failure. This error code can be translated to a string message with strerror(). LASS_ENFORCE_CLIB_RC will enforce that the return code of the function call is zero. If it's not, it will raise a runtime exception with the translated error code.
Definition at line 191 of file basic_ops.h.
#define LASS_ENFORCE_DYNAMIC_CAST | ( | t_DestPointer, | |
v_pointer ) |
Enforces a pointer to an object to be dynamic casted to related type.
t_DestPointer | the type of the pointer to be casted to. |
v_pointer | a pointer to be casted (note that we don't cast references, use LASS_ENFORCE_DYNAMIC_REF_CAST for that) |
Definition at line 270 of file basic_ops.h.
#define LASS_ENFORCE_DYNAMIC_PY_CAST | ( | t_DestPyObjectPtr, | |
v_pyObjectPtr ) |
Enforces a python shared pointer to be dynamic casted to a related python shared pointer.
t_DestPyObjectPtr | the type of python shared pointer to be casted to. So if you want to cast to PyObjectPtr<Foo>::Type , t_DestPyObjectPtr should be PyObjectPtr<Foo>::Type . |
v_pyObjectPtr | a python shared pointer to be casted. |
Definition at line 290 of file basic_ops.h.