Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ExceptionHandler.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4ExceptionHandler.cc 66892 2013-01-17 10:57:59Z gunter $
28 //
29 //
30 // ------------------------------------------------------------
31 // GEANT 4 class implementation file
32 //
33 // ---------------- G4ExceptionHandler ----------------
34 // by Makoto Asai (August 2002)
35 // ------------------------------------------------------------
36 
37 #include "G4ExceptionHandler.hh"
38 #include "G4StateManager.hh"
39 #include "G4RunManager.hh"
40 #include "G4ios.hh"
41 #include <stdlib.h>
42 #include "G4String.hh"
43 
45 {
46 }
47 
49 {
50 }
51 
54 {
55 }
56 
57 G4ExceptionHandler& G4ExceptionHandler::operator=(const G4ExceptionHandler &)
58 {
59  return *this;
60 }
61 
63 {
64  return (this == &right);
65 }
66 
68 {
69  return (this != &right);
70 }
71 
72 G4bool G4ExceptionHandler::Notify(const char* originOfException,
73  const char* exceptionCode,
74  G4ExceptionSeverity severity,
75  const char* description)
76 {
77  static const G4String es_banner
78  = "\n-------- EEEE ------- G4Exception-START -------- EEEE -------\n";
79  static const G4String ee_banner
80  = "\n-------- EEEE -------- G4Exception-END --------- EEEE -------\n";
81  static const G4String ws_banner
82  = "\n-------- WWWW ------- G4Exception-START -------- WWWW -------\n";
83  static const G4String we_banner
84  = "\n-------- WWWW -------- G4Exception-END --------- WWWW -------\n";
85  std::ostringstream message;
86  message << "*** G4Exception : " << exceptionCode << G4endl
87  << " issued by : " << originOfException << G4endl
88  << description << G4endl;
89  G4bool abortionForCoreDump = false;
91  switch(severity)
92  {
93  case FatalException:
94  G4cerr << es_banner << message.str() << "*** Fatal Exception *** core dump ***"
95  << ee_banner << G4endl;
96  abortionForCoreDump = true;
97  break;
99  G4cerr << es_banner << message.str() << "*** Fatal Error In Argument *** core dump ***"
100  << ee_banner << G4endl;
101  abortionForCoreDump = true;
102  break;
103  case RunMustBeAborted:
104  if(aps==G4State_GeomClosed || aps==G4State_EventProc)
105  {
106  G4cerr << es_banner << message.str() << "*** Run Must Be Aborted ***"
107  << ee_banner << G4endl;
109  }
110  abortionForCoreDump = false;
111  break;
112  case EventMustBeAborted:
113  if(aps==G4State_EventProc)
114  {
115  G4cerr << es_banner << message.str() << "*** Event Must Be Aborted ***"
116  << ee_banner << G4endl;
118  }
119  abortionForCoreDump = false;
120  break;
121  default:
122  G4cout << ws_banner << message.str() << "*** This is just a warning message. ***"
123  << we_banner << G4endl;
124  abortionForCoreDump = false;
125  break;
126  }
127  return abortionForCoreDump;
128 }
virtual void AbortRun(G4bool softAbort=false)
int G4int
Definition: G4Types.hh:78
static G4StateManager * GetStateManager()
G4int operator==(const G4ExceptionHandler &right) const
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
G4ApplicationState GetCurrentState() const
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
G4ExceptionSeverity
virtual G4bool Notify(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4endl
Definition: G4ios.hh:61
virtual void AbortEvent()
G4ApplicationState
G4GLOB_DLL std::ostream G4cerr
G4int operator!=(const G4ExceptionHandler &right) const