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::MatchByNumber
Definition:
StringMap.h:44
StringMap::clear
void clear()
Definition:
StringMap.cc:7
StringMap::const_iterator
vector_type::const_iterator const_iterator
Definition:
StringMap.h:12
contentValuesFiles.number
number
Definition:
contentValuesFiles.py:53
StringMap.h
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition:
cudastdAlgorithm.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
StringMap::sort
void sort()
Definition:
StringMap.cc:5
StringMap::MatchByString
Definition:
StringMap.h:35
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::end
const_iterator end() const
Definition:
StringMap.h:32
value
Definition:
value.py:1
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::find
const_iterator find(const std::string &string) const
Definition:
StringMap.cc:20
StringMap::add
void add(const std::string &string, int32_t value)
Definition:
StringMap.cc:3
StringMap::value_type
std::pair< std::string, int32_t > value_type
Definition:
StringMap.h:10
Generated for CMSSW Reference Manual by
1.8.16