The Gaudi Framework  v40r0 (475e45c1)
GaudiTesting::FailingSvc Class Reference

Special service that issue a failure in one of the transitions (for testing). More...

Inheritance diagram for GaudiTesting::FailingSvc:
Collaboration diagram for GaudiTesting::FailingSvc:

Public Member Functions

StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
- Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service
More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service
More...
 
StatusCode sysStart () override
 Initialize Service
More...
 
StatusCode sysStop () override
 Initialize Service
More...
 
StatusCode sysFinalize () override
 Finalize Service
More...
 
StatusCode sysReinitialize () override
 Re-initialize the Service. More...
 
StatusCode sysRestart () override
 Re-initialize the Service. More...
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor
More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator
More...
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, const std::string &toolTypeAndName, bool createIf=true)
 Declare used tool. More...
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
template<class T >
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
const std::vector< IAlgTool * > & tools () const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
 requires (!Gaudi::Details::is_gaudi_property_v< TYPE >) Gaudi
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property. More...
 
virtual StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p)=0
 Set the property from a property with a different name. More...
 
virtual StatusCode setProperty (const std::string &s)=0
 Set the property by string. More...
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals. More...
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string. More...
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name More...
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name. More...
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected More...
 
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 

Private Member Functions

StatusCode handle (const std::string &transition)
 

Private Attributes

Gaudi::Property< std::string > m_transition
 
Gaudi::Property< std::string > m_mode { this, "Mode", "failure", "Type of failure ['failure', 'exception']" }
 

Additional Inherited Members

- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 
 ~Service () override
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state
More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state
More...
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools More...
 
Gaudi::Property< bool > m_auditorInitialize { this, "AuditInitialize", false, "trigger auditor on initialize()" }
 
Gaudi::Property< bool > m_auditorStart { this, "AuditStart", false, "trigger auditor on start()" }
 
Gaudi::Property< bool > m_auditorStop { this, "AuditStop", false, "trigger auditor on stop()" }
 
Gaudi::Property< bool > m_auditorFinalize { this, "AuditFinalize", false, "trigger auditor on finalize()" }
 
Gaudi::Property< bool > m_auditorReinitialize { this, "AuditReinitialize", false, "trigger auditor on reinitialize()" }
 
Gaudi::Property< bool > m_auditorRestart { this, "AuditRestart", false, "trigger auditor on restart()" }
 
Gaudi::Property< bool > m_autoRetrieveTools
 
Gaudi::Property< bool > m_checkToolDeps
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service
More...
 

Detailed Description

Special service that issue a failure in one of the transitions (for testing).

Definition at line 17 of file TestingSvcs.cpp.

Member Function Documentation

◆ finalize()

StatusCode GaudiTesting::FailingSvc::finalize ( )
inlineoverride

Definition at line 43 of file TestingSvcs.cpp.

43  {
44  StatusCode sc = handle( "finalize" );
45  if ( sc.isFailure() ) return sc;
46  return Service::finalize();
47  }

◆ handle()

StatusCode GaudiTesting::FailingSvc::handle ( const std::string &  transition)
inlineprivate

Definition at line 54 of file TestingSvcs.cpp.

54  {
55  if ( m_transition == transition ) {
56  if ( m_mode == "exception" ) {
57  throw GaudiException( "forced failure in " + transition, name(), StatusCode::FAILURE );
58  } else if ( m_mode == "failure" ) {
59  return StatusCode::FAILURE;
60  } else {
61  warning() << "Unknown type of failure '" << m_mode << "', use 'failure' or 'exception'" << endmsg;
62  }
63  }
64  return StatusCode::SUCCESS;
65  }

◆ initialize()

StatusCode GaudiTesting::FailingSvc::initialize ( )
inlineoverride

Definition at line 22 of file TestingSvcs.cpp.

22  {
24  if ( sc.isFailure() ) {
25  error() << "failed to initialize base class" << endmsg;
26  return sc;
27  }
28  return handle( "initialize" );
29  }

◆ Service()

Service::Service

Standard Constructor.

Definition at line 74 of file Service.cpp.

