| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ExceptionSvc Class Reference

Simple implementation of IExceptionSvc abstract interface. More...

`#include <ExceptionSvc.h>`

Inheritance diagram for ExceptionSvc:
[legend]
Collaboration diagram for ExceptionSvc:
[legend]

## Public Member Functions
virtual StatusCode | handle (const INamedInterface &o, const GaudiException &e) const
| Handle caught GaudiExceptions.
virtual StatusCode | handle (const INamedInterface &o, const std::exception &e) const
| Handle caught std::exceptions.
virtual StatusCode | handle (const INamedInterface &o) const
| Handle caught (unknown)exceptions.
virtual StatusCode | handleErr (const INamedInterface &o, const StatusCode &s) const
| Handle errors.
virtual StatusCode | initialize ()
| initialize the service
virtual StatusCode | finalize ()
| finalize the service
| ExceptionSvc (const std::string &name, ISvcLocator *svc)
| standard constructor
virtual | ~ExceptionSvc ()
| Destructor.
Public Member Functions inherited from extends1< Service, IExceptionSvc >
| extends1 (A1 a1, A2 a2, A3 a3)
| Templated constructor with 3 arguments.
| extends1 (A1 a1, A2 a2)
| Templated constructor with 2 arguments.
| extends1 (A1 a1)
| Templated constructor with 1 argument.
| extends1 ()
| Default constructor.
virtual void * | i_cast (const InterfaceID &tid) const
| Implementation of IInterface::i_cast.
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)
| Implementation of IInterface::queryInterface.
virtual std::vector< std::string > | getInterfaceNames () const
| Implementation of IInterface::getInterfaceNames.
virtual | ~extends1 ()
| Virtual destructor.
Public Member Functions inherited from Service
virtual unsigned long | release ()
| Release Interface instance.
virtual const std::string & | name () const
| Retrieve name of the service.
virtual StatusCode | configure ()
virtual StatusCode | start ()
virtual StatusCode | stop ()
virtual StatusCode | terminate ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | reinitialize ()
virtual StatusCode | restart ()
virtual StatusCode | sysInitialize ()
| Initialize Service.
virtual StatusCode | sysStart ()
| Initialize Service.
virtual StatusCode | sysStop ()
| Initialize Service.
virtual StatusCode | sysFinalize ()
| Finalize Service.
virtual StatusCode | sysReinitialize ()
| Re-initialize the Service.
virtual StatusCode | sysRestart ()
| Re-initialize the Service.
virtual StatusCode | setProperty (const Property &p)
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
virtual StatusCode | getProperty (Property *p) const
virtual const Property & | getProperty (const std::string &name) const
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
virtual const std::vector < Property * > & | getProperties () const
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| Service (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor.
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job.
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist.
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
| CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
| Templated constructor with 3 arguments.
| CommonMessaging (const A1 &a1, const A2 &a2)
| Templated constructor with 2 arguments.
| CommonMessaging (const A1 &a1)
| Templated constructor with 1 argument.
| CommonMessaging ()
| Default constructor.
virtual | ~CommonMessaging ()
| Virtual destructor.
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
MsgStream & | msgStream () const
| Return an uninitialized MsgStream.
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts.
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL)
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING)
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO)
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG)
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO)
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream
Public Member Functions inherited from extend_interfaces1< IExceptionSvc >
virtual | ~extend_interfaces1 ()
| Virtual destructor.
Public Member Functions inherited from IExceptionSvc
| DeclareInterfaceID (IExceptionSvc, 3, 0)
| InterfaceID.
Public Member Functions inherited from IInterface
virtual unsigned long | addRef ()=0
| Increment the reference count of Interface instance.
virtual unsigned long | release ()=0
| Release Interface instance.
virtual unsigned long | refCount () const =0
| Current reference count.
virtual | ~IInterface ()
| Virtual destructor.

## Private Types
enum | Policy { ALL, NONE }
enum | ReturnState { SUCCESS, FAILURE, RECOVERABLE, RETHROW, DEFAULT }

