The Gaudi Framework  master (37c0b60a)
FSMCallbackTestAlgo.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #include <Gaudi/Algorithm.h>
13 
14 namespace Gaudi::TestSuite {
15 
19  struct FSMCallbackTestAlgo : FSMCallbackHolder<Algorithm> {
21  : FSMCallbackHolder<Algorithm>( name, pSvcLocator ) {
22  registerCallBack( StateMachine::INITIALIZE, []() { std::cout << "Callback properly called at INITIALIZE\n"; } );
23  registerCallBack( StateMachine::START, []() { std::cout << "Callback properly called at START\n"; } );
24  registerCallBack( StateMachine::STOP, []() { std::cout << "Callback properly called at STOP\n"; } );
25  registerCallBack( StateMachine::FINALIZE, []() { std::cout << "Callback properly called at FINALIZE\n"; } );
26  }
27  StatusCode execute( const EventContext& ) const override {
28  std::cout << "Executing\n";
29  return StatusCode::SUCCESS;
30  }
31  };
32  DECLARE_COMPONENT( FSMCallbackTestAlgo );
33 
34 } // namespace Gaudi::TestSuite
std::string
STL class.
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:526
Gaudi::TestSuite::FSMCallbackTestAlgo
Example of usage of callbacks, when using CallbackHolder.
Definition: FSMCallbackTestAlgo.cpp:19
Gaudi::StateMachine::FINALIZE
@ FINALIZE
Definition: StateMachine.h:38
ISvcLocator
Definition: ISvcLocator.h:46
Gaudi::TestSuite::FSMCallbackTestAlgo::FSMCallbackTestAlgo
FSMCallbackTestAlgo(const std::string &name, ISvcLocator *pSvcLocator)
Definition: FSMCallbackTestAlgo.cpp:20
Gaudi::StateMachine::INITIALIZE
@ INITIALIZE
Definition: StateMachine.h:35
FSMCallbackHolder.h
StatusCode
Definition: StatusCode.h:65
Gaudi::FSMCallbackHolder
Helper class to implement the IFSMCallbackHolder interface.
Definition: FSMCallbackHolder.h:37
std::cout
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:90
Algorithm.h
Gaudi::TestSuite
Definition: ConditionAccessorHolder.h:21
Gaudi::TestSuite::FSMCallbackTestAlgo::execute
StatusCode execute(const EventContext &) const override
Definition: FSMCallbackTestAlgo.cpp:27
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
Gaudi::StateMachine::START
@ START
Definition: StateMachine.h:36
EventContext
Definition: EventContext.h:34
Gaudi::FSMCallbackHolder< Algorithm >::registerCallBack
void registerCallBack(StateMachine::Transition s, IFSMCallbackHolder::CallBack c) override
Definition: FSMCallbackHolder.h:43
Gaudi::StateMachine::STOP
@ STOP
Definition: StateMachine.h:37