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