340  : m_name( std::move( name ) ), m_svcLocator( svcloc ) {
341  if ( m_name != "MessageSvc" ) { // the MessageSvc should not notify itself
344  }
345 
346  // Initialize the default value from ApplicationMgr AuditAlgorithms
347  Gaudi::Property<bool> audit( "AuditServices", false );
348  if ( auto appMgr = serviceLocator()->service<IProperty>( "ApplicationMgr" ) ) {
349  appMgr->getProperty( &audit ).ignore();
350  }
351 
352  m_auditorInitialize = audit;
353  m_auditorStart = audit;
354  m_auditorStop = audit;
355  m_auditorFinalize = audit;
356  m_auditorReinitialize = audit;
357  m_auditorRestart = audit;
358 }

◆ start()

StatusCode GaudiTesting::FailingSvc::start ( )
inlineoverride

Definition at line 30 of file TestingSvcs.cpp.

30  {
32  if ( sc.isFailure() ) {
33  error() << "failed to start base class" << endmsg;
34  return sc;
35  }
36  return handle( "start" );
37  }

◆ stop()

StatusCode GaudiTesting::FailingSvc::stop ( )
inlineoverride

Definition at line 38 of file TestingSvcs.cpp.

38  {
39  StatusCode sc = handle( "stop" );
40  if ( sc.isFailure() ) return sc;
41  return Service::stop();
42  }

Member Data Documentation

◆ m_mode

Gaudi::Property<std::string> GaudiTesting::FailingSvc::m_mode { this, "Mode", "failure", "Type of failure ['failure', 'exception']" }
private

Definition at line 52 of file TestingSvcs.cpp.

◆ m_transition

Gaudi::Property<std::string> GaudiTesting::FailingSvc::m_transition
private
Initial value:
{
this, "Transition", "", "In which transition to fail ['initialize', 'start', 'stop', 'finalize']" }

Definition at line 50 of file TestingSvcs.cpp.


The documentation for this class was generated from the following file:
Service::m_auditorStart
Gaudi::Property< bool > m_auditorStart
Definition: Service.h:186
Service::m_auditorStop
Gaudi::Property< bool > m_auditorStop
Definition: Service.h:187
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:34
GaudiTesting::FailingSvc::m_mode
Gaudi::Property< std::string > m_mode
Definition: TestingSvcs.cpp:52
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:118
Service::start
StatusCode start() override
Definition: Service.cpp:187
GaudiException
Definition: GaudiException.h:29
GaudiTesting::FailingSvc::m_transition
Gaudi::Property< std::string > m_transition
Definition: TestingSvcs.cpp:50
Service::m_auditorInitialize
Gaudi::Property< bool > m_auditorInitialize
Definition: Service.h:185
Service::m_svcLocator
SmartIF< ISvcLocator > m_svcLocator
Service Locator reference
Definition: Service.h:170
Service::m_auditorReinitialize
Gaudi::Property< bool > m_auditorReinitialize
Definition: Service.h:189
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:223
Service::m_name
std::string m_name
Service Name
Definition: Service.h:168
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:333
StatusCode
Definition: StatusCode.h:64
Service::m_auditorFinalize
Gaudi::Property< bool > m_auditorFinalize
Definition: Service.h:188
Service::m_auditorRestart
Gaudi::Property< bool > m_auditorRestart
Definition: Service.h:190
Gaudi::Property::declareUpdateHandler
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:135
CommonMessaging< implements< IService, IProperty, IStateful > >::updateMsgStreamOutputLevel
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
Definition: CommonMessaging.h:184
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:198
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:99
Service::stop
StatusCode stop() override
Definition: Service.cpp:181
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:100
IOTest.appMgr
appMgr
Definition: IOTest.py:105
GaudiTesting::FailingSvc::handle
StatusCode handle(const std::string &transition)
Definition: TestingSvcs.cpp:54
Service::m_outputLevel
Gaudi::Property< int > m_outputLevel
flag indicating whether ToolHandle tools have been added to m_tools
Definition: Service.h:184
Gaudi::Property< bool >
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
Definition: Service.cpp:336