MCPcopy Create free account
hub / github.com/catboost/catboost / TModel

Method TModel

catboost/node-package/src/model.cpp:25–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23namespace NNodeCatBoost {
24
25TModel::TModel(const Napi::CallbackInfo& info): Napi::ObjectWrap<TModel>(info) {
26 Napi::Env env = info.Env();
27
28 this->Handle = ModelCalcerCreate();
29 NHelper::CheckNotNullHandle(env, this->Handle);
30
31 if (info.Length() == 0) {
32 return;
33 }
34
35 NHelper::Check(env, info[0].IsString(), "File name argument should be a string");
36 const bool status = LoadFullModelFromFile(
37 this->Handle,
38 info[0].As<Napi::String>().Utf8Value().c_str()
39 );
40 // Even if it fails, this check schedules NodeJS exception, not C++ one.
41 // The C++ object is considered to be successfully created and will be destroyed by Node runtime
42 // later as usual.
43 NHelper::CheckStatus(env, status);
44 if (status) {
45 this->ModelLoaded = true;
46 }
47}
48
49TModel::~TModel() {
50 if (this->Handle != nullptr) {

Callers

nothing calls this directly

Calls 7

CheckNotNullHandleFunction · 0.85
LoadFullModelFromFileFunction · 0.85
CheckStatusFunction · 0.85
CheckFunction · 0.70
LengthMethod · 0.45
IsStringMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected