23 #include "ngraph/check.hpp"
29 template <
typename EnumType>
34 static EnumType
as_enum(
const std::string& name)
36 auto to_lower = [](
const std::string& s) {
38 std::transform(rc.begin(), rc.end(), rc.begin(), ::tolower);
41 for (
auto p : get().m_string_enums)
43 if (to_lower(p.first) == to_lower(name))
48 NGRAPH_CHECK(
false,
"\"", name,
"\"",
" is not a member of enum ", get().m_enum_name);
54 for (
auto& p : get().m_string_enums)
61 NGRAPH_CHECK(
false,
" invalid member of enum ", get().m_enum_name);
67 const std::vector<std::pair<std::string, EnumType>> string_enums)
68 : m_enum_name(enum_name)
69 , m_string_enums(string_enums)
74 static EnumNames<EnumType>& get();
76 const std::string m_enum_name;
77 std::vector<std::pair<std::string, EnumType>> m_string_enums;
81 template <
typename Type,
typename Value>
82 typename std::enable_if<std::is_convertible<Value, std::string>::value, Type>::type
89 template <
typename Value>