Treelite
typeinfo.cc
Go to the documentation of this file.
1 
8 // Do not include other Treelite headers here, to minimize cross-header dependencies
9 
10 #include <treelite/typeinfo.h>
11 #include <string>
12 #include <unordered_map>
13 
14 namespace treelite {
15 
16 TypeInfo GetTypeInfoByName(const std::string& str) {
17  if (str == "uint32") {
18  return TypeInfo::kUInt32;
19  } else if (str == "float32") {
20  return TypeInfo::kFloat32;
21  } else if (str == "float64") {
22  return TypeInfo::kFloat64;
23  } else {
24  throw std::runtime_error("Unrecognized type");
25  return TypeInfo::kInvalid;
26  }
27 }
28 
29 } // namespace treelite
TypeInfo
Types used by thresholds and leaf outputs.
Definition: typeinfo.h:22
Defines TypeInfo class and utilities.
TypeInfo GetTypeInfoByName(const std::string &str)
conversion table from string to TypeInfo, defined in tables.cc
Definition: typeinfo.cc:16