CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
returnType.cc
Go to the documentation of this file.
2 
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 
17  return func.finalReturnType();
18  }
19 
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 
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 
bool isEnum() const
static const std::vector< std::pair< char const *const, method::TypeCode > > retTypeVec
Definition: returnType.cc:25
TypeCode returnTypeCode(const edm::FunctionWithDict &func)
Definition: returnType.cc:20
std::string name() const
edm::TypeWithDict returnType(const edm::FunctionWithDict &func)
Definition: returnType.cc:16
TypeCode typeCode(const edm::TypeWithDict &t)
Definition: returnType.cc:44
double f[11][100]
TypeWithDict finalReturnType() const