| # 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
GslSvc Class Reference

The implementation of IGslSvc interface. More...

`#include <GslSvc.h>`

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

## Public Member Functions
virtual StatusCode | handle (const GslError &error) const
| handle the GSL error
virtual GslErrorHandler | handler () const
| retrieve the current GSL error handler
virtual GslErrorHandler | setHandler (GslErrorHandler handler) const
| set new GSL error handler
virtual StatusCode | status (const int error) const
| transform GSL error code to Gaudi status code
virtual StatusCode | initialize ()
| standard service initialization
virtual StatusCode | finalize ()
| standard service finalization
| GslSvc (const std::string &name, ISvcLocator *svc)
| Standard constructor.
virtual | ~GslSvc ()
| destructor, virtual and protected
Public Member Functions inherited from extends1< Service, IGslSvc >
| 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< IGslSvc >
virtual | ~extend_interfaces1 ()
| Virtual destructor.
Public Member Functions inherited from IGslSvc
| DeclareInterfaceID (IGslSvc, 2, 0)
| InterfaceID.
Public Member Functions inherited from IService
| DeclareInterfaceID (IService, 3, 0)
| InterfaceID.
virtual StatusCode | sysInitialize ()=0
| Initialize Service.
virtual StatusCode | sysStart ()=0
| Start Service.
virtual StatusCode | sysStop ()=0
| Stop Service.
virtual StatusCode | sysFinalize ()=0
| Finalize Service.
virtual StatusCode | sysReinitialize ()=0
| Re-initialize the Service.
virtual StatusCode | sysRestart ()=0
| Re-start the Service.
virtual StatusCode | configure ()=0
| Configuration (from OFFLINE to CONFIGURED).
virtual StatusCode | start ()=0
| Start (from INITIALIZED to RUNNING).
virtual StatusCode | stop ()=0
| Stop (from RUNNING to INITIALIZED).
virtual StatusCode | terminate ()=0
| Initialization (from CONFIGURED to OFFLINE).
virtual StatusCode | reinitialize ()=0
| Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual StatusCode | restart ()=0
| Initialization (from RUNNING to RUNNING, via INITIALIZED).
virtual Gaudi::StateMachine::State | FSMState () const =0
| Get the current state.
virtual Gaudi::StateMachine::State | targetFSMState () const =0
| When we are in the middle of a transition, get the state where the transition is leading us.
virtual | ~IService ()
| virtual destructor
Public Member Functions inherited from INamedInterface
| DeclareInterfaceID (INamedInterface, 1, 0)
| InterfaceID.
virtual const std::string & | name () const =0
| Retrieve the name of the instance.
virtual | ~INamedInterface ()
| Virtual destructor (always needed for abstract classes).
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
typedef std::vector< std::string > | Names
| external handlers
typedef std::vector < IGslErrorHandler * > | Handlers

## Private Member Functions
| GslSvc ()
| default constructor is private
| GslSvc (const GslSvc &)
| copy constructor is private
GslSvc & | operator= (const GslSvc &)
| assignment operator is private

## Private Attributes
std::string | m_errorPolicy
| error policy
Names | m_handlersTypeNames
Handlers | m_handlers
std::vector< int > | m_ignore
| codes to be ignored

## Additional Inherited Members
Public Types inherited from extends1< Service, IGslSvc >
typedef extends1 | base_class
| Typedef to this class.
typedef extend_interfaces1 < IGslSvc > | 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 IGslSvc
virtual | ~IGslSvc ()
| destructor (virtual and protected)
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

The implementation of IGslSvc interface.

The Gsl Service is teh service which perform intelligent error handling for GSL (GNU Scientific Library)

It provides a choice between different "Error Handling Policies"

Current implementation supports the several "error handling policies", which are driven by "ErrorPolicy" property of class GslSvc:

- "GSL": The simplest error policy, no action, the error hadling defined in GSL does not redefined

- "Off": The GSL empty error handling is used, what means the ignorance of all GSL errors. Program continues after any error, so the return values from any library routines must be checked. This policy is recommended by GSL team for production programs

- "Abort" The default GSL error policy, causes abort on error.

- "Ignore" The policy which is essentially the same as "Off", but performed with local error handler GslErrorHandlers::ignoreTheError

- "Exception" This policy throws the GaudiException with tag *GSL Error" to be thrown at the error. The policy implemented by local error handler GslErrorHandlers::throwException

