Asserter.h File Reference

Asserter class declaration and macros. More...

#include <cstdlib>

Go to the source code of this file.

Classes

class  Asserter
 Base class to handle assertions. More...
class  AsserterEx< E >
 Derived class to handle templated assertions with support for throwing exceptions. More...

Defines

#define ASSERT
 smarter version of the assert macro

Enumerations

enum  AsserterAction
 The action chosen by the user after an assertion fires.

Functions

AsserterAction AskUser (const char *file, int line, const char *msg=NULL)
 A function to ask the user what to do when an assertion fires.


Detailed Description

Asserter class declaration and macros.

This Code was originally written by Andrei Alexandrescu in his C/C++ Users Journal article "Assertions", April 2003. I have modified it slightly to work with g++ 4.0 and Fountain concepts

Header
/afs/scl/project/cvsroot/fountain/source/common/Asserter.h,v 1.6 2006/02/14 22:18:08 samm Exp

Define Documentation

#define ASSERT
 

Value:

if (false); \
        else \
            struct Local {\
                Local(const Asserter& info) { info.Handle(__FILE__, __LINE__); }\
            } localAsserter = Asserter::Make
smarter version of the assert macro

The purpose of using this macro is to allow the programmer a more robust method of catching errors during the debug phase of a project. When compiled for production use, meaning the NDEBUG macro is defined, this macro evaluates to if (true);


Function Documentation

AsserterAction AskUser const char *  file,
int  line,
const char *  msg
 

A function to ask the user what to do when an assertion fires.

Parameters:
[in] file The file name where the assertion fired
[in] line The line number where the assertion fired
[in] msg The optional message given by the assertion
Return values:
AsserterAction the action chosen by the user


Generated on Wed Mar 8 14:43:31 2006 for Fountain by  doxygen 1.4.6