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

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

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

revision 82 by jgs, Tue Oct 26 06:53:54 2004 UTC revision 97 by jgs, Tue Dec 14 05:39:33 2004 UTC
# Line 1  Line 1 
1    // $Id$
2  /*  /*
3   *****************************************************************************   *****************************************************************************
4   *                                                                           *   *                                                                           *
# Line 12  Line 13 
13   *****************************************************************************   *****************************************************************************
14  */  */
15                                                                                                                                                        
16  #if !defined  escript_EsysAssertException_20040330_H  #if !defined escript_EsysAssertException_20040330_H
17  #define escript_EsysAssertException_20040330_H  #define escript_EsysAssertException_20040330_H
18    
19  #include "esysUtils/EsysException.h"  #include "esysUtils/EsysException.h"
# Line 28  namespace esysUtils { Line 29  namespace esysUtils {
29    
30     Description:     Description:
31     EsysAssertException exception class.     EsysAssertException exception class.
32     The class provides a public function returning the exception name     The class provides a public function returning the exception name.
33  */  */
34  class EsysAssertException:public EsysException {  class EsysAssertException:public EsysException {
35    
36   public:   public:
37    
38    /**    /**
39       \brief       \brief
40       Default constructor for the exception.       Default constructor for the exception.
41    */    */
42    EsysAssertException() : EsysException() {}    EsysAssertException() : EsysException() {}
43    
44    /**    /**
45       \brief       \brief
46       Constructor for the exception.       Constructor for the exception.
47    */    */
48    EsysAssertException(const char *cstr) : EsysException(cstr) {}    EsysAssertException(const char *cstr) : EsysException(cstr) {}
49    
50    /**    /**
51       \brief       \brief
52       Constructor for the exception.       Constructor for the exception.
53    */    */
54    EsysAssertException(const std::string &str) : EsysException(str) {}    EsysAssertException(const std::string &str) : EsysException(str) {}
55    
56    /**    /**
57       \brief       \brief
58       Returns the name of the exception.       Returns the name of the exception.
59    */    */
60    virtual std::string exceptionName() const {return "EsysAssertException";}    virtual std::string exceptionName() const {return "EsysAssertException";}
61    
62    /**    /**
63       \brief       \brief
64       Builds a formatted message and throws an EsysAssertException.       Builds a formatted message and throws an EsysAssertException.
# Line 60  class EsysAssertException:public EsysExc Line 66  class EsysAssertException:public EsysExc
66    static void assertFailure (const std::string& assertion,    static void assertFailure (const std::string& assertion,
67                   const std::string& date, const std::string& file,                   const std::string& date, const std::string& file,
68                   int line, const std::string& errDesc)                   int line, const std::string& errDesc)
69  {    {
70     std::stringstream message;     std::stringstream message;
71    
72     message << std::endl     message << std::endl
73             << "EsysAssert("             << "EsysAssert(" << assertion << ") failed with message - " << std::endl
            << assertion  
            << ") failed with message - " << std::endl  
74             << "\"" << errDesc << "\"" << std::endl             << "\"" << errDesc << "\"" << std::endl
75             << "Assertion is located in File : " << file             << "Assertion is located in File : " << file
76             << " at Line: " << line << std::endl             << " at Line: " << line << std::endl
77             << "File Compilation Date: " << date << std::endl             << "File Compilation Date: " << date << std::endl;
            << "To debug - set break point in EsysAssertException::assertFailure"  
            << std::endl  
            << "and examine call stack when breakpoint is reached.";  
78    
79     throw EsysAssertException(message.str());     throw EsysAssertException(message.str());
80  }    }
81    
82    
83  };  };
84    
85  } // end of namespace  } // end of namespace
86  #endif  #endif
   
   

Legend:
Removed from v.82  
changed lines
  Added in v.97

  ViewVC Help
Powered by ViewVC 1.1.26