EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | List of all members
EBGeometry::ThrowOnRequire Class Reference

While an object of this class lives, a failed EBGEOMETRY_REQUIRE on this thread throws RequireError instead of aborting: for a program that builds objects from input it does not control (the .ebg reader), so that a bad value is an error it reports, not the end of the program. More...

#include <EBGeometry_Macros.hpp>

Public Member Functions

 ThrowOnRequire () noexcept
 Open the scope.
 
 ~ThrowOnRequire () noexcept
 Close the scope.
 
 ThrowOnRequire (const ThrowOnRequire &)=delete
 
ThrowOnRequire & operator= (const ThrowOnRequire &)=delete
 

Detailed Description

While an object of this class lives, a failed EBGEOMETRY_REQUIRE on this thread throws RequireError instead of aborting: for a program that builds objects from input it does not control (the .ebg reader), so that a bad value is an error it reports, not the end of the program.

Host only; scopes nest. The scope is per thread: a failed check on another thread, even one started inside the scope, still aborts. A check in a function that cannot throw (a noexcept function) still ends the program, since the exception cannot leave it; the constructors of the built-in shapes and the expression builders can throw. What the throwing call was building is not built, but a pool it was building into keeps what it allocated before the check failed (the tape compiler builds BVHs into its pool as it compiles), until the pool is destroyed.


The documentation for this class was generated from the following file: