Import Geant4 2.0.0 source tree
This commit is contained in:
@@ -1,14 +1,4 @@
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
//
|
||||
// $Id: errordesc.cc,v 1.3 1999/12/15 14:50:19 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
//
|
||||
|
||||
/*
|
||||
* NIST Utils Class Library
|
||||
* clutils/errordesc.cc
|
||||
@@ -20,13 +10,148 @@
|
||||
* and is not subject to copyright.
|
||||
*/
|
||||
|
||||
/* */
|
||||
/* $Id: errordesc.cc,v 1.4 2000/01/21 13:43:10 gcosmo Exp $ */
|
||||
|
||||
#include <errordesc.h>
|
||||
#include <Str.h>
|
||||
|
||||
DebugLevel ErrorDescriptor::_debug_level = DEBUG_OFF;
|
||||
G4std::ostream * ErrorDescriptor::_out = 0;
|
||||
|
||||
void
|
||||
ErrorDescriptor::PrintContents(G4std::ostream &out) const
|
||||
{
|
||||
SCLstring s;
|
||||
out << "Severity: " << severity(s) << G4endl;
|
||||
if(_userMsg)
|
||||
{
|
||||
out << "User message in parens:" << G4endl << "(";
|
||||
out << UserMsg() << ")" << G4endl;
|
||||
}
|
||||
if(_detailMsg)
|
||||
{
|
||||
out << "Detailed message in parens:" << G4endl << "(";
|
||||
out << DetailMsg() << ")" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
ErrorDescriptor::severity(SCLstring &s) const
|
||||
{
|
||||
s.set_null();
|
||||
switch(severity())
|
||||
{
|
||||
case SEVERITY_NULL :
|
||||
{
|
||||
s = "SEVERITY_NULL";
|
||||
break;
|
||||
}
|
||||
case SEVERITY_USERMSG :
|
||||
{
|
||||
s = "SEVERITY_USERMSG";
|
||||
break;
|
||||
}
|
||||
case SEVERITY_INCOMPLETE :
|
||||
{
|
||||
s = "SEVERITY_INCOMPLETE";
|
||||
break;
|
||||
}
|
||||
case SEVERITY_WARNING :
|
||||
{
|
||||
s = "SEVERITY_WARNING";
|
||||
break;
|
||||
}
|
||||
case SEVERITY_INPUT_ERROR :
|
||||
{
|
||||
s = "SEVERITY_INPUT_ERROR";
|
||||
break;
|
||||
}
|
||||
case SEVERITY_BUG :
|
||||
{
|
||||
s = "SEVERITY_BUG";
|
||||
break;
|
||||
}
|
||||
case SEVERITY_EXIT :
|
||||
{
|
||||
s = "SEVERITY_EXIT";
|
||||
break;
|
||||
}
|
||||
case SEVERITY_DUMP :
|
||||
{
|
||||
s = "SEVERITY_DUMP";
|
||||
break;
|
||||
}
|
||||
case SEVERITY_MAX :
|
||||
{
|
||||
s = "SEVERITY_MAX";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return s.chars();
|
||||
}
|
||||
|
||||
|
||||
Severity
|
||||
ErrorDescriptor::GetCorrSeverity(const char *s)
|
||||
{
|
||||
// G4cout << "s is (" << s << ") \n";
|
||||
if(s && s[0] != 0)
|
||||
{
|
||||
SCLstring s2;
|
||||
StrToUpper(s,s2);
|
||||
// G4cout << "s after if is (" << s << ") \n" << "s2 is (" << s2.chars() << ")\n";
|
||||
if(!strcmp(s2.chars(),"SEVERITY_NULL"))
|
||||
{
|
||||
// G4cout << "SEVERITY_NULL" << G4endl;
|
||||
return SEVERITY_NULL;
|
||||
}
|
||||
if(!strcmp(s2.chars(),"SEVERITY_USERMSG"))
|
||||
{
|
||||
// G4cout << "SEVERITY_USERMSG" << G4endl;
|
||||
return SEVERITY_USERMSG;
|
||||
}
|
||||
if(!strcmp(s2.chars(),"SEVERITY_INCOMPLETE"))
|
||||
{
|
||||
// G4cout << "SEVERITY_INCOMPLETE" << G4endl;
|
||||
return SEVERITY_INCOMPLETE;
|
||||
}
|
||||
if(!strcmp(s2.chars(),"SEVERITY_WARNING"))
|
||||
{
|
||||
// G4cout << "SEVERITY_WARNING" << G4endl;
|
||||
return SEVERITY_WARNING;
|
||||
}
|
||||
if(!strcmp(s2.chars(),"SEVERITY_INPUT_ERROR"))
|
||||
{
|
||||
// G4cout << "SEVERITY_INPUT_ERROR" << G4endl;
|
||||
return SEVERITY_INPUT_ERROR;
|
||||
}
|
||||
if(!strcmp(s2.chars(),"SEVERITY_BUG"))
|
||||
{
|
||||
// G4cout << "SEVERITY_BUG" << G4endl;
|
||||
return SEVERITY_BUG;
|
||||
}
|
||||
if(!strcmp(s2.chars(),"SEVERITY_EXIT"))
|
||||
{
|
||||
// G4cout << "SEVERITY_EXIT" << G4endl;
|
||||
return SEVERITY_EXIT;
|
||||
}
|
||||
if(!strcmp(s2.chars(),"SEVERITY_DUMP"))
|
||||
{
|
||||
// G4cout << "SEVERITY_DUMP" << G4endl;
|
||||
return SEVERITY_DUMP;
|
||||
}
|
||||
if(!strcmp(s2.chars(),"SEVERITY_MAX"))
|
||||
{
|
||||
// G4cout << "SEVERITY_MAX" << G4endl;
|
||||
return SEVERITY_MAX;
|
||||
}
|
||||
}
|
||||
G4cerr << "Internal error: " << __FILE__ << __LINE__
|
||||
<< "\n" << _POC_ "\n";
|
||||
G4cerr << "Calling ErrorDescriptor::GetCorrSeverity() with null string\n";
|
||||
return SEVERITY_BUG;
|
||||
}
|
||||
|
||||
ErrorDescriptor::ErrorDescriptor ( Severity s, DebugLevel d)
|
||||
: _severity (s),
|
||||
_userMsg (0),
|
||||
@@ -61,7 +186,12 @@ void
|
||||
ErrorDescriptor::UserMsg ( const char * msg)
|
||||
{
|
||||
if(!_userMsg)
|
||||
#ifdef __OSTORE__
|
||||
_userMsg = new (os_database::of(this),
|
||||
SCLstring::get_os_typespec()) SCLstring;
|
||||
#else
|
||||
_userMsg = new SCLstring;
|
||||
#endif
|
||||
*_userMsg = msg;
|
||||
}
|
||||
|
||||
@@ -69,15 +199,38 @@ void
|
||||
ErrorDescriptor::PrependToUserMsg ( const char * msg)
|
||||
{
|
||||
if(!_userMsg)
|
||||
#ifdef __OSTORE__
|
||||
_userMsg = new (os_database::of(this),
|
||||
SCLstring::get_os_typespec()) SCLstring;
|
||||
#else
|
||||
_userMsg = new SCLstring;
|
||||
#endif
|
||||
_userMsg -> Prepend (msg);
|
||||
}
|
||||
|
||||
void
|
||||
ErrorDescriptor::AppendToUserMsg ( const char c)
|
||||
{
|
||||
if(!_userMsg)
|
||||
#ifdef __OSTORE__
|
||||
_userMsg = new (os_database::of(this),
|
||||
SCLstring::get_os_typespec()) SCLstring;
|
||||
#else
|
||||
_userMsg = new SCLstring;
|
||||
#endif
|
||||
_userMsg -> Append(c);
|
||||
}
|
||||
|
||||
void
|
||||
ErrorDescriptor::AppendToUserMsg ( const char * msg)
|
||||
{
|
||||
if(!_userMsg)
|
||||
#ifdef __OSTORE__
|
||||
_userMsg = new (os_database::of(this),
|
||||
SCLstring::get_os_typespec()) SCLstring;
|
||||
#else
|
||||
_userMsg = new SCLstring;
|
||||
#endif
|
||||
_userMsg -> Append (msg);
|
||||
}
|
||||
|
||||
@@ -95,7 +248,12 @@ void
|
||||
ErrorDescriptor::DetailMsg ( const char * msg)
|
||||
{
|
||||
if(!_detailMsg)
|
||||
#ifdef __OSTORE__
|
||||
_detailMsg = new (os_database::of(this),
|
||||
SCLstring::get_os_typespec()) SCLstring;
|
||||
#else
|
||||
_detailMsg = new SCLstring;
|
||||
#endif
|
||||
*_detailMsg = msg;
|
||||
// G4cerr << "D " << _detailMsg->chars() << '\n';
|
||||
}
|
||||
@@ -104,14 +262,37 @@ void
|
||||
ErrorDescriptor::PrependToDetailMsg (const char * msg)
|
||||
{
|
||||
if(!_detailMsg)
|
||||
#ifdef __OSTORE__
|
||||
_detailMsg = new (os_database::of(this),
|
||||
SCLstring::get_os_typespec()) SCLstring;
|
||||
#else
|
||||
_detailMsg = new SCLstring;
|
||||
#endif
|
||||
_detailMsg -> Prepend (msg);
|
||||
}
|
||||
|
||||
void
|
||||
ErrorDescriptor::AppendToDetailMsg ( const char c)
|
||||
{
|
||||
if(!_detailMsg)
|
||||
#ifdef __OSTORE__
|
||||
_detailMsg = new (os_database::of(this),
|
||||
SCLstring::get_os_typespec()) SCLstring;
|
||||
#else
|
||||
_detailMsg = new SCLstring;
|
||||
#endif
|
||||
_detailMsg -> Append(c);
|
||||
}
|
||||
|
||||
void
|
||||
ErrorDescriptor::AppendToDetailMsg (const char * msg)
|
||||
{
|
||||
if(!_detailMsg)
|
||||
#ifdef __OSTORE__
|
||||
_detailMsg = new (os_database::of(this),
|
||||
SCLstring::get_os_typespec()) SCLstring;
|
||||
#else
|
||||
_detailMsg = new SCLstring;
|
||||
#endif
|
||||
_detailMsg -> Append (msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user