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

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

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

revision 100 by jgs, Wed Dec 15 03:48:48 2004 UTC revision 102 by jgs, Wed Dec 15 07:08:39 2004 UTC
# Line 1  Line 1 
1    // $Id$
2  /*  /*
3   ******************************************************************************   ******************************************************************************
4   *                                                                            *   *                                                                            *
# Line 12  Line 13 
13   ******************************************************************************   ******************************************************************************
14  */  */
15                                                                                                                                                        
16  #if !defined  escript_EsysAssert_20040330_H  #if !defined escript_EsysAssert_20040330_H
17  #define escript_EsysAssert_20040330_H  #define escript_EsysAssert_20040330_H
18    
19  /**  /**
20     \brief     \brief
21     EsysAssert is a MACRO that will throw an exception if the boolean     EsysAssert is a MACRO that will throw an exception if the boolean
22     condition is false.     condition specified is false.
23    
24     Description:     Description:
25     EsysAssert is conditionally compiled into code only when DOASSERT is     EsysAssert is conditionally compiled into code only when DOASSERT is
# Line 28  Line 29 
29    
30  //  //
31  // 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
32  // <assert.h> which is explicitly required not to be idempotent  // <assert.h> which is explicitly required not to be idempotent (section 4.1.2).
 // (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  //  //
42  // DOASSERT is defined, replace EsysAssert with Exception throw  // DOASSERT is defined, replace EsysAssert with Exception throw
43  //  //
44    
45  #include "EsysAssertException.h"  #include "EsysAssertException.h"
46  #include <sstream>  #include <sstream>
47    
# Line 76  namespace esysUtils { Line 78  namespace esysUtils {
78  }  }
79    
80  #define EsysAssert(AssertTest,AssertMessage) \  #define EsysAssert(AssertTest,AssertMessage) \
81     (void)((AssertTest) || ((esysUtils::EsysAssertException::assertFailure(#AssertTest, __DATE__, \     (void)((AssertTest) || \
82                             __FILE__, __LINE__, \             ((esysUtils::EsysAssertException::assertFailure(#AssertTest, __DATE__, __FILE__, __LINE__, \
83                           (esysUtils::ErrStream()<<AssertMessage).toString())),0),0)               (esysUtils::ErrStream()<<AssertMessage).toString())),0),0)
84    
85  #else  #else
86    
87  //  //
88  // DOASSERT os not defined, replace EsysAssert with "NO-OP"  // DOASSERT os not defined, replace EsysAssert with "NO-OP"
89  //  //
90    
91  #define EsysAssert(AssertTest,AssertMessage) ((void)0)  #define EsysAssert(AssertTest,AssertMessage) ((void)0)
92    
93  #endif  #endif
94    
95  #endif  #endif
   
   
   
   
   

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

  ViewVC Help
Powered by ViewVC 1.1.26