Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Exception.cc File Reference
#include "G4ios.hh"
#include "G4String.hh"
#include "G4StateManager.hh"
Include dependency graph for G4Exception.cc:

Go to the source code of this file.

Functions

void G4Exception (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
 
void G4Exception (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, G4ExceptionDescription &description)
 
void G4Exception (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, G4ExceptionDescription &description, const char *comments)
 

Function Documentation

void G4Exception ( const char *  originOfException,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
const char *  description 
)

Definition at line 41 of file G4Exception.cc.

45 {
46  G4VExceptionHandler* exceptionHandler
48  G4bool toBeAborted = true;
49  if(exceptionHandler)
50  {
51  toBeAborted = exceptionHandler
52  ->Notify(originOfException,exceptionCode,severity,description);
53  }
54  else
55  {
56  static const G4String es_banner
57  = "\n-------- EEEE ------- G4Exception-START -------- EEEE -------\n";
58  static const G4String ee_banner
59  = "\n-------- EEEE -------- G4Exception-END --------- EEEE -------\n";
60  static const G4String ws_banner
61  = "\n-------- WWWW ------- G4Exception-START -------- WWWW -------\n";
62  static const G4String we_banner
63  = "\n-------- WWWW -------- G4Exception-END --------- WWWW -------\n";
64  std::ostringstream message;
65  message << "\n*** ExceptionHandler is not defined ***\n"
66  << "*** G4Exception : " << exceptionCode << G4endl
67  << " issued by : " << originOfException << G4endl
68  << description << G4endl;
69  switch(severity)
70  {
71  case FatalException:
72  G4cerr << es_banner << message.str() << "*** Fatal Exception ***"
73  << ee_banner << G4endl;
74  break;
76  G4cerr << es_banner << message.str() << "*** Fatal Error In Argument ***"
77  << ee_banner << G4endl;
78  break;
79  case RunMustBeAborted:
80  G4cerr << es_banner << message.str() << "*** Run Must Be Aborted ***"
81  << ee_banner << G4endl;
82  break;
83  case EventMustBeAborted:
84  G4cerr << es_banner << message.str() << "*** Event Must Be Aborted ***"
85  << ee_banner << G4endl;
86  break;
87  default:
88  G4cout << ws_banner << message.str()
89  << "*** This is just a warning message. ***"
90  << we_banner << G4endl;
91  toBeAborted = false;
92  break;
93  }
94  }
95  if(toBeAborted)
96  {
98  {
99  G4cerr << G4endl << "*** G4Exception: Aborting execution ***" << G4endl;
100  abort();
101  }
102  else
103  {
104  G4cerr << G4endl << "*** G4Exception: Abortion suppressed ***"
105  << G4endl << "*** No guarantee for further execution ***" << G4endl;
106  }
107  }
108 }
virtual G4bool Notify(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)=0
G4VExceptionHandler * GetExceptionHandler() const
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

void G4Exception ( const char *  originOfException,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
G4ExceptionDescription description 
)

Definition at line 110 of file G4Exception.cc.

114 {
115  G4String des = description.str();
116  G4Exception(originOfException, exceptionCode, severity, des.c_str());
117 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

void G4Exception ( const char *  originOfException,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
G4ExceptionDescription description,
const char *  comments 
)

Definition at line 119 of file G4Exception.cc.

124 {
125  description << comments << G4endl;
126  G4Exception(originOfException, exceptionCode, severity, description);
127 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function: