| 998 | } |
| 999 | |
| 1000 | int LGBM_DatasetSetField(DatasetHandle handle, |
| 1001 | const char* field_name, |
| 1002 | const void* field_data, |
| 1003 | int num_element, |
| 1004 | int type) { |
| 1005 | API_BEGIN(); |
| 1006 | auto dataset = reinterpret_cast<Dataset*>(handle); |
| 1007 | bool is_success = false; |
| 1008 | if (type == C_API_DTYPE_FLOAT32) { |
| 1009 | is_success = dataset->SetFloatField(field_name, reinterpret_cast<const float*>(field_data), static_cast<int32_t>(num_element)); |
| 1010 | } else if (type == C_API_DTYPE_INT32) { |
| 1011 | is_success = dataset->SetIntField(field_name, reinterpret_cast<const int*>(field_data), static_cast<int32_t>(num_element)); |
| 1012 | } else if (type == C_API_DTYPE_FLOAT64) { |
| 1013 | is_success = dataset->SetDoubleField(field_name, reinterpret_cast<const double*>(field_data), static_cast<int32_t>(num_element)); |
| 1014 | } |
| 1015 | if (!is_success) { throw std::runtime_error("Input data type error or field not found"); } |
| 1016 | API_END(); |
| 1017 | } |
| 1018 | |
| 1019 | int LGBM_DatasetGetField(DatasetHandle handle, |
| 1020 | const char* field_name, |
no test coverage detected