18 #include "gsl/gsl_errno.h"
41 , m_errorPolicy ( "GSL" )
42 , m_handlersTypeNames ()
46 declareProperty(
"ErrorPolicy" , m_errorPolicy ) ;
47 declareProperty(
"Handlers" , m_handlersTypeNames ) ;
48 declareProperty(
"IgnoreCodes" , m_ignore ) ;
72 <<
" Error in initialization of base class 'Service'"<<
endmsg;
80 { gsl_set_error_handler_off() ; }
82 { gsl_set_error_handler ( 0 ) ; }
92 <<
" Valid policies: "
93 <<
"[ 'GSL' , 'Off' , 'Abort' , 'Ignore' , 'Exception' , 'Handle' ]"
100 gsl_set_error_handler( handler );
103 <<
" GSL Error Handler is '"
119 std::string::const_iterator ipos =
120 std::find( it->begin() , it->end() ,
'/');
121 const std::string::size_type pos = ipos - it->begin() ;
123 if( it->end() != ipos )
124 { sc = toolsvc->retrieveTool
125 ( std::string( *it , 0 , pos ) ,
126 std::string( *it , pos + 1, it->length() ), eh ,
this ) ; }
128 { sc = toolsvc->retrieveTool
129 ( *it , std::string( *it , pos + 1, it->length() ) ,
133 <<
" Could not retrieve tool '" << *it <<
"'"<<
endmsg ;
137 <<
" Could not retrieve tool '" << *it <<
"'"<<
endmsg ;
175 gsl_set_error_handler( hh );
189 gsl_set_error_handler( handler );
192 log <<
MSG::DEBUG <<
" New GSL handler is set '" ;
193 if( 0 == handler ) { log <<
"NULL" ; }
227 if( m_ignore.end() != std::find( m_ignore.begin () ,
229 error.
code ) ) {
return sc ; }
231 for( Handlers::const_iterator handler = m_handlers.begin() ;
232 sc.
isSuccess() && m_handlers.end() != handler ; ++handler )
233 { sc = (*handler)->handle( error ); }
The abstract interface for arbitrary GSL error handler.
GAUDI_API void handleTheError(const char *reason, const char *file, int line, int code)
The simplest Gsl Error handler, It delegates the actual error handling to GSL Service.
Definition of the MsgStream class used to transmit messages.
virtual StatusCode handle(const GslError &error) const
handle the GSL error
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Helper class to represent GSL errors.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
virtual StatusCode initialize()
standard service initialization
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
Names m_handlersTypeNames
virtual ~GslSvc()
destructor, virtual and protected
GAUDI_API void throwException(const char *reason, const char *file, int line, int code)
The simple Gsl Error handler, it throwns the Gaudi Exception.
bool isFailure() const
Test for a status code of FAILURE.
void(* GslErrorHandler)(const char *, const char *, int, int)
type definition of "standard" GSL error handler functions
#define DECLARE_COMPONENT(type)
virtual GslErrorHandler handler() const
retrieve the current GSL error handler
bool isValid() const
Allow for check if smart pointer is valid.
This class is used for returning status codes from appropriate routines.
The implementation of IGslSvc interface.
virtual const std::string & name() const
Retrieve name of the service.
std::string m_errorPolicy
error policy
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
virtual GslErrorHandler setHandler(GslErrorHandler handler) const
set new GSL error handler
Templated class to add the standard messaging functionalities.
static const IGslSvc * setGslSvc(const IGslSvc *value)
set new value for static Gaudi GSL Service
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.
GAUDI_API void ignoreTheError(const char *reason, const char *file, int line, int code)
The simplest Gsl Error handler, It simply ingnores the error.
virtual StatusCode finalize()
standard service finalization
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
virtual StatusCode status(const int error) const
transform GSL error code to Gaudi status code