## Private Member Functions
| ExceptionSvc ()
| no default constructor
| ExceptionSvc (const ExceptionSvc &)
| no copy constructor
ExceptionSvc & | operator= (const ExceptionSvc &)
| no assignement
virtual StatusCode | process (const INamedInterface &o) const

## Private Attributes
Policy | m_mode_exc
Policy | m_mode_err
StringProperty | m_mode_exc_s
StringProperty | m_mode_err_s
std::map< std::string, ReturnState > | m_retCodesExc
std::map< std::string, ReturnState > | m_retCodesErr
MsgStream | m_log

## Additional Inherited Members
Public Types inherited from extends1< Service, IExceptionSvc >
typedef extends1 | base_class
| Typedef to this class.
typedef extend_interfaces1 < IExceptionSvc > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Static Public Member Functions inherited from IInterface
static const InterfaceID & | interfaceID ()
| Return an instance of InterfaceID identifying the interface.
Protected Member Functions inherited from Service
virtual | ~Service ()
| Standard Destructor.
int | outputLevel () const
| get the `Service's` output level
Protected Member Functions inherited from IExceptionSvc
virtual | ~IExceptionSvc ()
| virtual and protected destructor
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel
| Service output level.
Gaudi::StateMachine::State | m_state
| Service state.
Gaudi::StateMachine::State | m_targetState
| Service state.

## Detailed Description

Simple implementation of IExceptionSvc abstract interface.

Author
  (1) ATLAS collaboration
  (2) modified by Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2007-03-08

Definition at line 19 of file ExceptionSvc.h.

## Member Enumeration Documentation

enum ExceptionSvc::Policy
| private

Enumerator:

  ALL |
  NONE |

Definition at line 62 of file ExceptionSvc.h.

{ ALL, NONE };

enum ExceptionSvc::ReturnState
| private

Enumerator:

  SUCCESS |
  FAILURE |
  RECOVERABLE |
  RETHROW |
  DEFAULT |

Definition at line 63 of file ExceptionSvc.h.

{ SUCCESS, FAILURE, RECOVERABLE, RETHROW, DEFAULT };

## Constructor & Destructor Documentation

ExceptionSvc::ExceptionSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc
| ) |  |

standard constructor

Parameters

  name | service instance name
  pSvc | pointer to Service Locator

Definition at line 35 of file ExceptionSvc.cpp.

: base_class( name, svc )
, m_mode_exc ( ALL ), m_mode_err( NONE )
, m_log(msgSvc(), name )
{
// for exceptions
declareProperty( "Catch" , m_mode_exc_s="ALL" ) ;
// for return codes
declareProperty( "Errors" , m_mode_err_s="NONE" ) ;
}

ExceptionSvc::~ExceptionSvc | ( |  | ) |
| virtual

Destructor.

Definition at line 49 of file ExceptionSvc.cpp.

{
}

ExceptionSvc::ExceptionSvc | ( |  | ) |
| private

no default constructor

ExceptionSvc::ExceptionSvc | ( | const ExceptionSvc & |  | ) |
| private

no copy constructor

## Member Function Documentation

StatusCode ExceptionSvc::finalize | ( |  | ) |
| virtual

finalize the service

Reimplemented from Service.

Definition at line 198 of file ExceptionSvc.cpp.

{
StatusCode status = Service::finalize();
return status;
}

StatusCode ExceptionSvc::handle | ( | const INamedInterface & | o,
|  | const GaudiException & | e
| ) |  | const
| virtual

Handle caught GaudiExceptions.

Handle caught exceptions

Implements IExceptionSvc.

Definition at line 307 of file ExceptionSvc.cpp.

{
m_log << MSG::DEBUG << "Handling GaudiException: \"" << exc << "\" for "
<< alg.name() << endmsg;
return process(alg);
}

StatusCode ExceptionSvc::handle | ( | const INamedInterface & | o,
|  | const std::exception & | e
| ) |  | const
| virtual

Handle caught std::exceptions.

Handle caught exceptions

Implements IExceptionSvc.

