97#include "CLHEP/Exceptions/defs.h"
101#ifndef STRING_INCLUDED
102 #define STRING_INCLUDED
106#ifndef ZMEXSEVERITY_H
107 #include "CLHEP/Exceptions/ZMexSeverity.h"
110#ifndef ZMEXLOGRESULT_H
111 #include "CLHEP/Exceptions/ZMexLogResult.h"
115 #include "CLHEP/Exceptions/ZMexAction.h"
118#ifndef ZMEXCLASSINFO_H
119 #include "CLHEP/Exceptions/ZMexClassInfo.h"
125#ifdef ZM_USE_NAMESPACES
174 #ifndef DEFECT_NO_MUTABLE
178 #ifndef DEFECT_NO_MUTABLE
187 #ifndef DEFECT_NO_MUTABLE
191 #ifndef DEFECT_NO_MUTABLE
204 const std::string & mesg
211 const std::ostringstream & msg
242 virtual std::string
logMessage(
const std::string optText =
"" )
const;
244 virtual std::string
facility()
const;
247 virtual std::string
name()
const;
354#define ZMexClassStaticMethods \
356 static zmex::ZMexHandler setHandler( \
357 const zmex::ZMexHandler & newHandler ) { \
358 return _classInfo.setHandler( newHandler); } \
359 static zmex::ZMexHandler getHandler() { \
360 return _classInfo.getHandler(); } \
362 static zmex::ZMexLogger setLogger( \
363 const zmex::ZMexLogger & newLogger ) { \
364 return _classInfo.setLogger( newLogger ); } \
365 static zmex::ZMexLogger getLogger() { \
366 return _classInfo.getLogger(); } \
368 static zmex::ZMexSeverity setSeverity ( \
369 const zmex::ZMexSeverity & newSeverity ) { \
370 return _classInfo.setSeverity (newSeverity); } \
371 static const std::string setName ( const std::string & newName ) { \
372 return _classInfo.setName (newName); } \
373 static const std::string setFacility(const std::string& newFacility){ \
374 return _classInfo.setFacility (newFacility); } \
375 static bool isTypeOf( const zmex::ZMexception & x ) { \
376 return ( (_classInfo.name() == x.name()) && \
377 (_classInfo.facility() == x.facility() ) ); } \
379 static bool isBaseOf( const zmex::ZMexception & x ) { \
380 return ( x.isDerivedFrom (_classInfo.name(), \
381 _classInfo.facility()) ); } \
383 static void logNMore( const int N ) { \
384 _classInfo.logNMore( N ); } \
402#define ZMexVirtualMethods(Parent,Class) \
404 virtual Class * clone() const { \
405 return new Class( *this ); } \
407 virtual zmex::ZMexClassInfo & classInfo() const { \
408 return Class::_classInfo; } \
410 virtual zmex::ZMexAction handleMe() const { \
412 zmex::ZMexAction result = \
413 Class::classInfo().getHandler().takeCareOf( *this ); \
414 return (result == zmex::ZMexHANDLEVIAPARENT) ? \
415 Parent::handleMe() : result; } \
417 virtual zmex::ZMexLogResult logMe() const { \
419 zmex::ZMexLogResult result = \
420 Class::classInfo().getLogger().emit( *this ); \
421 return (result == zmex::ZMexLOGVIAPARENT) ? \
422 Parent::logMe() : result; } \
424 virtual bool isDerivedFrom( const std::string aName, \
425 const std::string aFacility ) const { \
426 return aName == name() && aFacility == facility() \
428 : Parent::isDerivedFrom( aName, aFacility ); \
480#define ZMexStandardContents(Parent,Class) \
482 static zmex::ZMexClassInfo _classInfo; \
485 const std::string & mesg \
486 , const zmex::ZMexSeverity howBad = \
487 zmex::ZMexSEVERITYenumLAST \
488 , int icount = _classInfo.nextCount() \
492 , (howBad == zmex::ZMexSEVERITYenumLAST ? \
493 _classInfo.severity() : howBad) \
499 const std::ostringstream& msg \
500 , const zmex::ZMexSeverity howBad = \
501 zmex::ZMexSEVERITYenumLAST \
502 , int icount = _classInfo.nextCount() \
506 , (howBad == zmex::ZMexSEVERITYenumLAST ? \
507 _classInfo.severity() : howBad) \
512 ZMexClassStaticMethods; \
513 ZMexVirtualMethods(Parent,Class); \
523#define ZMexStandardDefinition(Parent,Class) \
524 class Class : public Parent { \
525 ZMexStandardContents(Parent,Class) \
535#define ZMEXCEPTION_ICC
536#include "CLHEP/Exceptions/ZMexception.icc"
537#undef ZMEXCEPTION_ICC
ZMexHandler getHandler() const
ZMexLogger getLogger() const
virtual ZMexAction takeCareOf(const ZMexception &x)
ZMexLogResult emit(const ZMexception &exc)
std::string fileName() const
static ZMexClassInfo _classInfo
std::string sourceFileName_
virtual ZMexLogResult logMe() const
virtual void logObject() const
std::string handlerUsed() const
const ZMexSeverity mySeverity_
const std::string message_
void wasThrown(bool b) const
virtual std::string logMessage(const std::string optText="") const
ZMexception(const std::string &mesg, const ZMexSeverity howBad=ZMexSEVERITYenumLAST, int icount=ZMexception::_classInfo.nextCount())
std::string message() const
void handlerUsed(const std::string handlerName) const
virtual zmex::ZMexClassInfo & classInfo() const
virtual ZMexception * clone() const
virtual std::string facility() const
virtual bool isDerivedFrom(const std::string, const std::string) const
virtual ZMexAction handleMe() const
ZMexSeverity severity() const
virtual std::string name() const
void location(int line, const std::string file) const
ZMexHandler & ZMhandler()
std::string ZMexUserActivity