The Gaudi Framework  master (37c0b60a)
Gaudi::FSMCallbackHolder< BASE > Class Template Reference

Helper class to implement the IFSMCallbackHolder interface. More...

#include </builds/gaudi/Gaudi/GaudiKernel/include/Gaudi/FSMCallbackHolder.h>

Inheritance diagram for Gaudi::FSMCallbackHolder< BASE >:
Collaboration diagram for Gaudi::FSMCallbackHolder< BASE >:

Public Types

using Parent = extends< BASE, IFSMCallbackHolder >
 
- Public Types inherited from extends< BASE, IFSMCallbackHolder >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 

Public Member Functions

void registerCallBack (StateMachine::Transition s, IFSMCallbackHolder::CallBack c) override
 
StatusCode sysInitialize () override
 
StatusCode sysStart () override
 
StatusCode sysStop () override
 
StatusCode sysFinalize () override
 
- Public Member Functions inherited from extends< BASE, IFSMCallbackHolder >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 

Private Member Functions

void handleCallBacks (StateMachine::Transition state)
 

Private Attributes

std::map< StateMachine::Transition, std::vector< IFSMCallbackHolder::CallBack > > m_callbacks
 

Detailed Description

template<class BASE>
class Gaudi::FSMCallbackHolder< BASE >

Helper class to implement the IFSMCallbackHolder interface.

FSMCallbackHolder is used by components base classes (Algorithm, Tool, etc.) to provide a default implementation the IFSMCallbackHolder interface.

When needing to implement the IFSMCallbackHolder interface in a class, it is enough to wrap the base of the class with FSMCallbackHolder, as in

class MyClass : public FSMCallbackHolder<BaseClass> {
// ...
};

Definition at line 37 of file FSMCallbackHolder.h.

Member Typedef Documentation

◆ Parent

template<class BASE >
using Gaudi::FSMCallbackHolder< BASE >::Parent = extends<BASE, IFSMCallbackHolder>

Definition at line 40 of file FSMCallbackHolder.h.

Member Function Documentation

◆ handleCallBacks()

template<class BASE >
void Gaudi::FSMCallbackHolder< BASE >::handleCallBacks ( StateMachine::Transition  state)
inlineprivate

Definition at line 61 of file FSMCallbackHolder.h.

61  {
63  []( IFSMCallbackHolder::CallBack const& c ) { c(); } );
64  }

◆ registerCallBack()

template<class BASE >
void Gaudi::FSMCallbackHolder< BASE >::registerCallBack ( StateMachine::Transition  s,
IFSMCallbackHolder< BASE >::CallBack  c 
)
inlineoverride

Definition at line 43 of file FSMCallbackHolder.h.

43  {
44  m_callbacks[s].push_back( std::move( c ) );
45  }

◆ sysFinalize()

template<class BASE >
StatusCode Gaudi::FSMCallbackHolder< BASE >::sysFinalize ( )
inlineoverride

Definition at line 56 of file FSMCallbackHolder.h.

56  {
57  return Parent::sysFinalize().andThen( [&]() { handleCallBacks( StateMachine::FINALIZE ); } );
58  }

◆ sysInitialize()

template<class BASE >
StatusCode Gaudi::FSMCallbackHolder< BASE >::sysInitialize ( )
inlineoverride

Definition at line 47 of file FSMCallbackHolder.h.

47  {
48  return Parent::sysInitialize().andThen( [&]() { handleCallBacks( StateMachine::INITIALIZE ); } );
49  }

◆ sysStart()

template<class BASE >
StatusCode Gaudi::FSMCallbackHolder< BASE >::sysStart ( )
inlineoverride

Definition at line 50 of file FSMCallbackHolder.h.

50  {
51  return Parent::sysStart().andThen( [&]() { handleCallBacks( StateMachine::START ); } );
52  }

◆ sysStop()

template<class BASE >
StatusCode Gaudi::FSMCallbackHolder< BASE >::sysStop ( )
inlineoverride

Definition at line 53 of file FSMCallbackHolder.h.

53  {
54  return Parent::sysStop().andThen( [&]() { handleCallBacks( StateMachine::STOP ); } );
55  }

Member Data Documentation

◆ m_callbacks

Definition at line 66 of file FSMCallbackHolder.h.


The documentation for this class was generated from the following file:
std::for_each
T for_each(T... args)
std::move
T move(T... args)
gaudirun.s
string s
Definition: gaudirun.py:346
Gaudi::StateMachine::FINALIZE
@ FINALIZE
Definition: StateMachine.h:38
Gaudi::IFSMCallbackHolder::CallBack
std::function< void()> CallBack
Definition: IFSMCallbackHolder.h:27
gaudirun.c
c
Definition: gaudirun.py:525
Gaudi::StateMachine::INITIALIZE
@ INITIALIZE
Definition: StateMachine.h:35
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:136
Gaudi::StateMachine::START
@ START
Definition: StateMachine.h:36
Gaudi::FSMCallbackHolder::m_callbacks
std::map< StateMachine::Transition, std::vector< IFSMCallbackHolder::CallBack > > m_callbacks
Definition: FSMCallbackHolder.h:66
IOTest.end
end
Definition: IOTest.py:125
compareRootHistos.state
state
Definition: compareRootHistos.py:496
Gaudi::FSMCallbackHolder::handleCallBacks
void handleCallBacks(StateMachine::Transition state)
Definition: FSMCallbackHolder.h:61
Gaudi::StateMachine::STOP
@ STOP
Definition: StateMachine.h:37