ATLAS Offline Software
HelloAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ATHEXHELLOWORLD_HELLOALG_H
6 #define ATHEXHELLOWORLD_HELLOALG_H
7 
9 #include "Gaudi/Property.h"
10 #include "GaudiKernel/ToolHandle.h"
11 
12 #include <map>
13 #include <string>
14 #include <utility>
15 #include <vector>
16 
17 class IHelloTool;
18 
19 class HelloAlg : public AthAlgorithm {
20  public:
21  HelloAlg(const std::string &name, ISvcLocator *pSvcLocator);
22 
23  virtual StatusCode initialize() override;
24  virtual StatusCode execute() override;
25  virtual StatusCode finalize() override;
26 
27  private:
28  // Properties
29  Gaudi::Property<int> m_myInt{this, "MyInt", 0, "An Integer"};
30  Gaudi::Property<bool> m_myBool{this, "MyBool", false, "A Bool"};
31  Gaudi::Property<double> m_myDouble{this, "MyDouble", 0., "A Double"};
32 
33  Gaudi::Property<std::vector<std::string>> m_myStringVec{
34  this, "MyStringVec", {}, "an entire vector of strings"};
35 
36  typedef std::map<std::string, std::string> Dict_t;
37  Gaudi::Property<Dict_t> m_myDict{this, "MyDict", {}, "A little dictionary"};
38 
39  typedef std::vector<std::vector<double>> Matrix_t;
40  Gaudi::Property<Matrix_t> m_myMatrix{
41  this, "MyMatrix", {}, "A matrix of doubles"};
42 
43  // legacy style Property
44  typedef std::vector<std::pair<double, double>> Table_t;
46 
47  // ToolHandles as Properties
48  ToolHandle<IHelloTool> m_myPrivateHelloTool{
49  this, "MyPrivateHelloTool", "HelloTool", "private IHelloTool"};
50 
51  PublicToolHandle<IHelloTool> m_myPublicHelloTool{
52  this, "MyPublicHelloTool", "HelloTool", "public, shared IHelloTool"};
53 };
54 
55 #endif
HelloAlg::m_myInt
Gaudi::Property< int > m_myInt
Definition: HelloAlg.h:29
HelloAlg::Matrix_t
std::vector< std::vector< double > > Matrix_t
Definition: HelloAlg.h:39
HelloAlg::Dict_t
std::map< std::string, std::string > Dict_t
Definition: HelloAlg.h:36
HelloAlg::m_myStringVec
Gaudi::Property< std::vector< std::string > > m_myStringVec
Definition: HelloAlg.h:33
HelloAlg::m_myPrivateHelloTool
ToolHandle< IHelloTool > m_myPrivateHelloTool
Definition: HelloAlg.h:48
AthAlgorithm.h
HelloAlg::HelloAlg
HelloAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HelloAlg.cxx:9
HelloAlg::Table_t
std::vector< std::pair< double, double > > Table_t
Definition: HelloAlg.h:44
HelloAlg::initialize
virtual StatusCode initialize() override
Definition: HelloAlg.cxx:25
HelloAlg::finalize
virtual StatusCode finalize() override
Definition: HelloAlg.cxx:96
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
HelloAlg::m_myDict
Gaudi::Property< Dict_t > m_myDict
Definition: HelloAlg.h:37
HelloAlg::m_myDouble
Gaudi::Property< double > m_myDouble
Definition: HelloAlg.h:31
AthAlgorithm
Definition: AthAlgorithm.h:47
IHelloTool
Definition: IHelloTool.h:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
HelloAlg::m_myTable
Table_t m_myTable
Definition: HelloAlg.h:45
HelloAlg
Definition: HelloAlg.h:19
HelloAlg::m_myBool
Gaudi::Property< bool > m_myBool
Definition: HelloAlg.h:30
HelloAlg::m_myPublicHelloTool
PublicToolHandle< IHelloTool > m_myPublicHelloTool
Definition: HelloAlg.h:51
HelloAlg::m_myMatrix
Gaudi::Property< Matrix_t > m_myMatrix
Definition: HelloAlg.h:40
HelloAlg::execute
virtual StatusCode execute() override
Definition: HelloAlg.cxx:72