- "Handle" The policy which uses the call back from local error handler GslErrorHandlers::handleTheError to IGslSvc::handle method. Current implementation of this method is sequential execution of declared handlers, defined through the property "Handlers" of class GslSvc in a format: GslSvc.Handlers = { "H1Type/H1Name" , "H2Type/H2Name" , "H3ype/3Name" }; The "handlers" must implement IGslErrorHandler interface The concrete handlers are provided in GaudiGSL package: class GslErorCount, GslErrorPrint and GslErrorException.

Attention
  The error handling could be "turned off" for selected error codes (e.g. GSL_SUCCESS or GSL_CONTINUE ) using "IgnoreCodes" property. This feature is active only for "Handle" error policy.

See Also
  GslErrorHandlers
  GslErrorHandlers::ingnoreTheError
  GslErrorHandlers::throwException
  GslErrorHandlers::handleTheError
  IGslSvc
  IGslErrorHandler
  GslErrorCount
  GslErrorPrint
  GslErrorException

Author
  Vanya Belyaev Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  29/04/2002

Definition at line 85 of file GslSvc.h.

## Member Typedef Documentation

typedef std::vector<IGslErrorHandler*> GslSvc::Handlers
| private

Definition at line 159 of file GslSvc.h.

typedef std::vector<std::string> GslSvc::Names
| private

external handlers

Definition at line 157 of file GslSvc.h.

## Constructor & Destructor Documentation

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

Standard constructor.

See Also
  Service

Parameters

  name | service name
  scv | pointer to service locator
  name | service name
  scv | pointer to service locator

Definition at line 38 of file GslSvc.cpp.

: base_class ( name , svc )
, m_errorPolicy ( "GSL" )
, m_handlersTypeNames ()
, m_handlers ()
, m_ignore ()
{
declareProperty( "ErrorPolicy" , m_errorPolicy ) ;
declareProperty( "Handlers" , m_handlersTypeNames ) ;
declareProperty( "IgnoreCodes" , m_ignore ) ;
}

GslSvc::~GslSvc | ( |  | ) |
| virtual

destructor, virtual and protected

destructor

Definition at line 55 of file GslSvc.cpp.

{}

GslSvc::GslSvc | ( |  | ) |
| private

default constructor is private

GslSvc::GslSvc | ( | const GslSvc & |  | ) |
| private

copy constructor is private

## Member Function Documentation

StatusCode GslSvc::finalize | ( |  | ) |
| virtual

standard service finalization

See Also
  Service
  IGslSvc
  IService

Returns
  status code

See Also
  Service
  IService

Returns
  status code

Reimplemented from Service.

Definition at line 154 of file GslSvc.cpp.

{
MsgStream log(msgSvc(), name());
log << MSG::DEBUG << "==> Finalize" << endmsg;
// deactivate the static accessor to the service
GaudiGSL::setGslSvc( 0 );
// finalize the base class
return Service::finalize() ;
}

StatusCode GslSvc::handle | ( | const GslError & | error | ) | const
| virtual

handle the GSL error

See Also
  IGslSvc

Parameters

  err | error

Returns
  status code

Parameters

  error | error

Returns
  status code

Implements IGslSvc.

Definition at line 223 of file GslSvc.cpp.

{
StatusCode sc = StatusCode::SUCCESS ;
// code to be ignored?
if( m_ignore.end() != std::find( m_ignore.begin () ,
m_ignore.end () ,
error.code ) ) { return sc ; }
// invoke all handlers
for( Handlers::const_iterator handler = m_handlers.begin() ;
sc.isSuccess() && m_handlers.end() != handler ; ++handler )
{ sc = (*handler)->handle( error ); }
//
return sc ;
}

IGslSvc::GslErrorHandler GslSvc::handler | ( |  | ) | const
| virtual

retrieve the current GSL error handler

See Also
  IGslSvc

Returns
  current GSL error handler
  current GSL error handler

Implements IGslSvc.

Definition at line 172 of file GslSvc.cpp.

{
GslErrorHandler hh = gsl_set_error_handler( 0 );
gsl_set_error_handler( hh );
return hh ;
}

StatusCode GslSvc::initialize | ( |  | ) |
| virtual

standard service initialization

See Also
  Service
  IGslSvc
  IService

Returns
  status code

See Also
  Service
  IService

Returns
  status code

Prints the type of used handler get the handler

Get Tool Service

Reimplemented from Service.

Definition at line 65 of file GslSvc.cpp.

