assertions.hpp File Reference

Macros and functions for BTK library assertions. More...

#include <string>
#include <cstdlib>
#include <btk/core/config/btk_config.hpp>
#include <btk/core/io/logging.hpp>

Go to the source code of this file.

Namespaces

namespace  BTK
namespace  BTK::COMMON
namespace  BTK::COMMON::ASSERTIONS

Defines

#define BTK_ASSERT(expr, str)
#define BTK_INVARIANT(expr)   BTK_ASSERT(expr,"Invariant violated")

Typedefs

typedef assert_code(*) assert_handler (std::string const &, std::string const &, unsigned)

Enumerations

enum  assert_code { EXIT, CONTINUE, IGNORE }

Functions

std::string make_assert_message (std::string const &msg, std::string const &file, unsigned line)
assert_code default_assert_handler (std::string const &msg, std::string const &file, unsigned line)

Variables

assert_handler current_assert_handler


Detailed Description

Macros and functions for BTK library assertions.


Define Documentation

#define BTK_ASSERT ( expr,
str   ) 

Value:

if (!(expr)) {                                                        \
    using namespace BTK::COMMON::ASSERTIONS;                           \
    static assert_code status = EXIT;                                   \
                                                                        \
    if (status != IGNORE) {                                             \
      status =                                                          \
        current_assert_handler((str),                                   \
                               __FILE__,                                \
                               __LINE__);                               \
      if (status == EXIT) std::exit(-1);                                \
    }                                                                   \
  };

#define BTK_INVARIANT ( expr   )     BTK_ASSERT(expr,"Invariant violated")


Generated on Sun Jul 15 20:46:28 2007 for BTK Core by  doxygen 1.5.1