| 1017 | } |
| 1018 | |
| 1019 | int LGBM_DatasetGetField(DatasetHandle handle, |
| 1020 | const char* field_name, |
| 1021 | int* out_len, |
| 1022 | const void** out_ptr, |
| 1023 | int* out_type) { |
| 1024 | API_BEGIN(); |
| 1025 | auto dataset = reinterpret_cast<Dataset*>(handle); |
| 1026 | bool is_success = false; |
| 1027 | if (dataset->GetFloatField(field_name, out_len, reinterpret_cast<const float**>(out_ptr))) { |
| 1028 | *out_type = C_API_DTYPE_FLOAT32; |
| 1029 | is_success = true; |
| 1030 | } else if (dataset->GetIntField(field_name, out_len, reinterpret_cast<const int**>(out_ptr))) { |
| 1031 | *out_type = C_API_DTYPE_INT32; |
| 1032 | is_success = true; |
| 1033 | } else if (dataset->GetDoubleField(field_name, out_len, reinterpret_cast<const double**>(out_ptr))) { |
| 1034 | *out_type = C_API_DTYPE_FLOAT64; |
| 1035 | is_success = true; |
| 1036 | } else if (dataset->GetInt8Field(field_name, out_len, reinterpret_cast<const int8_t**>(out_ptr))) { |
| 1037 | *out_type = C_API_DTYPE_INT8; |
| 1038 | is_success = true; |
| 1039 | } |
| 1040 | if (!is_success) { throw std::runtime_error("Field not found"); } |
| 1041 | if (*out_ptr == nullptr) { *out_len = 0; } |
| 1042 | API_END(); |
| 1043 | } |
| 1044 | |
| 1045 | int LGBM_DatasetUpdateParam(DatasetHandle handle, const char* parameters) { |
| 1046 | API_BEGIN(); |
no test coverage detected