9 #include <treelite/version.h> 14 #define STR_IMPL_(x) #x 15 #define STR(x) STR_IMPL_(x) 19 struct TreeliteAPIErrorEntry {
20 std::string last_error;
21 std::string version_str;
29 return TreeliteAPIErrorStore::Get()->last_error.c_str();
33 TreeliteAPIErrorStore::Get()->last_error = msg;
37 std::ostringstream oss;
38 oss << TREELITE_VER_MAJOR <<
"." << TREELITE_VER_MINOR <<
"." << TREELITE_VER_PATCH;
39 std::string& version_str = TreeliteAPIErrorStore::Get()->version_str;
40 version_str = oss.str();
41 return version_str.c_str();
44 const char* TREELITE_VERSION =
"TREELITE_VERSION_" STR(TREELITE_VER_MAJOR)
"." 45 STR(TREELITE_VER_MINOR)
"." STR(TREELITE_VER_PATCH);
const char * TreeliteGetLastError()
display last error; can be called by multiple threads Note. Each thread will get the last error occur...
Helper class for thread-local storage.
Error handling for C API.
const char * TreeliteQueryTreeliteVersion()
Get the version string for the Treelite library.
void TreeliteAPISetLastError(const char *msg)
Set the last error message needed by C API.