src
DataFormats
PatCandidates
src
StringMap.cc
Go to the documentation of this file.
1
#include "
DataFormats/PatCandidates/interface/StringMap.h
"
2
3
void
StringMap::add
(
const
std::string
&
string
, int32_t
value
) {
entries_
.push_back(
value_type
(
string
,
value
)); }
4
5
void
StringMap::sort
() {
std::sort
(
entries_
.begin(),
entries_
.end()); }
6
7
void
StringMap::clear
() {
entries_
.clear(); }
8
9
int32_t
StringMap::operator[]
(
const
std::string
&
string
)
const
{
10
vector_type::const_iterator
match
=
std::lower_bound
(
entries_
.begin(),
entries_
.end(),
string
,
MatchByString
());
11
return
(
match
==
end
() ? -1 :
match
->second);
12
}
13
14
const
std::string
&
StringMap::operator[]
(int32_t
number
)
const
{
15
static
const
std::string
empty_;
16
vector_type::const_iterator
match
=
find
(
number
);
17
return
(
match
==
end
() ? empty_ :
match
->first);
18
}
19
20
StringMap::const_iterator
StringMap::find
(
const
std::string
&
string
)
const
{
21
vector_type::const_iterator
match
=
std::lower_bound
(
entries_
.begin(),
entries_
.end(),
string
,
MatchByString
());
22
return
(
match
->first ==
string
?
match
:
end
());
23
}
24
25
StringMap::const_iterator
StringMap::find
(int32_t
number
)
const
{
26
return
std::find_if(
entries_
.begin(),
entries_
.end(),
MatchByNumber
(
number
));
27
}
StringMap::add
void add(const std::string &string, int32_t value)
Definition:
StringMap.cc:3
StringMap::operator[]
int32_t operator[](const std::string &string) const
Definition:
StringMap.cc:9
StringMap::entries_
std::vector< std::pair< std::string, int32_t > > entries_
Definition:
StringMap.h:54
StringMap::MatchByString
Definition:
StringMap.h:35
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
contentValuesFiles.number
number
Definition:
contentValuesFiles.py:53
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition:
pfDeepBoostedJetPreprocessParams_cfi.py:15
StringMap::find
const_iterator find(const std::string &string) const
Definition:
StringMap.cc:20
StringMap::clear
void clear()
Definition:
StringMap.cc:7
StringMap::const_iterator
vector_type::const_iterator const_iterator
Definition:
StringMap.h:12
jetsAK4_CHS_cff.sort
sort
Definition:
jetsAK4_CHS_cff.py:39
StringMap.h
value
Definition:
value.py:1
StringMap::value_type
std::pair< std::string, int32_t > value_type
Definition:
StringMap.h:10
StringMap::end
const_iterator end() const
Definition:
StringMap.h:32
StringMap::sort
void sort()
Definition:
StringMap.cc:5
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:10
StringMap::MatchByNumber
Definition:
StringMap.h:44
Generated for CMSSW Reference Manual by
1.8.14