| 412 | } |
| 413 | |
| 414 | void Subarray::add_point_ranges( |
| 415 | unsigned dim_idx, const void* start, uint64_t count, bool check_for_label) { |
| 416 | if (dim_idx >= this->array_->array_schema_latest().dim_num()) { |
| 417 | throw SubarrayException("Cannot add range; Invalid dimension index"); |
| 418 | } |
| 419 | |
| 420 | if (check_for_label && label_range_subset_[dim_idx].has_value()) { |
| 421 | throw SubarrayException( |
| 422 | "Cannot add range to to dimension; A range is already set on a " |
| 423 | "dimension label for this dimension"); |
| 424 | } |
| 425 | |
| 426 | if (start == nullptr) { |
| 427 | throw SubarrayException("Cannot add ranges; Invalid start pointer"); |
| 428 | } |
| 429 | |
| 430 | if (this->array_->array_schema_latest() |
| 431 | .domain() |
| 432 | .dimension_ptr(dim_idx) |
| 433 | ->var_size()) { |
| 434 | throw SubarrayException( |
| 435 | "Cannot add range; Range must be fixed-sized. If you " |
| 436 | "want to add a variable-sized range, use the " |
| 437 | "add_range_var() instead"); |
| 438 | } |
| 439 | |
| 440 | // Prepare a temp range |
| 441 | std::vector<uint8_t> range; |
| 442 | auto coord_size = |
| 443 | this->array_->array_schema_latest().dimension_ptr(dim_idx)->coord_size(); |
| 444 | range.resize(2 * coord_size); |
| 445 | |
| 446 | for (size_t i = 0; i < count; i++) { |
| 447 | uint8_t* ptr = (uint8_t*)start + coord_size * i; |
| 448 | // point ranges |
| 449 | std::memcpy(&range[0], ptr, coord_size); |
| 450 | std::memcpy(&range[coord_size], ptr, coord_size); |
| 451 | |
| 452 | // Add range |
| 453 | this->add_range( |
| 454 | dim_idx, Range(&range[0], 2 * coord_size), err_on_range_oob_); |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | void Subarray::add_point_ranges_var( |
| 459 | unsigned dim_idx, |
no test coverage detected