ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaBaseComps
AthenaBaseComps
GaudiComponentVisitor.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/* Dear emacs, this is -*-c++-*- */
6
#ifndef _ComponentVisitor_H_
7
#define _ComponentVisitor_H_
8
9
#include <vector>
10
#include <set>
11
#include <type_traits>
12
#include <regex>
13
14
#include "GaudiKernel/IAlgTool.h"
15
#include "GaudiKernel/Algorithm.h"
16
17
namespace
xGaudi
{
18
class
ComponentVisitorBase {
19
protected
:
20
static
const
std::regex s_noFilter;
21
};
22
36
template
<
class
T_Component,
class
T_TestVisited = std::set<T_Component*> >
37
class
ComponentVisitor :
public
ComponentVisitorBase {
38
struct
IVisitor {
39
virtual
~IVisitor() =
default
;
40
virtual
void
visit( T_Component* )
const
= 0;
41
};
42
43
public
:
44
static
std::vector<T_Component *> *getChilds(T_Component *a_component);
45
58
template
<
typename
Callable,
typename
= std::enable_if_t<std::is_invocable_r_v<
void
, Callable, T_Component*>>>
59
static
T_TestVisited visit(
const
std::vector<T_Component*>& components,
60
Callable& callable,
61
const
std::regex& reject_filter = ComponentVisitorBase::s_noFilter,
62
T_TestVisited &&ignore = T_TestVisited()) {
63
class
Visitor
final
:
public
IVisitor {
64
const
Callable* m_func;
65
66
public
:
67
Visitor( Callable* f ) : m_func{
f
} {}
68
void
visit( T_Component* a_component )
const override
{ std::invoke( *m_func, a_component ); }
69
};
70
recursiveVisit( components, Visitor{&callable}, reject_filter,
ignore
);
71
return
std::move (ignore);
72
}
73
74
private
:
75
static
void
recursiveVisit(
const
std::vector<T_Component*>& components, IVisitor
const
& visitor,
76
const
std::regex& reject_filter,
77
T_TestVisited &visited);
78
};
79
80
class
NoVisitTester {
81
public
:
82
std::pair<bool,bool>
insert
(
const
Gaudi::Algorithm *) {
return
std::make_pair(
true
,
true
); }
83
};
84
85
using
ToolVisitor = ComponentVisitor<IAlgTool>;
86
using
AlgorithmVisitor = ComponentVisitor<Gaudi::Algorithm, NoVisitTester>;
87
}
88
#endif
CxxUtils::insert
ConcurrentBitset & insert(bit_t bit, bit_t new_nbits=0)
Set a bit to 1.
DiTauMassTools::ignore
void ignore(T &&)
Definition
PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
EL::Detail::ManagerStep::final
@ final
Definition
ManagerStep.h:136
hist_file_dump.f
f
Definition
hist_file_dump.py:140
xGaudi
Definition
GaudiComponentVisitor.cxx:7
Generated on
for ATLAS Offline Software by
1.17.0