CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
reco::parser::AnyMethodArgumentFixup Class Reference

#include <AnyMethodArgument.h>

Inheritance diagram for reco::parser::AnyMethodArgumentFixup:

Public Member Functions

 AnyMethodArgumentFixup (const edm::TypeWithDict &type)
 
template<typename I >
boost::enable_if
< boost::is_integral< I >
, std::pair< AnyMethodArgument,
int > >::type 
operator() (const I &t) const
 
template<typename F >
boost::enable_if
< boost::is_floating_point< F >
, 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 52 of file AnyMethodArgument.h.

Constructor & Destructor Documentation

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

Definition at line 76 of file AnyMethodArgument.h.

76  :
77  dataType_(type)
78  {
79  }

Member Function Documentation

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

Definition at line 61 of file AnyMethodArgument.h.

References dataType_, and edmStreamStallGrapher::t.

Referenced by operator()().

61  {
62  if (dataType_ == typeid(int8_t)) { return retOk_<int,int8_t> (t,0); }
63  if (dataType_ == typeid(uint8_t)) { return retOk_<int,uint8_t> (t,0); }
64  if (dataType_ == typeid(int16_t)) { return retOk_<int,int16_t> (t,0); }
65  if (dataType_ == typeid(uint16_t)) { return retOk_<int,uint16_t>(t,0); }
66  if (dataType_ == typeid(int32_t)) { return retOk_<int,int32_t> (t,0); }
67  if (dataType_ == typeid(uint32_t)) { return retOk_<int,uint32_t>(t,0); }
68  if (dataType_ == typeid(int64_t)) { return retOk_<int,int64_t> (t,0); }
69  if (dataType_ == typeid(uint64_t)) { return retOk_<int,uint64_t>(t,0); }
70  if (dataType_ == typeid(unsigned long)) { return retOk_<int,unsigned long> (t,0); } // harmless if unsigned long matches another type
71  if (dataType_ == typeid(double)) { return retOk_<int,double> (t,1); }
72  if (dataType_ == typeid(float)) { return retOk_<int,float> (t,1); }
73  return std::pair<AnyMethodArgument,int>(t,-1);
74  }
unsigned long long uint64_t
Definition: Time.h:15
template<typename I >
boost::enable_if<boost::is_integral<I>, std::pair<AnyMethodArgument,int> >::type reco::parser::AnyMethodArgumentFixup::operator() ( const I &  t) const
inline

Definition at line 84 of file AnyMethodArgument.h.

References doInt().

84 { return doInt(t); }
std::pair< AnyMethodArgument, int > doInt(int t) const
template<typename F >
boost::enable_if<boost::is_floating_point<F>, std::pair<AnyMethodArgument,int> >::type reco::parser::AnyMethodArgumentFixup::operator() ( const F t) const
inline

Definition at line 88 of file AnyMethodArgument.h.

References dataType_, and edmStreamStallGrapher::t.

88  {
89  if (dataType_ == typeid(double)) { return retOk_<F,double>(t,0); }
90  if (dataType_ == typeid(float)) { return retOk_<F,float> (t,0); }
91  return std::pair<AnyMethodArgument,int>(t,-1);
92  }
std::pair<AnyMethodArgument,int> reco::parser::AnyMethodArgumentFixup::operator() ( const std::string &  t) const
inline

Definition at line 94 of file AnyMethodArgument.h.

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

94  {
95  if (dataType_.isEnum()) {
96  if (dataType_.dataMemberSize() == 0) {
97  throw parser::Exception(t.c_str()) << "Enumerator '" << dataType_.name() << "' has no keys.\nPerhaps the dictionary is missing?\n";
98  }
99  int ival = dataType_.stringToEnumValue(t);
100  // std::cerr << " value is = " << dataType_.stringToEnumValue(t) << std::endl;
101  return std::pair<AnyMethodArgument,int>(ival,1);
102  }
103  if (dataType_ == typeid(std::string)) { return std::pair<AnyMethodArgument,int>(t,0); }
104  return std::pair<AnyMethodArgument,int>(t,-1);
105  }
bool isEnum() const
size_t dataMemberSize() const
std::string name() const
int stringToEnumValue(std::string const &) const
template<typename From , typename To >
std::pair<AnyMethodArgument, int> reco::parser::AnyMethodArgumentFixup::retOk_ ( const From &  f,
int  cast 
) const
inlineprivate

Definition at line 56 of file AnyMethodArgument.h.

56  {
57  return std::pair<AnyMethodArgument,int>(AnyMethodArgument(static_cast<To>(f)), cast);
58  }
double f[11][100]
boost::mpl::if_< matches_another_integral_type< unsigned long >, boost::variant< int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, double, float, std::string >, boost::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

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

Definition at line 54 of file AnyMethodArgument.h.

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