The Gaudi Framework
master (6507eef1)
Toggle main menu visibility
Loading...
Searching...
No Matches
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
"
14
#include <
Gaudi/TestSuite/TestAlg.h
>
15
21
class
MyAlgorithm
:
public
Gaudi::TestSuite::TestAlg
{
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
41
IMyTool
*
m_privateToolWithName
=
nullptr
;
42
43
IMyOtherTool
*
m_privateOtherInterface
=
nullptr
;
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
54
ToolHandle<IMyTool>
m_undefinedToolHandle
{
this
};
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
61
PublicToolHandle<const IMyTool>
m_myCopiedConstToolHandle
;
62
PublicToolHandle<const IMyTool>
m_myCopiedConstToolHandle2
;
63
PublicToolHandle<IMyTool>
m_myCopiedToolHandle
;
64
65
PublicToolHandleArray<IMyTool>
m_tha
{
this
,
66
"MyPublicToolHandleArrayProperty"
,
67
{
"MyTool/AnotherConstGenericToolHandle"
,
"MyTool/AnotherInstanceOfMyTool"
} };
68
};
IMyTool.h
TestAlg.h
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition
Algorithm.cpp:518
Gaudi::Property
Implementation of property with value of concrete type.
Definition
Property.h:35
IMyOtherTool
Second interface, to test multiple interface tools.
Definition
IMyTool.h:38
IMyTool
Example of an Interface of a Algorithm Tool.
Definition
IMyTool.h:21
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition
ISvcLocator.h:42
MyAlgorithm::m_invalidToolHandle
ToolHandle< IMyTool > m_invalidToolHandle
Definition
MyAlgorithm.h:55
MyAlgorithm::m_myCopiedToolHandle
PublicToolHandle< IMyTool > m_myCopiedToolHandle
Definition
MyAlgorithm.h:63
MyAlgorithm::m_myCopiedConstToolHandle2
PublicToolHandle< const IMyTool > m_myCopiedConstToolHandle2
Definition
MyAlgorithm.h:62
MyAlgorithm::finalize
StatusCode finalize() override
Definition
MyAlgorithm.cpp:134
MyAlgorithm::initialize
StatusCode initialize() override
Three mandatory member functions of any algorithm.
Definition
MyAlgorithm.cpp:31
MyAlgorithm::m_privateToolWithName
IMyTool * m_privateToolWithName
Definition
MyAlgorithm.h:41
MyAlgorithm::m_myGenericToolHandle
PublicToolHandle< IAlgTool > m_myGenericToolHandle
Definition
MyAlgorithm.h:50
MyAlgorithm::m_publicTool
IMyTool * m_publicTool
Definition
MyAlgorithm.h:39
MyAlgorithm::m_privateToolType
Gaudi::Property< std::string > m_privateToolType
Definition
MyAlgorithm.h:34
MyAlgorithm::m_myConstToolHandle
PublicToolHandle< const IMyTool > m_myConstToolHandle
Definition
MyAlgorithm.h:59
MyAlgorithm::isClonable
bool isClonable() const override
Definition
MyAlgorithm.h:31
MyAlgorithm::m_myCopiedConstToolHandle
PublicToolHandle< const IMyTool > m_myCopiedConstToolHandle
Definition
MyAlgorithm.h:61
MyAlgorithm::m_myPrivToolHandle
ToolHandle< IMyTool > m_myPrivToolHandle
Definition
MyAlgorithm.h:47
MyAlgorithm::execute
StatusCode execute() override
Definition
MyAlgorithm.cpp:93
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
MyAlgorithm::m_privateOtherInterface
IMyOtherTool * m_privateOtherInterface
Definition
MyAlgorithm.h:43
MyAlgorithm::m_legacyToolHandle
ToolHandle< IMyTool > m_legacyToolHandle
Definition
MyAlgorithm.h:45
MyAlgorithm::m_tha
PublicToolHandleArray< IMyTool > m_tha
Definition
MyAlgorithm.h:65
MyAlgorithm::m_privateTool
IMyTool * m_privateTool
Definition
MyAlgorithm.h:38
MyAlgorithm::m_privateToolsOnly
Gaudi::Property< bool > m_privateToolsOnly
Definition
MyAlgorithm.h:36
MyAlgorithm::m_myUnusedToolHandle
ToolHandle< IAlgTool > m_myUnusedToolHandle
Definition
MyAlgorithm.h:52
MyAlgorithm::m_undefinedToolHandle
ToolHandle< IMyTool > m_undefinedToolHandle
Definition
MyAlgorithm.h:54
MyAlgorithm::m_wrongIfaceTool
ToolHandle< IWrongTool > m_wrongIfaceTool
Definition
MyAlgorithm.h:57
MyAlgorithm::m_myPubToolHandle
PublicToolHandle< IMyTool > m_myPubToolHandle
Definition
MyAlgorithm.h:48
PublicToolHandleArray
Helper class to construct ToolHandle instances for public tools via the auto registering constructor.
Definition
ToolHandle.h:456
PublicToolHandle
Helper class to construct ToolHandle instances for public tools via the auto registering constructor.
Definition
ToolHandle.h:354
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
ToolHandle
Handle to be used in lieu of naked pointers to tools.
Definition
ToolHandle.h:132
Gaudi::TestSuite::TestAlg
Simple algorithm useful as base class for tests.
Definition
TestAlg.h:19
GaudiTestSuite
src
AlgTools
MyAlgorithm.h
Generated on
for The Gaudi Framework by
1.17.0