8 #ifndef TREELITE_FRONTEND_IMPL_H_ 9 #define TREELITE_FRONTEND_IMPL_H_ 17 template<
typename Func>
19 Value::Dispatch(Func func) {
21 case TypeInfo::kUInt32:
22 return func(Get<uint32_t>());
23 case TypeInfo::kFloat32:
24 return func(Get<float>());
25 case TypeInfo::kFloat64:
26 return func(Get<double>());
28 throw Error(std::string(
"Unknown value type detected: ")
29 + std::to_string(static_cast<int>(type_)));
30 return func(Get<double>());
34 template<
typename Func>
36 Value::Dispatch(Func func)
const {
38 case TypeInfo::kUInt32:
39 return func(Get<uint32_t>());
40 case TypeInfo::kFloat32:
41 return func(Get<float>());
42 case TypeInfo::kFloat64:
43 return func(Get<double>());
45 throw Error(std::string(
"Unknown value type detected: ")
46 + std::to_string(static_cast<int>(type_)));
47 return func(Get<double>());
54 #endif // TREELITE_FRONTEND_IMPL_H_
Exception class used throughout the Treelite codebase.