/[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

trunk/esys2/esysUtils/src/EsysAssertException.h revision 82 by jgs, Tue Oct 26 06:53:54 2004 UTC trunk/esysUtils/src/EsysAssertException.h revision 644 by elspeth, Fri Mar 24 01:05:42 2006 UTC
# Line 1  Line 1 
1    // $Id$
2  /*  /*
3   *****************************************************************************   ************************************************************
4   *                                                                           *   *          Copyright 2006 by ACcESS MNRF                   *
5   *       COPYRIGHT  ACcESS  -  All Rights Reserved                           *   *                                                          *
6   *                                                                           *   *              http://www.access.edu.au                    *
7   * This software is the property of ACcESS. No part of this code             *   *       Primary Business: Queensland, Australia            *
8   * may be copied in any form or by any means without the expressed written   *   *  Licensed under the Open Software License version 3.0    *
9   * consent of ACcESS.  Copying, use or modification of this software         *   *     http://www.opensource.org/licenses/osl-3.0.php       *
10   * by any unauthorised person is illegal unless that person has a software   *   *                                                          *
11   * license agreement with ACcESS.                                            *   ************************************************************
  *                                                                           *  
  *****************************************************************************  
12  */  */
13                                                                                                                                                        
14  #if !defined  escript_EsysAssertException_20040330_H  #if !defined escript_EsysAssertException_20040330_H
15  #define escript_EsysAssertException_20040330_H  #define escript_EsysAssertException_20040330_H
16    
17  #include "esysUtils/EsysException.h"  #include "EsysException.h"
18    
19  #include <string>  #include <string>
20  #include <sstream>  #include <sstream>
# Line 28  namespace esysUtils { Line 27  namespace esysUtils {
27    
28     Description:     Description:
29     EsysAssertException exception class.     EsysAssertException exception class.
30     The class provides a public function returning the exception name     The class provides a public function returning the exception name.
31  */  */
32  class EsysAssertException:public EsysException {  class EsysAssertException:public EsysException {
33    
34   public:   public:
35    
36    /**    /**
37       \brief       \brief
38       Default constructor for the exception.       Default constructor for the exception.
39    */    */
40    EsysAssertException() : EsysException() {}    EsysAssertException() : EsysException() {}
41    
42    /**    /**
43       \brief       \brief
44       Constructor for the exception.       Constructor for the exception.
45    */    */
46    EsysAssertException(const char *cstr) : EsysException(cstr) {}    EsysAssertException(const char *cstr) : EsysException(cstr) {}
47    
48    /**    /**
49       \brief       \brief
50       Constructor for the exception.       Constructor for the exception.
51    */    */
52    EsysAssertException(const std::string &str) : EsysException(str) {}    EsysAssertException(const std::string &str) : EsysException(str) {}
53    
54    /**    /**
55       \brief       \brief
56       Returns the name of the exception.       Returns the name of the exception.
57    */    */
58    virtual std::string exceptionName() const {return "EsysAssertException";}    virtual std::string exceptionName() const {return "EsysAssertException";}
59    
60    /**    /**
61       \brief       \brief
62       Builds a formatted message and throws an EsysAssertException.       Builds a formatted message and throws an EsysAssertException.
# Line 60  class EsysAssertException:public EsysExc Line 64  class EsysAssertException:public EsysExc
64    static void assertFailure (const std::string& assertion,    static void assertFailure (const std::string& assertion,
65                   const std::string& date, const std::string& file,                   const std::string& date, const std::string& file,
66                   int line, const std::string& errDesc)                   int line, const std::string& errDesc)
67  {    {
68     std::stringstream message;     std::stringstream message;
69    
70     message << std::endl     message << std::endl
71             << "EsysAssert("             << "EsysAssert(" << assertion << ") failed with message - " << std::endl
            << assertion  
            << ") failed with message - " << std::endl  
72             << "\"" << errDesc << "\"" << std::endl             << "\"" << errDesc << "\"" << std::endl
73             << "Assertion is located in File : " << file             << "Assertion is located in File : " << file
74             << " at Line: " << line << std::endl             << " at Line: " << line << std::endl
75             << "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.";  
76    
77     throw EsysAssertException(message.str());     throw EsysAssertException(message.str());
78  }    }
   
79    
80  };  };
81    
82  } // end of namespace  } // end of namespace
83    
84  #endif  #endif
   
   

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

  ViewVC Help
Powered by ViewVC 1.1.26