assertion.hh File Reference
#include <boost/scope_exit.hpp>
#include <hpp/util/config.hh>
#include <hpp/util/exception.hh>
Include dependency graph for assertion.hh:

Namespaces

namespace  hpp

Defines

#define HPP_ASSERT(CONDITION)
 Define HPP_ASSERT.
#define HPP_PRECONDITION(CONDITION)   HPP_ASSERT (CONDITION)
 Define macro for precondition checking.
#define HPP_POSTCONDITION(CONDITION, CAPTURED_VARIABLES)
 Define macro for postcondition checking.

Functions

 hpp::HPP_MAKE_EXCEPTION (HPP_UTIL_DLLAPI, AssertionError)

Define Documentation

#define HPP_ASSERT (   CONDITION)

Define HPP_ASSERT.

Throw an ::hpp::AssertionError if macro argument evaluates to false.

#define HPP_POSTCONDITION (   CONDITION,
  CAPTURED_VARIABLES 
)
Value:
BOOST_SCOPE_EXIT(CAPTURED_VARIABLES)        \
  {               \
    HPP_ASSERT (CONDITION);         \
  } BOOST_SCOPE_EXIT_END          \
  struct _e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n

Define macro for postcondition checking.

This macro allows an assertion to be done whenever a scope is exited.

This macro takes two arguments: the condition which should be evaluated and a list of captured variables. All variables used in the condition must be in this list.

They can either be copied or taken by reference: HPP_POSTCONDITION (a == 3, (a)) ...checks that a is equal to three and copy the variable a when HPP_POSTCONDITION is called.

HPP_POSTCONDITION (a == 3, (&a)) ...takes a by reference and evaluated its final value (when the scope is exited).

See Boost.ScopeExit for more details.

#define HPP_PRECONDITION (   CONDITION)    HPP_ASSERT (CONDITION)

Define macro for precondition checking.