ExceptionSvc Class Reference

Simple implementation of IExceptionSvc abstract interface. More...

#include <src/ExceptionSvc.h>

Inheritance diagram for ExceptionSvc:
Collaboration diagram for ExceptionSvc:

Public Member Functions

virtual StatusCode handle (const INamedInterface &o, const GaudiException &e) const
 Handle caught GaudiExceptions. More...
 
virtual StatusCode handle (const INamedInterface &o, const std::exception &e) const
 Handle caught std::exceptions. More...
 
virtual StatusCode handle (const INamedInterface &o) const
 Handle caught (unknown)exceptions. More...
 
virtual StatusCode handleErr (const INamedInterface &o, const StatusCode &s) const
 Handle errors. More...
 
virtual StatusCode initialize ()
 initialize the service More...
 
virtual StatusCode finalize ()
 finalize the service More...
 
 ExceptionSvc (const std::string &name, ISvcLocator *svc)
 standard constructor More...
 
virtual ~ExceptionSvc ()
 Destructor. More...
 
- Public Member Functions inherited from extends1< Service, IExceptionSvc >
 extends1 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends1 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends1 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends1 ()
 Default constructor. More...
 
 extends1 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends1 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends1 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends1 ()
 Default constructor. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends1 ()
 Virtual destructor. More...
 
virtual ~extends1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector< Property * > & getProperties () const
 Get list of properties. More...
 
virtual bool hasProperty (const std::string &name) const
 Return true if we have a property with the given name. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
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. More...
 
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. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector< Property * > & getProperties () const
 Get list of properties. More...
 
virtual bool hasProperty (const std::string &name) const
 Return true if we have a property with the given name. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
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. More...
 
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. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- 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. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 1)
 InterfaceID. More...
 
 DeclareInterfaceID (IProperty, 2, 1)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from extend_interfaces1< IExceptionSvc >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IExceptionSvc
 DeclareInterfaceID (IExceptionSvc, 3, 0)
 InterfaceID. More...
 
 DeclareInterfaceID (IExceptionSvc, 3, 0)
 InterfaceID. More...
 

Private Types

enum  Policy { ALL, NONE }
 
enum  ReturnState {
  SUCCESS, FAILURE, RECOVERABLE, RETHROW,
  DEFAULT
}
 

Private Member Functions

 ExceptionSvc ()
 no default constructor More...
 
 ExceptionSvc (const ExceptionSvc &)
 no copy constructor More...
 
ExceptionSvcoperator= (const ExceptionSvc &)
 no assignement More...
 
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, ReturnStatem_retCodesExc
 
std::map< std::string, ReturnStatem_retCodesErr
 
MsgStream m_log
 

Additional Inherited Members

- Public Types inherited from extends1< Service, IExceptionSvc >
typedef extends1 base_class
 Typedef to this class. More...
 
typedef extends1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1< IExceptionSvcextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces1< IExceptionSvcextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > Factory
 
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3< IService, IProperty, IStatefulextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces3< IService, IProperty, IStatefulextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IService, IProperty, IStateful >
typedef mpl::fold< typename IService::iid::iids::type, typename mpl::fold< typename IProperty::iid::iids::type, typename IStateful::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type, mpl::insert< mpl::_1, mpl::_2 > >::type ext_iids
 MPL set of interfaces extended by this one. More...
 
typedef mpl::fold< typename IService::iid::iids::type, typename mpl::fold< typename IProperty::iid::iids::type, typename IStateful::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type, mpl::insert< mpl::_1, mpl::_2 > >::type ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Public Types inherited from extend_interfaces1< IExceptionSvc >
typedef IExceptionSvc::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
typedef IExceptionSvc::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
- Protected Member Functions inherited from IExceptionSvc
virtual ~IExceptionSvc ()
 virtual and protected destructor More...
 
virtual ~IExceptionSvc ()
 virtual and protected destructor More...
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level. More...
 
