The Gaudi Framework  master (37c0b60a)
TemplatedAlg.cpp
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 
12 #include <Gaudi/Algorithm.h>
13 #include <string>
14 #include <vector>
15 
21 template <typename T, typename R>
23 public:
25 
26  StatusCode initialize() override {
27  return Algorithm::initialize().andThen( [&]() {
29  info() << "Initializing TemplatedAlg instance " << name() << " of type " << demangle( typeid( *this ) ) << endmsg;
30  } );
31  }
32  StatusCode execute( const EventContext& ) const override { return StatusCode::SUCCESS; }
33 
34 private:
35  Gaudi::Property<T> m_t{ this, "TProperty", {} };
36  Gaudi::Property<R> m_r{ this, "RProperty", {} };
37 };
38 
39 // Static Factory declaration
42 
44 DECLARE_COMPONENT_WITH_ID( t1, "TAlgIS" )
46 DECLARE_COMPONENT_WITH_ID( t2, "TAlgDB" )
StatusCode::andThen
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
Definition: StatusCode.h:163
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:526
Gaudi::Algorithm::initialize
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition: Algorithm.h:178
TemplatedAlg
Definition: TemplatedAlg.py:1
DECLARE_COMPONENT_WITH_ID
#define DECLARE_COMPONENT_WITH_ID(type, id)
Definition: PluginServiceV1.h:47
StatusCode
Definition: StatusCode.h:65
TemplatedAlg
Definition: TemplatedAlg.cpp:22
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:90
Algorithm.h
TemplatedAlg::m_t
Gaudi::Property< T > m_t
Definition: TemplatedAlg.cpp:35
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
EventContext
Definition: EventContext.h:34
TemplatedAlg::m_r
Gaudi::Property< R > m_r
Definition: TemplatedAlg.cpp:36
t2
TemplatedAlg< double, bool > t2
Definition: TemplatedAlg.cpp:41
Gaudi::PluginService::v1::Details::demangle
GAUDIPS_API std::string demangle(const std::type_info &id)
Return a canonical name for type_info object (implementation borrowed from GaudiKernel/System).
Definition: PluginServiceV1.cpp:131
Gaudi::Algorithm::Algorithm
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.h:101
t1
TemplatedAlg< int, std::vector< std::string > > t1
Definition: TemplatedAlg.cpp:40
TemplatedAlg::execute
StatusCode execute(const EventContext &) const override
Definition: TemplatedAlg.cpp:32
Gaudi::Property< T >
TemplatedAlg::initialize
StatusCode initialize() override
Definition: TemplatedAlg.cpp:26