The Gaudi Framework
v28r0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
GetAlg.h
Go to the documentation of this file.
1
#ifndef GAUDIALG_GETALG_H
2
#define GAUDIALG_GETALG_H 1
3
// ============================================================================
4
// Include files
5
// ============================================================================
6
#include <type_traits>
7
// ============================================================================
8
// GaudiKernel
9
// ============================================================================
10
#include "
GaudiKernel/IAlgorithm.h
"
11
// ============================================================================
12
// forward declarations
13
// ============================================================================
14
class
IAlgContextSvc
;
15
// ============================================================================
16
namespace
Gaudi
17
{
18
namespace
Utils
19
{
20
// ========================================================================
26
class
GAUDI_API
AlgSelector
27
{
28
public
:
30
virtual
bool
operator() (
const
IAlgorithm
* )
const
= 0 ;
31
// virtual destructor
32
virtual
~
AlgSelector
() =
default
;
33
};
34
// ========================================================================
41
template
<
class
TYPE>
42
class
GAUDI_API
AlgTypeSelector
:
public
AlgSelector
43
{
44
public
:
46
bool
operator() (
const
IAlgorithm
* a )
const override
47
{
using
TYPE_ =
typename
std::decay<TYPE>::type
;
48
using
CTYPE
=
typename
std::add_const<TYPE_>::type
;
49
using
cptr =
typename
std::add_pointer<CTYPE>::type
;
50
return
dynamic_cast<
cptr
>
( a ); }
51
} ;
52
// ========================================================================
59
class
GAUDI_API
AlgNameSelector
:
public
AlgSelector
60
{
61
public
:
62
AlgNameSelector
() = delete ;
64
AlgNameSelector
(
std::string
name
) : m_name (
std
::move(name) ) {}
66
bool
operator() (
const
IAlgorithm
* a )
const override
67
{
return
a && a->name() == m_name; }
68
private
:
69
// algorithm name
70
std::string
m_name
;
71
} ;
72
// ========================================================================
73
}
// end of namespace Gaudi::Utils
74
}
// end of namespace Gaudi
75
// ============================================================================
76
namespace
Gaudi
77
{
78
namespace
Utils
79
{
80
// ========================================================================
103
GAUDI_API
IAlgorithm
*
getAlgorithm
104
(
const
IAlgContextSvc
* svc ,
105
const
AlgSelector
&
sel
) ;
106
// ========================================================================
129
GAUDI_API
IAlgorithm
*
getAlgorithm
130
(
const
std::vector<IAlgorithm*>
& lst ,
131
const
AlgSelector
& sel ) ;
132
// ========================================================================
133
}
// end of namespace Gaudi::Utils
134
}
// end of namespace Gaudi
135
// ============================================================================
136
// The END
137
// ============================================================================
138
#endif // GAUDIALG_GETALG_H
gaudiComponentHelp.name
name
Definition:
gaudiComponentHelp.py:28
Gaudi::Utils::AlgNameSelector
The trivial selector of algorithm by type.
Definition:
GetAlg.h:59
IAlgorithm.h
std::add_pointer
IOTest.sel
sel
Definition:
IOTest.py:84
std
STL namespace.
std::type_info
std::string
STL class.
Gaudi::Utils::getAlgorithm
GAUDI_API IAlgorithm * getAlgorithm(const IAlgContextSvc *svc, const AlgSelector &sel)
simple function to get the algorithm from Context Service
Definition:
GetAlg.cpp:26
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition:
IAlgorithm.h:27
Gaudi::Utils::AlgTypeSelector
The trivial selector of algorithm by type.
Definition:
GetAlg.h:42
std::add_const
Gaudi::Utils::AlgNameSelector::AlgNameSelector
AlgNameSelector(std::string name)
constructor form the name
Definition:
GetAlg.h:64
std::vector< IAlgorithm * >
IAlgContextSvc
An abstract interface for Algorithm Context Service.
Definition:
IAlgContextSvc.h:23
Gaudi::Utils::AlgSelector
Simple interface class for selection of algorithms.
Definition:
GetAlg.h:26
GAUDI_API
#define GAUDI_API
Definition:
Kernel.h:107
std::decay
Gaudi
Helper functions to set/get the application return code.
Definition:
__init__.py:1
Gaudi::Utils::AlgNameSelector::m_name
std::string m_name
algorithm name
Definition:
GetAlg.h:70
GaudiAlg
GaudiAlg
GetAlg.h
Generated on Fri Nov 11 2016 18:44:44 for The Gaudi Framework by
1.8.11