The Gaudi Framework
v36r16 (ea80daf8)
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
i
l
m
n
o
p
r
s
t
Enumerator
a
b
c
d
e
f
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Properties
Related Functions
:
a
b
c
d
e
g
h
i
m
o
p
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
_
b
c
e
f
g
h
i
l
m
n
o
p
r
s
t
u
z
Variables
a
b
c
d
e
g
h
i
m
o
p
r
s
t
v
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Enumerations
Enumerator
c
e
f
p
u
v
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
StringKeyEx.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2019 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 files
13
// ===========================================================================
14
// STD & STL
15
// ===========================================================================
16
#include <map>
17
// ===========================================================================
18
// GaudiKernel
19
// ===========================================================================
20
#include "
GaudiKernel/HashMap.h
"
21
#include "
GaudiKernel/Map.h
"
22
#include "
GaudiKernel/StatusCode.h
"
23
#include "
GaudiKernel/StringKey.h
"
24
// ===========================================================================
25
// GaudiAlg
26
// ===========================================================================
27
#include "
GaudiAlg/GaudiAlgorithm.h
"
28
// ===========================================================================
29
namespace
Gaudi
{
30
// =========================================================================
31
namespace
Examples {
32
// =======================================================================
39
class
StringKeyEx
:
public
GaudiAlgorithm
{
40
public
:
41
// ======================================================================
43
StatusCode
execute
()
override
;
44
// ======================================================================
45
public
:
46
// ======================================================================
48
using
GaudiAlgorithm::GaudiAlgorithm
;
49
// ======================================================================
50
private
:
51
// ======================================================================
52
typedef
Gaudi::StringKey
Key
;
53
typedef
std::vector<Key>
Keys
;
54
// ======================================================================
55
Gaudi::Property<Key>
m_key
{
this
,
"Key"
, {},
"The string key"
};
56
Gaudi::Property<Keys>
m_keys
{
this
,
"Keys"
, {},
"The vector of keys"
};
57
// ======================================================================
58
};
59
// ========================================================================
60
}
// namespace Examples
61
// ==========================================================================
62
}
// end of namespace Gaudi
63
// ============================================================================
64
// Execution method
65
// ============================================================================
66
StatusCode
Gaudi::Examples::StringKeyEx::execute
() {
67
// 1. check the settings of key from the properties
68
always() <<
"The Key : "
<<
Gaudi::Utils::toString
(
m_key
.value() ) <<
endmsg
;
69
always() <<
"The Keys : "
<<
Gaudi::Utils::toString
(
m_keys
.value() ) <<
endmsg
;
70
//
71
72
// prepare some maps
73
typedef
std::map<std::string, int>
MAP1;
74
typedef
GaudiUtils::Map<std::string, int>
MAP2;
75
typedef
GaudiUtils::HashMap<std::string, int>
MAP3;
76
typedef
GaudiUtils::VectorMap<std::string, int>
MAP4;
77
78
typedef
std::map<Key, int>
MAP01;
79
typedef
GaudiUtils::Map<Key, int>
MAP02;
80
typedef
GaudiUtils::HashMap<Key, int>
MAP03;
81
typedef
GaudiUtils::VectorMap<Key, int>
MAP04;
82
83
MAP1 map1;
84
MAP2 map2;
85
MAP3 map3;
86
MAP4 map4;
87
88
MAP01 map01;
89
MAP02 map02;
90
MAP03 map03;
91
MAP04 map04;
92
93
for
( Keys::const_iterator it =
m_keys
.begin();
m_keys
.end() != it; ++it ) {
94
int
index
= it -
m_keys
.begin();
95
96
map1.insert(
std::make_pair
( *it,
index
) );
97
map2.insert(
std::make_pair
( *it,
index
) );
98
map3.insert(
std::make_pair
( *it,
index
) );
99
map4.insert(
std::make_pair
( *it,
index
) );
100
101
map01.insert(
std::make_pair
( *it,
index
) );
102
map02.insert(
std::make_pair
( *it,
index
) );
103
map03.insert(
std::make_pair
( *it,
index
) );
104
map04.insert(
std::make_pair
( *it,
index
) );
105
}
106
107
always() <<
"Map 1:"
<<
Gaudi::Utils::toString
( map1 ) <<
endmsg
;
108
always() <<
"Map 2:"
<<
Gaudi::Utils::toString
( map2 ) <<
endmsg
;
109
always() <<
"Map 3:"
<<
Gaudi::Utils::toString
( map3 ) <<
endmsg
;
110
always() <<
"Map 4:"
<<
Gaudi::Utils::toString
( map4 ) <<
endmsg
;
111
112
always() <<
"Map01:"
<<
Gaudi::Utils::toString
( map01 ) <<
endmsg
;
113
always() <<
"Map02:"
<<
Gaudi::Utils::toString
( map02 ) <<
endmsg
;
114
always() <<
"Map03:"
<<
Gaudi::Utils::toString
( map03 ) <<
endmsg
;
115
always() <<
"Map04:"
<<
Gaudi::Utils::toString
( map04 ) <<
endmsg
;
116
117
always() <<
"check for StringKey "
<<
Gaudi::Utils::toString
(
m_key
.value() ) <<
endmsg
;
118
119
always() <<
" In Map 1: "
<<
Gaudi::Utils::toString
( map1.end() != map1.find(
m_key
.value() ) ) <<
endmsg
;
120
always() <<
" In Map 2: "
<<
Gaudi::Utils::toString
( map2.end() != map2.find(
m_key
.value() ) ) <<
endmsg
;
121
always() <<
" In Map 3: "
<<
Gaudi::Utils::toString
( map3.end() != map3.find(
m_key
.value() ) ) <<
endmsg
;
122
always() <<
" In Map 4: "
<<
Gaudi::Utils::toString
( map4.end() != map4.find(
m_key
.value() ) ) <<
endmsg
;
123
124
always() <<
" In Map01: "
<<
Gaudi::Utils::toString
( map01.end() != map01.find(
m_key
) ) <<
endmsg
;
125
always() <<
" In Map02: "
<<
Gaudi::Utils::toString
( map02.end() != map02.find(
m_key
) ) <<
endmsg
;
126
always() <<
" In Map03: "
<<
Gaudi::Utils::toString
( map03.end() != map03.find(
m_key
) ) <<
endmsg
;
127
always() <<
" In Map04: "
<<
Gaudi::Utils::toString
( map04.end() != map04.find(
m_key
) ) <<
endmsg
;
128
129
std::string
akey =
"rrr"
;
130
131
always() <<
"check for std::string key "
<<
Gaudi::Utils::toString
( akey ) <<
endmsg
;
132
133
always() <<
" In Map 1: "
<<
Gaudi::Utils::toString
( map1.end() != map1.find( akey ) ) <<
endmsg
;
134
always() <<
" In Map 2: "
<<
Gaudi::Utils::toString
( map2.end() != map2.find( akey ) ) <<
endmsg
;
135
always() <<
" In Map 3: "
<<
Gaudi::Utils::toString
( map3.end() != map3.find( akey ) ) <<
endmsg
;
136
always() <<
" In Map 4: "
<<
Gaudi::Utils::toString
( map4.end() != map4.find( akey ) ) <<
endmsg
;
137
138
always() <<
" In Map01: "
<<
Gaudi::Utils::toString
( map01.end() != map01.find( akey ) ) <<
endmsg
;
139
always() <<
" In Map02: "
<<
Gaudi::Utils::toString
( map02.end() != map02.find( akey ) ) <<
endmsg
;
140
always() <<
" In Map03: "
<<
Gaudi::Utils::toString
( map03.end() != map03.find( akey ) ) <<
endmsg
;
141
always() <<
" In Map04: "
<<
Gaudi::Utils::toString
( map04.end() != map04.find( akey ) ) <<
endmsg
;
142
143
return
StatusCode::SUCCESS
;
144
}
145
// ============================================================================
147
using
Gaudi::Examples::StringKeyEx
;
148
DECLARE_COMPONENT
(
StringKeyEx
)
149
// ============================================================================
150
// The END
151
// ========-===================================================================
std::string
STL class.
Gaudi::Algorithm::index
unsigned int index() const override
Definition:
Algorithm.cpp:534
GaudiAlgorithm::GaudiAlgorithm
GaudiAlgorithm(std::string name, ISvcLocator *pSvcLocator)
Standard constructor.
Definition:
GaudiAlgorithm.cpp:45
Gaudi::Examples::StringKeyEx
Definition:
StringKeyEx.cpp:39
Gaudi::Examples::StringKeyEx::execute
StatusCode execute() override
execution of the algorithm
Definition:
StringKeyEx.cpp:66
std::vector
STL class.
GaudiUtils::VectorMap
Definition:
VectorMap.h:112
StringKey.h
StatusCode.h
Gaudi::Examples::StringKeyEx::Key
Gaudi::StringKey Key
Definition:
StringKeyEx.cpp:52
HashMap.h
Gaudi::StringKey
Definition:
StringKey.h:44
StatusCode
Definition:
StatusCode.h:65
GaudiAlgorithm
Definition:
GaudiAlgorithm.h:104
GaudiUtils::Map
Definition:
Map.h:91
Gaudi::Examples::StringKeyEx::Keys
std::vector< Key > Keys
Definition:
StringKeyEx.cpp:53
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition:
MsgStream.h:203
std::map< std::string, int >
Gaudi
Header file for std:chrono::duration-based Counters.
Definition:
__init__.py:1
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition:
ToStream.h:353
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition:
StatusCode.h:100
GaudiAlgorithm.h
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition:
PluginServiceV1.h:46
std::make_pair
T make_pair(T... args)
Map.h
GaudiUtils::HashMap< std::string, int >
Gaudi::Examples::StringKeyEx::m_key
Gaudi::Property< Key > m_key
Definition:
StringKeyEx.cpp:55
Gaudi::Examples::StringKeyEx::m_keys
Gaudi::Property< Keys > m_keys
Definition:
StringKeyEx.cpp:56
StringKeyEx
Definition:
StringKeyEx.py:1
Gaudi::Property
Implementation of property with value of concrete type.
Definition:
Property.h:39
GaudiExamples
src
StringKeys
StringKeyEx.cpp
Generated on Fri Jul 28 2023 16:22:54 for The Gaudi Framework by
1.8.18