![]() |
![]() |
#include <AnyMethodArgument.h>
Public Member Functions | |
AnyMethodArgumentFixup (edm::TypeWithDict type) | |
std::pair< AnyMethodArgument, int > | operator() (const std::string &t) const |
template<typename F > | |
boost::enable_if < boost::is_floating_point< F > , std::pair< AnyMethodArgument, int > >::type | operator() (const F &t) const |
template<typename I > | |
boost::enable_if < boost::is_integral< I > , std::pair< AnyMethodArgument, int > >::type | operator() (const I &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_ |
const std::type_info & | type_ |
Definition at line 53 of file AnyMethodArgument.h.
reco::parser::AnyMethodArgumentFixup::AnyMethodArgumentFixup | ( | edm::TypeWithDict | type | ) | [inline] |
Definition at line 78 of file AnyMethodArgument.h.
References dataType_, edm::TypeWithDict::isTypedef(), and edm::TypeWithDict::toType().
: dataType_(type), type_(type.name() == "string" ? typeid(std::string) : type.typeInfo()) // Otherwise Root does this wrong :-( { while (dataType_.isTypedef()) dataType_ = dataType_.toType(); /* // Code to print out enum table if (dataType_.isEnum()) { std::cerr << "Enum conversion: [" << dataType_.name() << "] => [" << type_.name() << "]" << std::endl; std::cerr << "Enum has " << dataType_.dataMemberSize() << ", members." << std::endl; TypeDataMembers members(dataType_); for(auto const& member : members) { edm::MemberWithDict mem(member); std::cerr << " member #"<<i<<", name = " << mem.name() << ", dataType_ = " << mem.typeOf().name() << std::endl; } } // */ }
std::pair<AnyMethodArgument,int> reco::parser::AnyMethodArgumentFixup::doInt | ( | int | t | ) | const [inline, private] |
Definition at line 63 of file AnyMethodArgument.h.
References lumiQTWidget::t, and type_.
Referenced by operator()().
{ if (type_ == typeid(int8_t)) { return retOk_<int,int8_t> (t,0); } if (type_ == typeid(uint8_t)) { return retOk_<int,uint8_t> (t,0); } if (type_ == typeid(int16_t)) { return retOk_<int,int16_t> (t,0); } if (type_ == typeid(uint16_t)) { return retOk_<int,uint16_t>(t,0); } if (type_ == typeid(int32_t)) { return retOk_<int,int32_t> (t,0); } if (type_ == typeid(uint32_t)) { return retOk_<int,uint32_t>(t,0); } if (type_ == typeid(int64_t)) { return retOk_<int,int64_t> (t,0); } if (type_ == typeid(uint64_t)) { return retOk_<int,uint64_t>(t,0); } if (type_ == typeid(unsigned long)) { return retOk_<int,unsigned long> (t,0); } // harmless if unsigned long matches another type if (type_ == typeid(double)) { return retOk_<int,double> (t,1); } if (type_ == typeid(float)) { return retOk_<int,float> (t,1); } return std::pair<AnyMethodArgument,int>(t,-1); }
std::pair<AnyMethodArgument,int> reco::parser::AnyMethodArgumentFixup::operator() | ( | const std::string & | t | ) | const [inline] |
Definition at line 108 of file AnyMethodArgument.h.
References edm::TypeWithDict::dataMemberByName(), edm::TypeWithDict::dataMemberSize(), dataType_, Exception, edm::MemberWithDict::get(), edm::TypeWithDict::isEnum(), edm::TypeWithDict::name(), AlCaHLTBitMon_QueryRunRegistry::string, lumiQTWidget::t, type_, edm::MemberWithDict::typeOf(), and relativeConstraints::value.
{ if (type_ == typeid(std::string)) { return std::pair<AnyMethodArgument,int>(t,0); } if (dataType_.isEnum()) { if (dataType_.dataMemberSize() == 0) { throw parser::Exception(t.c_str()) << "Enumerator '" << dataType_.name() << "' has no keys.\nPerhaps the dictionary is missing?\n"; } edm::MemberWithDict value = dataType_.dataMemberByName(t); //std::cerr << "Trying to convert '" << t << "' to a value for enumerator '" << dataType_.name() << "'" << std::endl; if (!value) // check for existing value return std::pair<AnyMethodArgument,int>(t,-1); // throw parser::Exception(t.c_str()) << "Can't convert '" << t << "' to a value for enumerator '" << dataType_.name() << "'\n"; //std::cerr << " found member of type '" << value.typeOf().name() << "'" << std::endl; if (value.typeOf().typeInfo() != typeid(int)) // check is backed by an Int throw parser::Exception(t.c_str()) << "Enumerator '" << dataType_.name() << "' is not implemented by type 'int' !!??\n"; //std::cerr << " value is @ " << reinterpret_cast<const int *>(value.get().address()) << std::endl; int ival = * reinterpret_cast<const int *>(value.get().address()); //std::cerr << " value is = " << ival << std::endl; return std::pair<AnyMethodArgument,int>(ival,1); } return std::pair<AnyMethodArgument,int>(t,-1); }
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 102 of file AnyMethodArgument.h.
References lumiQTWidget::t, and type_.
boost::enable_if<boost::is_integral<I>, std::pair<AnyMethodArgument,int> >::type reco::parser::AnyMethodArgumentFixup::operator() | ( | const I & | t | ) | const [inline] |
std::pair<AnyMethodArgument, int> reco::parser::AnyMethodArgumentFixup::retOk_ | ( | const From & | f, |
int | cast | ||
) | const [inline, private] |
Definition at line 58 of file AnyMethodArgument.h.
{ return std::pair<AnyMethodArgument,int>(AnyMethodArgument(static_cast<To>(f)), cast); }
Definition at line 55 of file AnyMethodArgument.h.
Referenced by AnyMethodArgumentFixup(), and operator()().
const std::type_info& reco::parser::AnyMethodArgumentFixup::type_ [private] |
Definition at line 56 of file AnyMethodArgument.h.
Referenced by doInt(), and operator()().