The Gaudi Framework  master (37c0b60a)
MyAlgorithm.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2023 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 #pragma once
12 
13 #include "IMyTool.h"
15 
22 public:
24  MyAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
25 
27  StatusCode initialize() override;
28  StatusCode execute() override;
29  StatusCode finalize() override;
30 
31  bool isClonable() const override { return true; }
32 
33 private:
34  Gaudi::Property<std::string> m_privateToolType{ this, "ToolWithName", "MyTool",
35  "Type of the tool to use (internal name is ToolWithName)" };
36  Gaudi::Property<bool> m_privateToolsOnly{ this, "PrivateToolsOnly", false, "Do not look for public tools." };
37 
38  IMyTool* m_privateTool = nullptr;
39  IMyTool* m_publicTool = nullptr;
40 
42 
44 
45  ToolHandle<IMyTool> m_legacyToolHandle{ "MyTool/LegacyToolHandle", this };
46 
47  ToolHandle<IMyTool> m_myPrivToolHandle{ this, "PrivToolHandle", "MyTool/PrivToolHandle" };
48  PublicToolHandle<IMyTool> m_myPubToolHandle{ this, "PubToolHandle", "MyTool/PubToolHandle" };
49 
50  PublicToolHandle<IAlgTool> m_myGenericToolHandle{ this, "GenericToolHandle", "MyTool/GenericToolHandle" };
51 
52  ToolHandle<IAlgTool> m_myUnusedToolHandle{ this, "UnusedToolHandle", "TestToolFailing/UnusedToolHandle" };
53 
55  ToolHandle<IMyTool> m_invalidToolHandle{ this, "InvalidToolHandle", "TestToolFailing" };
56 
57  ToolHandle<IWrongTool> m_wrongIfaceTool{ this, "WrongIfaceTool", "MyTool/WrongIfaceTool" };
58 
59  PublicToolHandle<const IMyTool> m_myConstToolHandle{ "MyTool/ConstGenericToolHandle" };
60 
64 
66  "MyPublicToolHandleArrayProperty",
67  { "MyTool/AnotherConstGenericToolHandle", "MyTool/AnotherInstanceOfMyTool" } };
68 };
IMyOtherTool
Definition: IMyTool.h:39
MyAlgorithm::m_privateToolWithName
IMyTool * m_privateToolWithName
Definition: MyAlgorithm.h:41
std::string
STL class.
IMyTool.h
MyAlgorithm::m_myCopiedToolHandle
PublicToolHandle< IMyTool > m_myCopiedToolHandle
Definition: MyAlgorithm.h:63
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:526
MyAlgorithm::m_undefinedToolHandle
ToolHandle< IMyTool > m_undefinedToolHandle
Definition: MyAlgorithm.h:54
MyAlgorithm::m_invalidToolHandle
ToolHandle< IMyTool > m_invalidToolHandle
Definition: MyAlgorithm.h:55
MyAlgorithm::m_myCopiedConstToolHandle2
PublicToolHandle< const IMyTool > m_myCopiedConstToolHandle2
Definition: MyAlgorithm.h:62
ISvcLocator
Definition: ISvcLocator.h:46
Gaudi::TestSuite::TestAlg
Simple algorithm useful as base class for tests.
Definition: TestAlg.h:19
MyAlgorithm
Definition: MyAlgorithm.h:21
IMyTool
Definition: IMyTool.h:22
MyAlgorithm::MyAlgorithm
MyAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor of this form must be provided or inherited from the base class.
Definition: MyAlgorithm.cpp:21
TestAlg.h
MyAlgorithm::m_myConstToolHandle
PublicToolHandle< const IMyTool > m_myConstToolHandle
Definition: MyAlgorithm.h:59
MyAlgorithm::isClonable
bool isClonable() const override
Definition: MyAlgorithm.h:31
MyAlgorithm::m_publicTool
IMyTool * m_publicTool
Definition: MyAlgorithm.h:39
MyAlgorithm::m_privateToolsOnly
Gaudi::Property< bool > m_privateToolsOnly
Definition: MyAlgorithm.h:36
MyAlgorithm::m_myPrivToolHandle
ToolHandle< IMyTool > m_myPrivToolHandle
Definition: MyAlgorithm.h:47
ToolHandle< IMyTool >
StatusCode
Definition: StatusCode.h:65
MyAlgorithm::m_myCopiedConstToolHandle
PublicToolHandle< const IMyTool > m_myCopiedConstToolHandle
Definition: MyAlgorithm.h:61
MyAlgorithm::m_myUnusedToolHandle
ToolHandle< IAlgTool > m_myUnusedToolHandle
Definition: MyAlgorithm.h:52
PublicToolHandleArray< IMyTool >
PublicToolHandle< IMyTool >
MyAlgorithm::m_legacyToolHandle
ToolHandle< IMyTool > m_legacyToolHandle
Definition: MyAlgorithm.h:45
MyAlgorithm::m_myGenericToolHandle
PublicToolHandle< IAlgTool > m_myGenericToolHandle
Definition: MyAlgorithm.h:50
MyAlgorithm::m_privateOtherInterface
IMyOtherTool * m_privateOtherInterface
Definition: MyAlgorithm.h:43
MyAlgorithm::m_privateTool
IMyTool * m_privateTool
Definition: MyAlgorithm.h:38
MyAlgorithm::m_tha
PublicToolHandleArray< IMyTool > m_tha
Definition: MyAlgorithm.h:65
MyAlgorithm::initialize
StatusCode initialize() override
Three mandatory member functions of any algorithm.
Definition: MyAlgorithm.cpp:31
MyAlgorithm::finalize
StatusCode finalize() override
Definition: MyAlgorithm.cpp:134
MyAlgorithm::m_myPubToolHandle
PublicToolHandle< IMyTool > m_myPubToolHandle
Definition: MyAlgorithm.h:48
MyAlgorithm::m_privateToolType
Gaudi::Property< std::string > m_privateToolType
Definition: MyAlgorithm.h:34
MyAlgorithm::execute
StatusCode execute() override
Definition: MyAlgorithm.cpp:93
MyAlgorithm::m_wrongIfaceTool
ToolHandle< IWrongTool > m_wrongIfaceTool
Definition: MyAlgorithm.h:57
Gaudi::Property< std::string >