FWCore
ParameterSet
src
Registry.cc
Go to the documentation of this file.
1
// ----------------------------------------------------------------------
2
// ----------------------------------------------------------------------
3
4
#include <ostream>
5
6
#include "
FWCore/ParameterSet/interface/Registry.h
"
7
#include "
FWCore/Utilities/interface/thread_safety_macros.h
"
8
9
namespace
edm
{
10
namespace
pset
{
11
12
Registry
*
Registry::instance
() {
13
CMS_THREAD_SAFE
static
Registry
s_reg;
14
return
&s_reg;
15
}
16
17
bool
Registry::getMapped
(
key_type
const
&
k
,
value_type
&
result
)
const
{
18
auto
it =
m_map
.find(
k
);
19
bool
found
= it !=
m_map
.end();
20
if
(
found
) {
21
result
= it->second;
22
}
23
return
found
;
24
}
25
26
Registry::value_type
const
*
Registry::getMapped
(
key_type
const
&
k
)
const
{
27
auto
it =
m_map
.find(
k
);
28
bool
found
= it !=
m_map
.end();
29
return
found
? &(it->second) : static_cast<value_type const*>(
nullptr
);
30
}
31
32
bool
Registry::insertMapped
(
value_type
const
&
v
,
bool
forceUpdate) {
33
auto
wasAdded =
m_map
.insert(std::make_pair(
v
.id(),
v
));
34
if
(forceUpdate and not wasAdded.second) {
35
wasAdded.first->second =
v
;
36
}
37
return
wasAdded.second;
38
}
39
40
void
Registry::clear
() {
m_map
.clear(); }
41
42
void
Registry::fillMap
(
regmap_type
& fillme)
const
{
43
fillme.clear();
44
// Note: The tracked part is in the registry.
45
for
(
auto
const
&
item
:
m_map
) {
46
fillme[
item
.first].pset() =
item
.second.toString();
47
}
48
}
49
50
void
Registry::print
(std::ostream& os)
const
{
51
os <<
"Registry with "
<<
size
() <<
" entries\n"
;
52
for
(
auto
const
&
item
: *
this
) {
53
os <<
item
.first <<
" "
<<
item
.second <<
'\n'
;
54
}
55
}
56
}
// namespace pset
57
}
// namespace edm
edm::pset::Registry::instance
static Registry * instance()
Definition:
Registry.cc:12
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::pset::Registry::regmap_type
std::map< ParameterSetID, ParameterSetBlob > regmap_type
Definition:
Registry.h:73
findQualityFiles.v
v
Definition:
findQualityFiles.py:179
newFWLiteAna.found
found
Definition:
newFWLiteAna.py:118
edm::pset::Registry::clear
void clear()
Not thread safe.
Definition:
Registry.cc:40
edm::Hash< ParameterSetType >
dqmdumpme.k
k
Definition:
dqmdumpme.py:60
CMS_THREAD_SAFE
#define CMS_THREAD_SAFE
Definition:
thread_safety_macros.h:4
edm::pset::Registry::fillMap
void fillMap(regmap_type &fillme) const
Definition:
Registry.cc:42
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::pset::Registry::print
void print(std::ostream &os) const
Definition:
Registry.cc:50
thread_safety_macros.h
B2GTnPMonitor_cfi.item
item
Definition:
B2GTnPMonitor_cfi.py:147
edm::pset::Registry::insertMapped
bool insertMapped(value_type const &v, bool forceUpdate=false)
Definition:
Registry.cc:32
Registry.h
edm::pset::Registry::size
size_t size() const
Definition:
Registry.h:69
mps_fire.result
result
Definition:
mps_fire.py:303
edm::pset::Registry::m_map
map_type m_map
Definition:
Registry.h:79
edm::pset::Registry::getMapped
bool getMapped(key_type const &k, value_type &result) const
Definition:
Registry.cc:17
edm::pset::Registry
Definition:
Registry.h:26
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
Generated for CMSSW Reference Manual by
1.8.16