Definition at line 295 of file ExceptionSvc.cpp.

{
m_log << MSG::DEBUG << "Handling std:except: \"" << exc.what() << "\" for "
<< alg.name() << endmsg;
return process(alg) ;
}

StatusCode ExceptionSvc::handle | ( | const INamedInterface & | o | ) | const
| virtual

Handle caught (unknown)exceptions.

Handle caught exceptions

Implements IExceptionSvc.

Definition at line 285 of file ExceptionSvc.cpp.

{
m_log << MSG::DEBUG << "Handling unknown exception for " << alg.name()
<< endmsg;
return process(alg);
}

StatusCode ExceptionSvc::handleErr | ( | const INamedInterface & | o,
|  | const StatusCode & | s
| ) |  | const
| virtual

Handle errors.

Handle errors

Implements IExceptionSvc.

Definition at line 207 of file ExceptionSvc.cpp.

{
m_log << MSG::DEBUG << "Handling Error from " << alg.name() << endmsg;
// is this Alg special?
if (m_retCodesErr.find(alg.name()) != m_retCodesErr.end()) {
ReturnState iret = m_retCodesErr.find(alg.name())->second;
switch ( iret ) {
case SUCCESS:
return StatusCode::SUCCESS;
case FAILURE:
return StatusCode::FAILURE;
case RECOVERABLE:
return StatusCode::RECOVERABLE;
case RETHROW:
// should never get here
break;
case DEFAULT:
// should never get here
break;
}
} else {
if (m_mode_err == ALL) {
// turn it into a FAILURE
return StatusCode::FAILURE;
} else {
assert (m_mode_err == NONE );
// don't touch the return code
return st;
}
}
return StatusCode::FAILURE;
}

StatusCode ExceptionSvc::initialize | ( |  | ) |
| virtual

initialize the service

Reimplemented from Service.

Definition at line 57 of file ExceptionSvc.cpp.

{
StatusCode status = Service::initialize();
m_log.setLevel( m_outputLevel.value() );
if ( status.isFailure() ) { return status ; } // RETURN
string key = m_mode_exc_s.value();
string::size_type loc = key.find(" ");
std::string mode;
if (loc == std::string::npos) {
mode = key;
} else {
mode = key.substr(0,loc);
}
toupper(mode);
if (mode == "NONE") {
m_mode_exc = NONE;
} else if (mode == "ALL") {
m_mode_exc = ALL;
} else {
m_log << MSG::ERROR << "Unknown mode for Exception handling: \"" << mode
<< "\". Default must be one of \"ALL\" or \"NONE\"" << endmsg;
m_state = Gaudi::StateMachine::OFFLINE;
return StatusCode::FAILURE;
}
if (loc == string::npos) {
key = "";
} else {
key = key.substr(loc+1,key.length());
}
Tokenizer tok(true);
std::string val,VAL,TAG;
tok.analyse( key, " ", "", "", "=", "", "");
for ( Tokenizer::Items::iterator i = tok.items().begin();
i != tok.items().end(); i++) {
const std::string& tag = (*i).tag();
TAG = tag;
val = (*i).value();
VAL = val;
toupper(VAL);
if (VAL == "SUCCESS") {
m_retCodesExc[TAG] = SUCCESS;
} else if ( VAL == "FAILURE" ) {
m_retCodesExc[TAG] = FAILURE;
} else if ( VAL == "REVOVERABLE" ) {
m_retCodesExc[TAG] = RECOVERABLE;
} else if ( VAL == "RETHROW" ) {
m_retCodesExc[TAG] = RETHROW;
} else if ( VAL == "DEFAULT" ) {
m_retCodesExc[TAG] = DEFAULT;
} else {
m_log << MSG::ERROR << "In JobOpts: unknown return code \"" << VAL
<< "\" for Algorithm " << TAG << std::endl
<< " Must be one of: DEFAULT, SUCCESS, FAILURE, RECOVERABLE, RETHROW"
<< endmsg;
m_state = Gaudi::StateMachine::OFFLINE;
return StatusCode::FAILURE;
}
m_log << MSG::DEBUG << "Will catch exceptions thrown by: " << TAG
<< " -> action: " << VAL << endmsg;
}
// now process errors
key = m_mode_err_s.value();
loc = key.find(" ");
if (loc == std::string::npos) {
mode = key;
} else {
mode = key.substr(0,loc);
}
toupper(mode);
if (mode == "NONE") {
m_mode_err = NONE;
} else if (mode == "ALL") {
m_mode_err = ALL;
} else {
m_log << MSG::ERROR << "Unknown mode for Error handling: \"" << mode
<< "\". Default must be one of \"ALL\" or \"NONE\"" << endmsg;
m_state = Gaudi::StateMachine::OFFLINE;
return StatusCode::FAILURE;
}
if (loc == string::npos) {
key = "";
} else {
key = key.substr(loc+1,key.length());
}
Tokenizer tok2(true);
tok2.analyse( key, " ", "", "", "=", "", "");
for ( Tokenizer::Items::iterator i = tok2.items().begin();
i != tok2.items().end(); i++) {
const std::string& tag = (*i).tag();
TAG = tag;
val = (*i).value();
VAL = val;
toupper(VAL);
if (VAL == "SUCCESS") {
m_retCodesErr[TAG] = SUCCESS;
} else if ( VAL == "FAILURE" ) {
m_retCodesErr[TAG] = FAILURE;
} else if ( VAL == "RECOVERABLE" ) {
m_retCodesErr[TAG] = RECOVERABLE;
} else {
m_log << MSG::ERROR << "In JobOpts: unknown return code \"" << VAL
<< "\" for Algorithm " << TAG << std::endl
<< " Must be one of: SUCCESS, FAILURE, RECOVERABLE"
<< endmsg;
m_state = Gaudi::StateMachine::OFFLINE;
return StatusCode::FAILURE;
}
m_log << MSG::DEBUG << "Will process Errors returned by: " << TAG
<< " -> action: " << VAL << endmsg;
}
return status;
}

