library of assembled shared sources |
http://lass.cocamware.com |
Data Structures | |
class | lass::util::EnforceFailure |
Exception thrown by enforcers. More... | |
Defines | |
#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. |
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
#define LASS_ENFORCE | ( | expression | ) |
Value:
*LASS_UTIL_IMPL_MAKE_ENFORCER(\ ::lass::util::impl::TruePredicate,\ ::lass::util::impl::DefaultRaiser,\ (expression), \ int(0), \ "Expression '" LASS_STRINGIFY(expression) "' failed in '" LASS_HERE "'.")
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 86 of file enforcer.h.
Referenced by lass::prim::SimplePolygon2D< T, DegeneratePolicy >::at(), lass::prim::SimplePolygon2D< T, DegeneratePolicy >::erase(), lass::python::impl::finalizePyType(), lass::prim::SimplePolygon2D< T, DegeneratePolicy >::fixDegenerate(), lass::python::impl::PySequence::initialize(), lass::python::impl::PyMap::initialize(), lass::python::PyIteratorRange::initialize(), lass::prim::SimplePolygon2D< T, DegeneratePolicy >::insert(), lass::spat::LinearMeshInterpolator< T, TPI >::interpolate(), lass::num::Matrix< T, S >::invert(), lass::io::keyboardGetKey(), lass::num::FilteredFloat< T >::operator*=(), lass::num::FilteredFloat< T >::operator+=(), lass::num::FilteredFloat< T >::operator-=(), lass::num::FilteredFloat< T >::operator/=(), lass::num::operator<(), lass::prim::Sphere3D< T >::operator<<(), lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::operator<<(), lass::prim::Ray2D< T, NormalizingPolicy, ParameterPolicy >::operator<<(), lass::prim::Line3D< T, NormalizingPolicy >::operator<<(), lass::prim::impl::operator<<(), lass::io::ProxyIStream::operator>>(), lass::prim::Point2DH< T >::operator>>(), lass::num::operator>>(), lass::prim::Triangle2D< T >::partialVoronoiArea(), lass::util::impl::CrashDumpImpl::patchSetUnhandledExceptionFilter(), lass::num::impl::MVColumn< T, VectorOperand1 >::resize(), lass::num::Matrix< T, S >::solve(), lass::spat::PlanarMesh::split(), lass::util::ThreadPool< TaskType, ConsumerType, IdlePolicy, ParticipationPolicy >::ThreadPool(), lass::prim::Transformation2D< T >::Transformation2D(), lass::prim::Transformation3D< T >::Transformation3D(), lass::util::RWLock::unlockw(), and lass::util::RWLock::~RWLock().
#define LASS_ENFORCE_POINTER | ( | pointer | ) |
Value:
*LASS_UTIL_IMPL_MAKE_ENFORCER(\ ::lass::util::impl::TruePredicate,\ ::lass::util::impl::DefaultRaiser,\ (pointer), \ int(0), \ "Null pointer '" LASS_STRINGIFY(pointer) "' detected in '" LASS_HERE "'.")
Definition at line 99 of file enforcer.h.
Referenced by lass::io::Logger::filter(), lass::io::Logger::setFilter(), lass::io::Logger::subscribeTo(), and lass::io::Logger::unsubscribeTo().
#define LASS_ENFORCE_STREAM | ( | stream | ) |
Value:
*LASS_UTIL_IMPL_MAKE_ENFORCER(\ ::lass::util::impl::StreamPredicate,\ ::lass::util::impl::DefaultRaiser,\ (stream),\ int(0), \ "Failing stream '" LASS_STRINGIFY(stream) "' detected in '" LASS_HERE "'.")
Definition at line 112 of file enforcer.h.
Referenced by lass::prim::Vector4D< T >::operator<<(), lass::prim::Vector3D< T >::operator<<(), lass::prim::Vector2D< T >::operator<<(), lass::prim::Triangle3D< T >::operator<<(), lass::prim::Triangle2D< T >::operator<<(), lass::prim::Transformation3D< T >::operator<<(), lass::prim::Transformation2D< T >::operator<<(), lass::prim::Sphere3D< T >::operator<<(), lass::prim::SimplePolygon3D< T, PlaneEquationPolicy, PlaneNormalizingPolicy >::operator<<(), lass::prim::SimplePolygon2D< T, DegeneratePolicy >::operator<<(), lass::prim::Ray3D< T, NormalizingPolicy, ParameterPolicy >::operator<<(), lass::prim::Ray2D< T, NormalizingPolicy, ParameterPolicy >::operator<<(), lass::io::ProxyOStream::Lock::operator<<(), lass::prim::Point3DH< T >::operator<<(), lass::prim::Point3D< T >::operator<<(), lass::prim::Point2DH< T >::operator<<(), lass::prim::Point2D< T >::operator<<(), lass::prim::Plane3D< T, EquationPolicy, NormalizingPolicy >::operator<<(), lass::prim::Parallelogram3D< T >::operator<<(), lass::num::Matrix< T, S >::operator<<(), lass::prim::LineSegment3D< T, ParameterPolicy >::operator<<(), lass::prim::LineSegment2D< T, ParameterPolicy >::operator<<(), lass::prim::Line3D< T, NormalizingPolicy >::operator<<(), lass::prim::Line2D< T, EquationPolicy, NormalizingPolicy >::operator<<(), std::operator<<(), lass::prim::Aabb3D< T, MinMaxPolicy >::operator<<(), lass::prim::Aabb2D< T, MinMaxPolicy >::operator<<(), lass::prim::Point3DH< T >::operator>>(), lass::prim::Point3D< T >::operator>>(), lass::prim::Point2D< T >::operator>>(), lass::stde::impl::print_map(), and lass::stde::impl::print_sequence().
#define LASS_ENFORCE_ZERO | ( | expression | ) |
Value:
*LASS_UTIL_IMPL_MAKE_ENFORCER(\ ::lass::util::impl::EqualPredicate,\ ::lass::util::impl::ZeroRaiser>(\ (expression), \ int(0), \ "'" LASS_STRINGIFY(expression) "' in '" LASS_HERE "'.")
Definition at line 125 of file enforcer.h.
#define LASS_ENFORCE_CLIB | ( | functionCall | ) |
Value:
*LASS_UTIL_IMPL_MAKE_ENFORCER(\ ::lass::util::impl::UnequalPredicate,\ ::lass::util::impl::ClibRaiser,\ (functionCall), \ int(-1), \ "'" LASS_STRINGIFY(functionCall) "' in '" LASS_HERE "'")
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 142 of file enforcer.h.
Referenced by lass::io::impl::BinaryIMemoryMapImpl::BinaryIMemoryMapImpl(), lass::util::impl::bindThread(), lass::io::keyboardGetKey(), lass::io::keyboardIsHit(), lass::util::LASS_EXECUTE_BEFORE_MAIN_EX(), lass::util::impl::numberOfProcessors(), and lass::util::impl::ThreadInternal::yield().
#define LASS_ENFORCE_CLIB_RC | ( | errorCode | ) |
Value:
*LASS_UTIL_IMPL_MAKE_ENFORCER(\ ::lass::util::impl::EqualPredicate,\ ::lass::util::impl::ClibRcRaiser,\ (errorCode), \ int(0), \ "'" LASS_STRINGIFY(errorCode) "' in '" LASS_HERE "'")
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 175 of file enforcer.h.
Referenced by lass::util::impl::ConditionInternal::broadcast(), lass::util::impl::ConditionInternal::ConditionInternal(), lass::util::impl::lass_getenv(), lass::util::impl::lass_putenv(), lass::util::impl::MutexInternal::lock(), lass::util::impl::MutexInternal::MutexInternal(), lass::util::impl::ThreadInternal::run(), lass::util::impl::ThreadLocalStorageInternal::set(), lass::util::impl::ConditionInternal::signal(), lass::util::impl::ThreadLocalStorageInternal::ThreadLocalStorageInternal(), lass::util::impl::MutexInternal::unlock(), and lass::util::impl::ConditionInternal::wait().
#define LASS_WARN_CLIB_RC | ( | errorCode | ) |
Value:
*LASS_UTIL_IMPL_MAKE_ENFORCER(\ ::lass::util::impl::EqualPredicate,\ ::lass::util::impl::ClibRcWarner,\ (errorCode), \ int(0), \ "'" LASS_STRINGIFY(errorCode) "' in '" LASS_HERE "'")
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 192 of file enforcer.h.
Referenced by lass::util::impl::ConditionInternal::~ConditionInternal(), lass::util::impl::MutexInternal::~MutexInternal(), and lass::util::impl::ThreadLocalStorageInternal::~ThreadLocalStorageInternal().
#define LASS_ENFORCE_COM | ( | comResult | ) |
Value:
*LASS_UTIL_IMPL_MAKE_ENFORCER(\ ::lass::util::impl::GreaterEqualPredicate,\ ::lass::util::impl::ComRaiser,\ (comResult), \ int(0), \ "'" LASS_STRINGIFY(comResult) "' in '" LASS_HERE "'.")
Definition at line 205 of file enforcer.h.
Referenced by lass::util::impl::CrashDumpImpl::CrashDumpImpl().
#define LASS_ENFORCE_INDEX | ( | index, | |||
size | ) |
Value:
*LASS_UTIL_IMPL_MAKE_ENFORCER(\ ::lass::util::impl::IndexPredicate,\ ::lass::util::impl::IndexRaiser,\ (index), (size), LASS_HERE)
Definition at line 255 of file enforcer.h.
Referenced by lass::prim::TriangleMesh3D< T, BoundingVolumeHierarchy, SplitHeuristics >::buildMesh().
#define LASS_ENFORCE_DYNAMIC_CAST | ( | t_DestPointer, | |||
v_pointer | ) |
Value:
*LASS_UTIL_IMPL_MAKE_ENFORCER(\ ::lass::util::impl::TruePredicate,\ ::lass::util::impl::DefaultRaiser,\ (dynamic_cast<t_DestPointer>(v_pointer)),\ int(0), \ "Unable to cast to '" LASS_STRINGIFY(t_DestPointer) "': '" LASS_STRINGIFY(v_pointer)\ "' is a null pointer or is not of the correct type, '" LASS_HERE "'.")
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 271 of file enforcer.h.
#define LASS_ENFORCE_DYNAMIC_PY_CAST | ( | t_DestPyObjectPtr, | |||
v_pyObjectPtr | ) |
Value:
*LASS_UTIL_IMPL_MAKE_ENFORCER(\ ::lass::util::impl::TruePredicate,\ ::lass::util::impl::DefaultRaiser,\ ::lass::python::dynamicPyCast<t_DestPyObjectPtr>(v_pyObjectPtr),\ int(0), \ "Unable to cast to '" LASS_STRINGIFY(t_DestPyObjectPtr) "': '" LASS_STRINGIFY(v_pyObjectPtr)\ "' is a null pointer or is not of the correct type, '" LASS_HERE "'.")
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 291 of file enforcer.h.
Generated on Mon Nov 10 14:22:06 2008 for Library of Assembled Shared Sources by 1.5.7.1 |