1 #ifndef CommonTools_Utils_AnyMethodArgument_h 2 #define CommonTools_Utils_AnyMethodArgument_h 11 #include <type_traits> 31 typedef std::conditional<
33 std::variant<int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, double, float, std::string>,
50 template <
typename From,
typename To>
51 std::pair<AnyMethodArgument, int>
retOk_(
const From &
f,
int cast)
const {
56 std::pair<AnyMethodArgument, int>
doInt(
int t)
const {
58 return retOk_<int, int8_t>(
t, 0);
61 return retOk_<int, uint8_t>(
t, 0);
64 return retOk_<int, int16_t>(
t, 0);
67 return retOk_<int, uint16_t>(
t, 0);
70 return retOk_<int, int32_t>(
t, 0);
73 return retOk_<int, uint32_t>(
t, 0);
76 return retOk_<int, int64_t>(
t, 0);
79 return retOk_<int, uint64_t>(
t, 0);
82 return retOk_<int, unsigned long>(
t, 0);
85 return retOk_<int, double>(
t, 1);
88 return retOk_<int, float>(
t, 1);
90 return std::pair<AnyMethodArgument, int>(
t, -1);
103 template <
typename F>
107 return retOk_<F, double>(
t, 0);
110 return retOk_<F, float>(
t, 0);
112 return std::pair<AnyMethodArgument, int>(
t, -1);
119 <<
"Enumerator '" <<
dataType_.
name() <<
"' has no keys.\nPerhaps the dictionary is missing?\n";
123 return std::pair<AnyMethodArgument, int>(ival, 1);
126 return std::pair<AnyMethodArgument, int>(
t, 0);
128 return std::pair<AnyMethodArgument, int>(
t, -1);
134 template <
typename T>
136 return const_cast<void *
>(
static_cast<const void *
>(&
t));
int stringToEnumValue(std::string const &) const
std::pair< AnyMethodArgument, int > doInt(int t) const
edm::TypeWithDict dataType_
std::pair< AnyMethodArgument, int > operator()(const std::string &t) const
void * operator()(const T &t) const
std::enable_if< std::is_integral< I >::value, std::pair< AnyMethodArgument, int > >::type operator()(const I &t) const
const std::complex< double > I
AnyMethodArgumentFixup(const edm::TypeWithDict &type)
std::pair< AnyMethodArgument, int > retOk_(const From &f, int cast) const
unsigned long long uint64_t
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
size_t dataMemberSize() const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
std::enable_if< std::is_floating_point< F >::value, std::pair< AnyMethodArgument, int > >::type operator()(const F &t) const