Main Page
Namespaces
Classes
Package Documentation
CommonTools
Utils
src
returnType.cc
Go to the documentation of this file.
1
#include "
CommonTools/Utils/src/returnType.h
"
2
3
#include "
FWCore/Utilities/interface/FunctionWithDict.h
"
4
#include "
FWCore/Utilities/interface/TypeWithDict.h
"
5
6
#include <algorithm>
7
#include <cstring>
8
#include <string>
9
#include <vector>
10
11
using namespace
reco::method
;
12
using namespace
std
;
13
14
namespace
reco
{
15
16
edm::TypeWithDict
returnType
(
const
edm::FunctionWithDict
&
func
) {
17
return
func.
finalReturnType
();
18
}
19
20
TypeCode
returnTypeCode
(
const
edm::FunctionWithDict
&
func
) {
21
return
typeCode
(
returnType
(func));
22
}
23
24
//this is already alphabetized
25
static
const
std::vector<std::pair<char const* const, method::TypeCode> >
retTypeVec
{
26
{
"bool"
,
boolType
},
27
{
"char"
,
charType
},
28
{
"double"
,
doubleType
},
29
{
"float"
,
floatType
},
30
{
"int"
,
intType
},
31
{
"long"
,
longType
},
32
{
"long int"
,
longType
},
33
{
"short"
,
shortType
},
34
{
"short int"
,
shortType
},
35
{
"size_t"
,
uLongType
},
36
{
"unsigned char"
,
uCharType
},
37
{
"unsigned int"
,
uIntType
},
38
{
"unsigned long"
,
uLongType
},
39
{
"unsigned long int"
,
uLongType
},
40
{
"unsigned short"
,
uShortType
},
41
{
"unsigned short int"
,
uShortType
}
42
};
43
44
TypeCode
typeCode
(
const
edm::TypeWithDict
&
t
) {
45
typedef
std::pair<const char* const, method::TypeCode>
Values
;
46
std::string
name
= t.
name
();
47
auto
f
= std::equal_range(
retTypeVec
.begin(),
retTypeVec
.end(),
48
Values{name.c_str(),
enumType
},
49
[](
const
Values& iLHS,
const
Values& iRHS) ->
bool
{
50
return
std::strcmp(iLHS.first, iRHS.first) < 0;
51
});
52
if
(
f
.first ==
f
.second) {
53
return
t.
isEnum
() ?
enumType
:
invalid
;
54
}
55
return
f
.first->second;
56
}
57
58
}
// namespace reco
59
edm::TypeWithDict::isEnum
bool isEnum() const
Definition:
TypeWithDict.cc:412
reco::method::charType
Definition:
TypeCode.h:16
reco::method::uIntType
Definition:
TypeCode.h:15
reco::retTypeVec
static const std::vector< std::pair< char const *const, method::TypeCode > > retTypeVec
Definition:
returnType.cc:25
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
reco::returnTypeCode
TypeCode returnTypeCode(const edm::FunctionWithDict &func)
Definition:
returnType.cc:20
jets_cff.func
func
Definition:
jets_cff.py:495
std
Definition:
JetResolutionObject.h:80
reco::method
Definition:
TypeCode.h:12
reco::method::longType
Definition:
TypeCode.h:18
reco::method::boolType
Definition:
TypeCode.h:19
reco::method::uShortType
Definition:
TypeCode.h:17
TypeWithDict.h
edm::TypeWithDict::name
std::string name() const
Definition:
TypeWithDict.cc:456
returnType.h
protons_cff.t
t
Definition:
protons_cff.py:34
reco::returnType
edm::TypeWithDict returnType(const edm::FunctionWithDict &func)
Definition:
returnType.cc:16
reco::method::uLongType
Definition:
TypeCode.h:18
reco::typeCode
TypeCode typeCode(const edm::TypeWithDict &t)
Definition:
returnType.cc:44
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
reco::method::enumType
Definition:
TypeCode.h:19
edm::FunctionWithDict::finalReturnType
TypeWithDict finalReturnType() const
Definition:
FunctionWithDict.cc:40
FunctionWithDict.h
reco::method::intType
Definition:
TypeCode.h:15
reco::method::uCharType
Definition:
TypeCode.h:16
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:44
reco::method::TypeCode
TypeCode
Definition:
TypeCode.h:13
reco::method::floatType
Definition:
TypeCode.h:14
reco::method::invalid
Definition:
TypeCode.h:20
edm::TypeWithDict
Definition:
TypeWithDict.h:38
reco::method::shortType
Definition:
TypeCode.h:17
reco::JetExtendedAssociation::Values
std::vector< Value > Values
Definition:
JetExtendedAssociation.h:28
dataset.name
name
Definition:
dataset.py:45
edm::FunctionWithDict
Definition:
FunctionWithDict.h:27
reco::method::doubleType
Definition:
TypeCode.h:14
Generated for CMSSW Reference Manual by
1.8.11