ExceptionSvc& ExceptionSvc::operator= | ( | const ExceptionSvc & |  | ) |
| private

no assignement

StatusCode ExceptionSvc::process | ( | const INamedInterface & | o | ) | const
| private virtual

Definition at line 249 of file ExceptionSvc.cpp.

{
// is this Alg special?
if (m_retCodesExc.find(alg.name()) != m_retCodesExc.end()) {
ReturnState iret = m_retCodesExc.find(alg.name())->second;
switch ( iret ) {
case DEFAULT:
// there is no default
return StatusCode::FAILURE;
case SUCCESS:
return StatusCode::SUCCESS;
case FAILURE:
return StatusCode::FAILURE;
case RECOVERABLE:
return StatusCode::RECOVERABLE;
case RETHROW:
throw;
}
} else {
if (m_mode_exc == ALL) {
throw;
} else {
assert (m_mode_exc == NONE);
return StatusCode::FAILURE;
}
}
return StatusCode::FAILURE;
}

## Member Data Documentation

MsgStream ExceptionSvc::m_log
| mutable private

Definition at line 69 of file ExceptionSvc.h.

Policy ExceptionSvc::m_mode_err
| private

Definition at line 65 of file ExceptionSvc.h.

StringProperty ExceptionSvc::m_mode_err_s
| private

Definition at line 66 of file ExceptionSvc.h.

Policy ExceptionSvc::m_mode_exc
| private

Definition at line 65 of file ExceptionSvc.h.

StringProperty ExceptionSvc::m_mode_exc_s
| private

Definition at line 66 of file ExceptionSvc.h.

std::map<std::string,ReturnState> ExceptionSvc::m_retCodesErr
| private

Definition at line 67 of file ExceptionSvc.h.

std::map<std::string,ReturnState> ExceptionSvc::m_retCodesExc
| private

Definition at line 67 of file ExceptionSvc.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiMonitor/src/ExceptionSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiMonitor/src/ExceptionSvc.cpp