Main Page
Namespaces
Classes
Package Documentation
HLTrigger
HLTcore
interface
defaultModuleLabel.h
Go to the documentation of this file.
1
#ifndef defaultModuleLabel_h
2
#define defaultModuleLabel_h
3
4
// C++ headers
5
#include <string>
6
7
// boost headers
8
#include <boost/version.hpp>
9
#if BOOST_VERSION < 105200
10
#include <boost/units/detail/utility.hpp>
11
#else
12
#include <boost/core/demangle.hpp>
13
#endif
14
15
template
<
typename
T>
16
std::string
defaultModuleLabel
() {
17
// start with the demangled name for T
18
#if BOOST_VERSION < 105200
19
std::string
name
= boost::units::detail::demangle(
typeid
(
T
).
name
());
20
#else
21
std::string
name = boost::core::demangle(
typeid
(
T
).
name
());
22
#endif
23
24
// expected size of the label
25
unsigned
int
size
= 0;
26
for
(
char
c
: name)
27
if
(std::isalnum(
c
)) ++
size
;
28
std::string
label
;
29
label.reserve(size);
30
31
// tokenize the demangled name, keeping only alphanumeric characters,
32
// and convert the tokens to lowerCamelCase.
33
bool
new_token =
false
;
34
for
(
char
c
: name) {
35
if
(std::isalnum(
c
)) {
36
if
(new_token)
37
label.push_back((
char
) std::toupper(
c
));
38
else
39
label.push_back(
c
);
40
new_token =
false
;
41
}
42
else
{
43
new_token =
true
;
44
}
45
}
46
47
// if the label is all uppercase, change it to all lowercase
48
// if the label starts with more than one uppercase letter, change n-1 to lowercase
49
// otherwise, change the first letter to lowercase
50
unsigned
int
ups = 0;
51
for
(
char
c
: label)
52
if
(std::isupper(
c
))
53
++ups;
54
else
55
break
;
56
if
(ups > 1 and ups != label.size())
57
--ups;
58
for
(
unsigned
int
i
= 0;
i
< ups; ++
i
)
59
label[
i
] = std::tolower(label[
i
]);
60
61
return
label
;
62
}
63
64
#endif // defaultModuleLabel_h
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:442
defaultModuleLabel
std::string defaultModuleLabel()
Definition:
defaultModuleLabel.h:16
diffTwoXMLs.label
label
Definition:
diffTwoXMLs.py:42
mps_fire.i
i
Definition:
mps_fire.py:156
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
EnergyCorrector.c
c
Definition:
EnergyCorrector.py:43
dataset.name
name
Definition:
dataset.py:45
T
long double T
Definition:
Basic3DVectorLD.h:57
Generated for CMSSW Reference Manual by
1.8.11