DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions
utlSmartAssert.h File Reference
#include <string>
#include <iostream>
#include <sstream>
#include <utility>
#include <vector>
#include <map>
#include <fstream>
#include <set>
#include <stdlib.h>
#include <stdexcept>
#include "utlCoreMacro.h"
+ Include dependency graph for utlSmartAssert.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  smart_assert::Assert
 
class  smart_assert::assert_context
 
struct  smart_assert::is_null_finder< T >
 
struct  smart_assert::is_null_finder< char * >
 
struct  smart_assert::is_null_finder< const char * >
 

Namespaces

 smart_assert
 

Macros

#define __SMART_ASSERT_LOCATION__   __FUNCTION__
 
#define SA_Abort(expout)   do { std::cerr << expout <<"\n" << std::flush; abort(); } while(0)
 
#define SMART_ASSERT(expr)
 
#define SMART_ASSERT_A(x)   SMART_ASSERT_OP(x, B)
 
#define SMART_ASSERT_B(x)   SMART_ASSERT_OP(x, A)
 
#define SMART_ASSERT_DEBUG
 
#define SMART_ASSERT_OP(x, next)   SMART_ASSERT_A.print_current_val((x), #x).SMART_ASSERT_##next \
 
#define SMART_EXCEPTION(expr)
 
#define SMART_PRINT
 
#define SMART_VERIFY(expr)
 

Typedefs

typedef void(* smart_assert::assert_func) (const assert_context &context)
 

Enumerations

enum  {
  smart_assert::lvl_log = 0,
  smart_assert::lvl_warn = 100,
  smart_assert::lvl_debug = 200,
  smart_assert::lvl_error = 300,
  smart_assert::lvl_fatal = 1000
}
 
enum  {
  smart_assert::lvl_condition_assert = 0,
  smart_assert::lvl_condition_exception = 1
}
 

Functions

void break_into_debugger ()
 
void smart_assert::default_debug_handler (const assert_context &context)
 
void smart_assert::default_error_handler (const assert_context &context)
 
void smart_assert::default_fatal_handler (const assert_context &context)
 
void smart_assert::default_log_handler (const assert_context &context)
 
void smart_assert::default_logger (const assert_context &context)
 
void smart_assert::default_warn_handler (const assert_context &context)
 
void smart_assert::dump_context_detail (const assert_context &context, std::ostream &out)
 
void smart_assert::dump_context_log_detail (const assert_context &context, std::ostream &out)
 
void smart_assert::dump_context_summary (const assert_context &context, std::ostream &out)
 
std::string smart_assert::get_typeof_level (int nLevel)
 
void smart_assert::init_assert ()
 
Assert smart_assert::make_assert (const char *expr)
 
void smart_assert::set_default_log_name (const char *str)
 
void smart_assert::set_default_log_stream (std::ostream &out)
 

Macro Definition Documentation

#define __SMART_ASSERT_LOCATION__   __FUNCTION__

Definition at line 63 of file utlSmartAssert.h.

#define SA_Abort (   expout)    do { std::cerr << expout <<"\n" << std::flush; abort(); } while(0)

The code is modified from smart_assert by John Torjo http://www.torjo.com http://www.drdobbs.com/cpp/enhancing-assertions/184403745

Author
John Torjo, Jian Cheng

Definition at line 53 of file utlSmartAssert.h.

Referenced by smart_assert::default_debug_handler(), and smart_assert::default_fatal_handler().

#define SMART_ASSERT (   expr)
Value:
if ( (expr) ) ; \
#define __SMART_ASSERT_LOCATION__
Assert & print_context(const char *file, int line)
Assert make_assert(const char *expr)

Definition at line 404 of file utlSmartAssert.h.

#define SMART_ASSERT_A (   x)    SMART_ASSERT_OP(x, B)

Definition at line 432 of file utlSmartAssert.h.

#define SMART_ASSERT_B (   x)    SMART_ASSERT_OP(x, A)

Definition at line 433 of file utlSmartAssert.h.

#define SMART_ASSERT_DEBUG

Definition at line 396 of file utlSmartAssert.h.

#define SMART_ASSERT_OP (   x,
  next 
)    SMART_ASSERT_A.print_current_val((x), #x).SMART_ASSERT_##next \

Definition at line 435 of file utlSmartAssert.h.

#define SMART_EXCEPTION (   expr)
Value:
if ( !(expr) ) ; \
#define __SMART_ASSERT_LOCATION__
Assert & print_context(const char *file, int line)
Assert make_assert(const char *expr)
Assert & error(const char *strMsg=0)

Definition at line 424 of file utlSmartAssert.h.

#define SMART_PRINT
Value:
if ( false ) ; \
#define __SMART_ASSERT_LOCATION__
Assert & print_context(const char *file, int line)
Assert make_assert(const char *expr)
Assert & log(const char *strMsg=0)

Definition at line 428 of file utlSmartAssert.h.

#define SMART_VERIFY (   expr)
Value:
if ( (expr) ) ; \
#define __SMART_ASSERT_LOCATION__
Assert & print_context(const char *file, int line)
Assert make_assert(const char *expr)
Assert & error(const char *strMsg=0)

Definition at line 419 of file utlSmartAssert.h.

Function Documentation

void break_into_debugger ( )
inline

Definition at line 444 of file utlSmartAssert.h.

References smart_assert::init_assert().

Referenced by smart_assert::default_debug_handler().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: