CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
reco::parser::AnyMethodArgumentFixup Class Reference

#include <AnyMethodArgument.h>

Public Member Functions

 AnyMethodArgumentFixup (const edm::TypeWithDict &type)
 
template<typename I >
std::enable_if< std::is_integral< I >::value, std::pair< AnyMethodArgument, int > >::type operator() (const I &t) const
 
template<typename F >
std::enable_if< std::is_floating_point< F >::value, std::pair< AnyMethodArgument, int > >::type operator() (const F &t) const
 
std::pair< AnyMethodArgument, int > operator() (const std::string &t) const
 

Private Member Functions

std::pair< AnyMethodArgument, int > doInt (int t) const
 
template<typename From , typename To >
std::pair< AnyMethodArgument, int > retOk_ (const From &f, int cast) const
 

Private Attributes

edm::TypeWithDict dataType_
 

Detailed Description

Definition at line 47 of file AnyMethodArgument.h.

Constructor & Destructor Documentation

◆ AnyMethodArgumentFixup()

reco::parser::AnyMethodArgumentFixup::AnyMethodArgumentFixup ( const edm::TypeWithDict type)
inline

Definition at line 94 of file AnyMethodArgument.h.

Member Function Documentation

◆ doInt()

std::pair<AnyMethodArgument, int> reco::parser::AnyMethodArgumentFixup::doInt ( int  t) const
inlineprivate

Definition at line 56 of file AnyMethodArgument.h.

References dataType_, and submitPVValidationJobs::t.

Referenced by operator()().

56  {
57  if (dataType_ == typeid(int8_t)) {
58  return retOk_<int, int8_t>(t, 0);
59  }
60  if (dataType_ == typeid(uint8_t)) {
61  return retOk_<int, uint8_t>(t, 0);
62  }
63  if (dataType_ == typeid(int16_t)) {
64  return retOk_<int, int16_t>(t, 0);
65  }
66  if (dataType_ == typeid(uint16_t)) {
67  return retOk_<int, uint16_t>(t, 0);
68  }
69  if (dataType_ == typeid(int32_t)) {
70  return retOk_<int, int32_t>(t, 0);
71  }
72  if (dataType_ == typeid(uint32_t)) {
73  return retOk_<int, uint32_t>(t, 0);
74  }
75  if (dataType_ == typeid(int64_t)) {
76  return retOk_<int, int64_t>(t, 0);
77  }
78  if (dataType_ == typeid(uint64_t)) {
79  return retOk_<int, uint64_t>(t, 0);
80  }
81  if (dataType_ == typeid(unsigned long)) {
82  return retOk_<int, unsigned long>(t, 0);
83  } // harmless if unsigned long matches another type
84  if (dataType_ == typeid(double)) {
85  return retOk_<int, double>(t, 1);
86  }
87  if (dataType_ == typeid(float)) {
88  return retOk_<int, float>(t, 1);
89  }
90  return std::pair<AnyMethodArgument, int>(t, -1);
91  }
unsigned long long uint64_t
Definition: Time.h:13

◆ operator()() [1/3]

template<typename I >
std::enable_if<std::is_integral<I>::value, std::pair<AnyMethodArgument, int> >::type reco::parser::AnyMethodArgumentFixup::operator() ( const I &  t) const
inline

Definition at line 98 of file AnyMethodArgument.h.

References doInt(), and submitPVValidationJobs::t.

99  {
100  return doInt(t);
101  }
std::pair< AnyMethodArgument, int > doInt(int t) const

◆ operator()() [2/3]

template<typename F >
std::enable_if<std::is_floating_point<F>::value, std::pair<AnyMethodArgument, int> >::type reco::parser::AnyMethodArgumentFixup::operator() ( const F t) const
inline

Definition at line 104 of file AnyMethodArgument.h.

References dataType_, and submitPVValidationJobs::t.

105  {
106  if (dataType_ == typeid(double)) {
107  return retOk_<F, double>(t, 0);
108  }
109  if (dataType_ == typeid(float)) {
110  return retOk_<F, float>(t, 0);
111  }
112  return std::pair<AnyMethodArgument, int>(t, -1);
113  }

◆ operator()() [3/3]

std::pair<AnyMethodArgument, int> reco::parser::AnyMethodArgumentFixup::operator() ( const std::string &  t) const
inline

Definition at line 115 of file AnyMethodArgument.h.

References edm::TypeWithDict::dataMemberSize(), dataType_, Exception, edm::TypeWithDict::isEnum(), edm::TypeWithDict::name(), AlCaHLTBitMon_QueryRunRegistry::string, edm::TypeWithDict::stringToEnumValue(), and submitPVValidationJobs::t.

115  {
116  if (dataType_.isEnum()) {
117  if (dataType_.dataMemberSize() == 0) {
118  throw parser::Exception(t.c_str())
119  << "Enumerator '" << dataType_.name() << "' has no keys.\nPerhaps the dictionary is missing?\n";
120  }
121  int ival = dataType_.stringToEnumValue(t);
122  // std::cerr << " value is = " << dataType_.stringToEnumValue(t) << std::endl;
123  return std::pair<AnyMethodArgument, int>(ival, 1);
124  }
125  if (dataType_ == typeid(std::string)) {
126  return std::pair<AnyMethodArgument, int>(t, 0);
127  }
128  return std::pair<AnyMethodArgument, int>(t, -1);
129  }
int stringToEnumValue(std::string const &) const
bool isEnum() const
std::string name() const
size_t dataMemberSize() const

◆ retOk_()

template<typename From , typename To >
std::pair<AnyMethodArgument, int> reco::parser::AnyMethodArgumentFixup::retOk_ ( const From &  f,
int  cast 
) const
inlineprivate

Definition at line 51 of file AnyMethodArgument.h.

References f.

51  {
52  return std::pair<AnyMethodArgument, int>(AnyMethodArgument(static_cast<To>(f)), cast);
53  }
double f[11][100]
std::conditional< matches_another_integral_type< unsigned long >::value, std::variant< int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, double, float, std::string >, std::variant< int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, unsigned long, double, float, std::string > >::type AnyMethodArgument

Member Data Documentation

◆ dataType_

edm::TypeWithDict reco::parser::AnyMethodArgumentFixup::dataType_
private

Definition at line 49 of file AnyMethodArgument.h.

Referenced by doInt(), and operator()().