/[escript]/trunk/esys2/esysUtils/src/EsysAssert.h
ViewVC logotype

Diff of /trunk/esys2/esysUtils/src/EsysAssert.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 99 by jgs, Tue Dec 14 05:39:33 2004 UTC revision 100 by jgs, Wed Dec 15 03:48:48 2004 UTC
# Line 1  Line 1 
 // $Id$  
1  /*  /*
2   ******************************************************************************   ******************************************************************************
3   *                                                                            *   *                                                                            *
# Line 13  Line 12 
12   ******************************************************************************   ******************************************************************************
13  */  */
14                                                                                                                                                        
15  #if !defined escript_EsysAssert_20040330_H  #if !defined  escript_EsysAssert_20040330_H
16  #define escript_EsysAssert_20040330_H  #define escript_EsysAssert_20040330_H
17    
18  /**  /**
19     \brief     \brief
20     EsysAssert is a MACRO that will throw an exception if the boolean     EsysAssert is a MACRO that will throw an exception if the boolean
21     condition specified is false.     condition is false.
22    
23     Description:     Description:
24     EsysAssert is conditionally compiled into code only when DOASSERT is     EsysAssert is conditionally compiled into code only when DOASSERT is
# Line 29  Line 28 
28    
29  //  //
30  // Note that the ANSI C Standard requires all headers to be idempotent except  // Note that the ANSI C Standard requires all headers to be idempotent except
31  // <assert.h> which is explicitly required not to be idempotent (section 4.1.2).  // <assert.h> which is explicitly required not to be idempotent
32    // (section 4.1.2).
33  // This version of EsysAssert follows this requirement, consequently this  // This version of EsysAssert follows this requirement, consequently this
34  // part of the header is intentionally outside the single pass guard.  // part of the header is intentionally outside the single pass guard
35  //  //
36    
37  #undef  EsysAssert  #undef  EsysAssert
38    
39  #if defined DOASSERT  #if defined DOASSERT
   
40  //  //
41  // DOASSERT is defined, replace EsysAssert with Exception throw  // DOASSERT is defined, replace EsysAssert with Exception throw
42  //  //
   
43  #include "EsysAssertException.h"  #include "EsysAssertException.h"
44  #include <sstream>  #include <sstream>
45    
# Line 78  namespace esysUtils { Line 76  namespace esysUtils {
76  }  }
77    
78  #define EsysAssert(AssertTest,AssertMessage) \  #define EsysAssert(AssertTest,AssertMessage) \
79     (void)((AssertTest) || \     (void)((AssertTest) || ((esysUtils::EsysAssertException::assertFailure(#AssertTest, __DATE__, \
80             ((esysUtils::EsysAssertException::assertFailure(#AssertTest, __DATE__, __FILE__, __LINE__, \                             __FILE__, __LINE__, \
81               (esysUtils::ErrStream()<<AssertMessage).toString())),0),0)                           (esysUtils::ErrStream()<<AssertMessage).toString())),0),0)
82    
83  #else  #else
   
84  //  //
85  // DOASSERT os not defined, replace EsysAssert with "NO-OP"  // DOASSERT os not defined, replace EsysAssert with "NO-OP"
86  //  //
   
87  #define EsysAssert(AssertTest,AssertMessage) ((void)0)  #define EsysAssert(AssertTest,AssertMessage) ((void)0)
88    
89  #endif  #endif
90    
91  #endif  #endif
92    
93    
94    
95    
96    

Legend:
Removed from v.99  
changed lines
  Added in v.100

  ViewVC Help
Powered by ViewVC 1.1.26