The Gaudi Framework
master (82fdf313)
Loading...
Searching...
No Matches
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>
22
class
TemplatedAlg
:
public
Gaudi::Algorithm
{
23
public
:
24
using
Algorithm::Algorithm
;
25
26
StatusCode
initialize
()
override
{
27
return
Algorithm::initialize
().
andThen
( [&]() {
28
using
Gaudi::PluginService::Details::demangle;
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
40
typedef
TemplatedAlg<int, std::vector<std::string>
>
t1
;
41
typedef
TemplatedAlg<double, bool>
t2
;
42
43
DECLARE_COMPONENT
(
t1
)
44
DECLARE_COMPONENT_WITH_ID
(
t1
,
"TAlgIS"
)
45
DECLARE_COMPONENT
(
t2
)
46
DECLARE_COMPONENT_WITH_ID
(
t2
,
"TAlgDB"
)
Algorithm.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
DECLARE_COMPONENT_WITH_ID
#define DECLARE_COMPONENT_WITH_ID(type, id)
Definition
PluginServiceV1.h:46
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition
PluginServiceV1.h:45
t1
TemplatedAlg< int, std::vector< std::string > > t1
Definition
TemplatedAlg.cpp:40
t2
TemplatedAlg< double, bool > t2
Definition
TemplatedAlg.cpp:41
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition
CommonMessaging.h:113
EventContext
This class represents an entry point to all the event specific data.
Definition
EventContext.h:34
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition
Algorithm.h:87
Gaudi::Algorithm::Algorithm
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition
Algorithm.h:98
Gaudi::Algorithm::initialize
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition
Algorithm.h:175
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition
Algorithm.cpp:529
Gaudi::Property
Implementation of property with value of concrete type.
Definition
PropertyFwd.h:27
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::andThen
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
Definition
StatusCode.h:163
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
TemplatedAlg< int, std::vector< std::string > >::m_t
Gaudi::Property< int > m_t
Definition
TemplatedAlg.cpp:35
TemplatedAlg< int, std::vector< std::string > >::m_r
Gaudi::Property< std::vector< std::string > > m_r
Definition
TemplatedAlg.cpp:36
TemplatedAlg::execute
StatusCode execute(const EventContext &) const override
Definition
TemplatedAlg.cpp:32
TemplatedAlg::initialize
StatusCode initialize() override
Definition
TemplatedAlg.cpp:26
TemplatedAlg
Definition
TemplatedAlg.py:1
GaudiTestSuite
src
AlgSequencer
TemplatedAlg.cpp
Generated on Thu Oct 2 2025 15:31:12 for The Gaudi Framework by
1.13.1