Gaudi::StateMachine::State m_state
 Service state. More...
 
Gaudi::StateMachine::State m_targetState
 Service state. More...
 
- Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

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.

Enumerator
SUCCESS 
FAILURE 
RECOVERABLE 
RETHROW 
DEFAULT 

Definition at line 63 of file ExceptionSvc.h.

Constructor & Destructor Documentation

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

standard constructor

Parameters
nameservice instance name
pSvcpointer to Service Locator

Definition at line 36 of file ExceptionSvc.cpp.

37  : base_class( name, svc )
38  , m_mode_exc ( ALL ), m_mode_err( NONE )
39  , m_log(msgSvc(), name )
40 {
41  // for exceptions
42  declareProperty( "Catch" , m_mode_exc_s="ALL" ) ;
43 
44  // for return codes
45  declareProperty( "Errors" , m_mode_err_s="NONE" ) ;
46 }
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
extends1 base_class
Typedef to this class.
Definition: extends.h:12
Policy m_mode_exc
Definition: ExceptionSvc.h:65
StringProperty m_mode_err_s
Definition: ExceptionSvc.h:66
StringProperty m_mode_exc_s
Definition: ExceptionSvc.h:66
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:329
Policy m_mode_err
Definition: ExceptionSvc.h:65
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:212
MsgStream m_log
Definition: ExceptionSvc.h:69
ExceptionSvc::~ExceptionSvc ( )
virtual

Destructor.

Definition at line 50 of file ExceptionSvc.cpp.

50  {
51 
52 }
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 193 of file ExceptionSvc.cpp.