{
// initialize the base class
StatusCode sc = Service::initialize();
MsgStream log( msgSvc() , name() );
if( sc.isFailure() )
{ log << MSG::ERROR
<< " Error in initialization of base class 'Service'"<< endmsg;
return sc;
}
// activate the static accessor to the service
GaudiGSL::setGslSvc( this );
// set the error handlers
if ( "GSL" == m_errorPolicy ) { /* nothing to do */ }
else if ( "Off" == m_errorPolicy )
{ gsl_set_error_handler_off() ; }
else if ( "Abort" == m_errorPolicy )
{ gsl_set_error_handler ( 0 ) ; }
else if ( "Ignore" == m_errorPolicy )
{ gsl_set_error_handler ( GslErrorHandlers::ignoreTheError ) ; }
else if ( "Exception" == m_errorPolicy )
{ gsl_set_error_handler ( GslErrorHandlers::throwException ) ; }
else if ( "Handle" == m_errorPolicy )
{ gsl_set_error_handler ( GslErrorHandlers::handleTheError ) ; }
else
{ log << MSG::ERROR
<< " Unknown Error policy '" << m_errorPolicy << "'"
<< " Valid policies: "
<< "[ 'GSL' , 'Off' , 'Abort' , 'Ignore' , 'Exception' , 'Handle' ]"
<< endmsg;
return StatusCode::FAILURE ;
}
GslErrorHandler handler = gsl_set_error_handler( 0 );
gsl_set_error_handler( handler );
if( 0 != handler )
{ log << MSG::VERBOSE
<< " GSL Error Handler is '"
<< System::typeinfoName( typeid(*handler) ) << "'"
<< endmsg; }
else { log << MSG::INFO << " Error Handler is NULL" << endmsg ; }
if( !m_handlersTypeNames.empty() )
{
SmartIF<IToolSvc> toolsvc(serviceLocator()->service("ToolSvc"));
if (!toolsvc.isValid()) {
log << MSG::ERROR << " Could not locate Tool Service! " << endmsg;
return StatusCode::FAILURE;
}
for( Names::const_iterator it = m_handlersTypeNames.begin() ;
m_handlersTypeNames.end() != it ; ++it )
{
std::string::const_iterator ipos =
std::find( it->begin() , it->end() , '/');
const std::string::size_type pos = ipos - it->begin() ;
IGslErrorHandler* eh = 0 ;
if( it->end() != ipos )
{ sc = toolsvc->retrieveTool
( std::string( *it , 0 , pos ) ,
std::string( *it , pos + 1, it->length() ), eh , this ) ; }
else
{ sc = toolsvc->retrieveTool
( *it , std::string( *it , pos + 1, it->length() ) ,
eh , this ) ; }
if( sc.isFailure() )
{ log << MSG::ERROR
<< " Could not retrieve tool '" << *it << "'"<< endmsg ;
return sc ; }
if( 0 == eh )
{ log << MSG::ERROR
<< " Could not retrieve tool '" << *it << "'"<< endmsg ;
return StatusCode::FAILURE ; }
m_handlers.push_back( eh );
}
}
//
return StatusCode::SUCCESS;
}

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

assignment operator is private

IGslSvc::GslErrorHandler GslSvc::setHandler | ( | IGslSvc::GslErrorHandler | handler | ) | const
| virtual

set new GSL error handler

See Also
  IGslSvc

Parameters

  handler | new GSL error handler

Returns
  GSL error handler

Parameters

  handler | new GSL error handler

Returns
  GSL error handler

Implements IGslSvc.

Definition at line 187 of file GslSvc.cpp.

{
gsl_set_error_handler( handler );
{
MsgStream log( msgSvc(), name() );
log << MSG::DEBUG << " New GSL handler is set '" ;
if( 0 == handler ) { log << "NULL" ; }
else { log << System::typeinfoName( typeid(handler) ) ; }
log << "'" << endmsg ;
}
return handler ;
}

StatusCode GslSvc::status | ( | const int | error | ) | const
| virtual

transform GSL error code to Gaudi status code

See Also
  IGslSvc

Parameters

  error | GLS error code

Returns
  status code

Parameters

  error | GLS error code

Returns
  status code

Implements IGslSvc.

Definition at line 207 of file GslSvc.cpp.

{
if( GSL_SUCCESS == error ){ return StatusCode::SUCCESS ; }
StatusCode sc( error );
if( sc.isSuccess() ){ return StatusCode::FAILURE ; }
return sc ;
}

## Member Data Documentation

std::string GslSvc::m_errorPolicy
| private

error policy

Definition at line 154 of file GslSvc.h.

Handlers GslSvc::m_handlers
| private

Definition at line 160 of file GslSvc.h.

Names GslSvc::m_handlersTypeNames
| private

Definition at line 158 of file GslSvc.h.

std::vector<int> GslSvc::m_ignore
| private

codes to be ignored

Definition at line 163 of file GslSvc.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiGSL/src/Components/GslSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiGSL/src/Components/GslSvc.cpp