193  {
194  StatusCode status = Service::finalize();
195 
196  return status;
197 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:197
StatusCode ExceptionSvc::handle ( const INamedInterface o,
const GaudiException e 
) const
virtual

Handle caught GaudiExceptions.

Handle caught exceptions

Implements IExceptionSvc.

Definition at line 302 of file ExceptionSvc.cpp.

304 {
305  m_log << MSG::DEBUG << "Handling GaudiException: \"" << exc << "\" for "
306  << alg.name() << endmsg;
307 
308  return process(alg);
309 
310 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual StatusCode process(const INamedInterface &o) const
MsgStream m_log
Definition: ExceptionSvc.h:69
StatusCode ExceptionSvc::handle ( const INamedInterface o,
const std::exception &  e 
) const
virtual

Handle caught std::exceptions.

Handle caught exceptions

Implements IExceptionSvc.

Definition at line 290 of file ExceptionSvc.cpp.

292 {
293  m_log << MSG::DEBUG << "Handling std:except: \"" << exc.what() << "\" for "
294  << alg.name() << endmsg;
295 
296  return process(alg) ;
297 
298 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual StatusCode process(const INamedInterface &o) const
MsgStream m_log
Definition: ExceptionSvc.h:69
StatusCode ExceptionSvc::handle ( const INamedInterface o) const
virtual

Handle caught (unknown)exceptions.

Handle caught exceptions

Implements IExceptionSvc.

Definition at line 280 of file ExceptionSvc.cpp.

281 {
282  m_log << MSG::DEBUG << "Handling unknown exception for " << alg.name()
283  << endmsg;
284 
285  return process(alg);
286 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual StatusCode process(const INamedInterface &o) const
MsgStream m_log
Definition: ExceptionSvc.h:69
StatusCode ExceptionSvc::handleErr ( const INamedInterface o,
const StatusCode s 
) const
virtual

Handle errors.

Handle errors

Implements IExceptionSvc.

Definition at line 202 of file ExceptionSvc.cpp.

204 {
205  m_log << MSG::DEBUG << "Handling Error from " << alg.name() << endmsg;
206 
207  // is this Alg special?
208  if (m_retCodesErr.find(alg.name()) != m_retCodesErr.end()) {
209  ReturnState iret = m_retCodesErr.find(alg.name())->second;
210 
211  switch ( iret ) {
212  case SUCCESS:
213  return StatusCode::SUCCESS;
214  case FAILURE:
215  return StatusCode::FAILURE;
216  case RECOVERABLE:
218  case RETHROW:
219  // should never get here
220  break;
221  case DEFAULT:
222  // should never get here
223  break;
224  }
225 
226  } else {
227 
228  if (m_mode_err == ALL) {
229  // turn it into a FAILURE
230  return StatusCode::FAILURE;
231 
232  } else {
233  assert (m_mode_err == NONE );
234  // don't touch the return code
235  return st;
236  }
237  }
238 
239  return StatusCode::FAILURE;
240 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::map< std::string, ReturnState > m_retCodesErr
Definition: ExceptionSvc.h:67
constexpr double second
Policy m_mode_err
Definition: ExceptionSvc.h:65
MsgStream m_log
Definition: ExceptionSvc.h:69
StatusCode ExceptionSvc::initialize ( )
virtual

initialize the service

Reimplemented from Service.

Definition at line 58 of file ExceptionSvc.cpp.

58  {
61 
62  if ( status.isFailure() ) { return status ; } // RETURN
63 
64  string key = m_mode_exc_s.value();
65 
66  string::size_type loc = key.find(" ");
67  std::string mode;
68  if (loc == std::string::npos) {
69  mode = key;
70  } else {
71  mode = key.substr(0,loc);
72  }
73 
74  toupper(mode);
75 
76  if (mode == "NONE") {
77  m_mode_exc = NONE;
78  } else if (mode == "ALL") {
79  m_mode_exc = ALL;
80  } else {
81  m_log << MSG::ERROR << "Unknown mode for Exception handling: \"" << mode
82  << "\". Default must be one of \"ALL\" or \"NONE\"" << endmsg;
84  return StatusCode::FAILURE;
85  }
86 
87  if (loc == string::npos) {
88  key = "";
89  } else {
90  key = key.substr(loc+1);
91  }
92 
93  std::string VAL, TAG;
94 
95  static const boost::regex exp{"[[:space:]]*([^[:space:]]+)[[:space:]]*=[[:space:]]*([^[:space:]]+)"};
96  static const auto tok_end = boost::sregex_iterator();
97  for (auto tok_iter = boost::sregex_iterator(begin(key), end(key), exp);
98  tok_iter != tok_end; ++tok_iter)
99  {
100  TAG = (*tok_iter)[1];
101 
102  VAL = (*tok_iter)[2];
103  toupper(VAL);
104 
105  if (VAL == "SUCCESS") {
106  m_retCodesExc[TAG] = SUCCESS;
107  } else if ( VAL == "FAILURE" ) {
108  m_retCodesExc[TAG] = FAILURE;
109  } else if ( VAL == "REVOVERABLE" ) {
110  m_retCodesExc[TAG] = RECOVERABLE;
111  } else if ( VAL == "RETHROW" ) {
112  m_retCodesExc[TAG] = RETHROW;
113  } else if ( VAL == "DEFAULT" ) {
114  m_retCodesExc[TAG] = DEFAULT;
115  } else {
116  m_log << MSG::ERROR << "In JobOpts: unknown return code \"" << VAL
117  << "\" for Algorithm " << TAG << std::endl
118  << " Must be one of: DEFAULT, SUCCESS, FAILURE, RECOVERABLE, RETHROW"
119  << endmsg;
121  return StatusCode::FAILURE;
122  }
123 
124  m_log << MSG::DEBUG << "Will catch exceptions thrown by: " << TAG
125  << " -> action: " << VAL << endmsg;
126 
127  }
128 
129  // now process errors
130 
131  key = m_mode_err_s.value();
132 
133  loc = key.find(" ");
134  if (loc == std::string::npos) {
135  mode = key;
136  } else {
137  mode = key.substr(0,loc);
138  }
139 
140  toupper(mode);
141 
142  if (mode == "NONE") {
143  m_mode_err = NONE;
144  } else if (mode == "ALL") {
145  m_mode_err = ALL;
146  } else {
147  m_log << MSG::ERROR << "Unknown mode for Error handling: \"" << mode
148  << "\". Default must be one of \"ALL\" or \"NONE\"" << endmsg;
150  return StatusCode::FAILURE;
151  }
152 
153  if (loc == string::npos) {
154  key = "";
155  } else {
156  key = key.substr(loc+1);
157  }
158 
159  for (auto tok_iter = boost::sregex_iterator(begin(key), end(key), exp);
160  tok_iter != tok_end; ++tok_iter)
161  {
162  TAG = (*tok_iter)[1];
163 
164  VAL = (*tok_iter)[2];
165  toupper(VAL);
166 
167  if (VAL == "SUCCESS") {
168  m_retCodesErr[TAG] = SUCCESS;
169  } else if ( VAL == "FAILURE" ) {
170  m_retCodesErr[TAG] = FAILURE;
171  } else if ( VAL == "RECOVERABLE" ) {
172  m_retCodesErr[TAG] = RECOVERABLE;
173  } else {
174  m_log << MSG::ERROR << "In JobOpts: unknown return code \"" << VAL
175  << "\" for Algorithm " << TAG << std::endl
176  << " Must be one of: SUCCESS, FAILURE, RECOVERABLE"
177  << endmsg;
179  return StatusCode::FAILURE;
180  }
181 
182  m_log << MSG::DEBUG << "Will process Errors returned by: " << TAG
183  << " -> action: " << VAL << endmsg;
184 
185  }
186 
187  return status;
188 }
IntegerProperty m_outputLevel
Service output level.
Definition: Service.h:244
Gaudi::StateMachine::State m_state
Service state.
Definition: Service.h:246
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::map< std::string, ReturnState > m_retCodesErr
Definition: ExceptionSvc.h:67
Policy m_mode_exc
Definition: ExceptionSvc.h:65
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
StringProperty m_mode_err_s
Definition: ExceptionSvc.h:66
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StringProperty m_mode_exc_s
Definition: ExceptionSvc.h:66
const TYPE & value() const
explicit conversion
Definition: Property.h:355
tuple end
Definition: IOTest.py:101
std::map< std::string, ReturnState > m_retCodesExc
Definition: ExceptionSvc.h:67
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:72
void setLevel(int level)
Update outputlevel.
Definition: MsgStream.h:106
Policy m_mode_err
Definition: ExceptionSvc.h:65
void toupper(std::string &s)
MsgStream m_log
Definition: ExceptionSvc.h:69
ExceptionSvc& ExceptionSvc::operator= ( const ExceptionSvc )
private

no assignement

StatusCode ExceptionSvc::process ( const INamedInterface o) const
privatevirtual

Definition at line 244 of file ExceptionSvc.cpp.

245 {
246 
247  // is this Alg special?
248  if (m_retCodesExc.find(alg.name()) != m_retCodesExc.end()) {
249  ReturnState iret = m_retCodesExc.find(alg.name())->second;
250 
251  switch ( iret ) {
252  case DEFAULT:
253  // there is no default
254  return StatusCode::FAILURE;
255  case SUCCESS:
256  return StatusCode::SUCCESS;
257  case FAILURE:
258  return StatusCode::FAILURE;
259  case RECOVERABLE:
261  case RETHROW:
262  throw;
263  }
264 
265  } else {
266 
267  if (m_mode_exc == ALL) {
268  throw;
269  } else {
270  assert (m_mode_exc == NONE);
271  return StatusCode::FAILURE;
272  }
273  }
274 
275  return StatusCode::FAILURE;
276 }
Policy m_mode_exc
Definition: ExceptionSvc.h:65
constexpr double second
std::map< std::string, ReturnState > m_retCodesExc
Definition: ExceptionSvc.h:67

Member Data Documentation

MsgStream ExceptionSvc::m_log
mutableprivate

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: