From c5fbf453ae31272cbb92e44c346795b7195598ec Mon Sep 17 00:00:00 2001 From: Luc Rancourt Date: Thu, 29 Feb 2024 10:16:24 +0100 Subject: [PATCH] Making methods public again. --- tiledb/sm/subarray/range_subset.cc | 14 +++++++------- tiledb/sm/subarray/range_subset.h | 27 ++++++++++----------------- tiledb/sm/subarray/subarray.cc | 22 +++++++++++----------- tiledb/sm/subarray/subarray.h | 15 ++++++--------- 4 files changed, 34 insertions(+), 44 deletions(-) diff --git a/tiledb/sm/subarray/range_subset.cc b/tiledb/sm/subarray/range_subset.cc index 52453130f28c..42604b0ad6c4 100644 --- a/tiledb/sm/subarray/range_subset.cc +++ b/tiledb/sm/subarray/range_subset.cc @@ -172,13 +172,6 @@ tuple> RangeSetAndSuperset::add_range( } } -void RangeSetAndSuperset::check_oob() { - for (auto& range : ranges_) { - impl_->check_range_is_valid(range); - throw_if_not_ok(impl_->check_range_is_subset(range)); - } -} - Status RangeSetAndSuperset::add_range_unrestricted(const Range& range) { if (is_implicitly_initialized_) { ranges_.clear(); @@ -187,4 +180,11 @@ Status RangeSetAndSuperset::add_range_unrestricted(const Range& range) { return impl_->add_range(ranges_, range); } +void RangeSetAndSuperset::check_oob() { + for (auto& range : ranges_) { + impl_->check_range_is_valid(range); + throw_if_not_ok(impl_->check_range_is_subset(range)); + } +} + } // namespace tiledb::sm diff --git a/tiledb/sm/subarray/range_subset.h b/tiledb/sm/subarray/range_subset.h index 555be0c4350b..eb3fab79e5bc 100644 --- a/tiledb/sm/subarray/range_subset.h +++ b/tiledb/sm/subarray/range_subset.h @@ -419,9 +419,6 @@ class TypedRangeSetAndFullsetImpl */ class RangeSetAndSuperset { public: - /** Friend Subarray for calling `add_range_unrestricted` */ - friend class Subarray; - /* ********************************* */ /* CONSTRUCTORS & DESTRUCTORS */ /* ********************************* */ @@ -487,6 +484,16 @@ class RangeSetAndSuperset { tuple> add_range( Range& range, const bool read_range_oob_error = true); + /** + * Adds a range to the range manager without performing any checkes. + * + * If the ranges are currently implicitly initialized, then they will be + * cleared before the new range is added. + * + * @param range The range to add. + */ + Status add_range_unrestricted(const Range& range); + /** * Removes all ranges. * @@ -568,20 +575,6 @@ class RangeSetAndSuperset { /** Stored ranges. */ std::vector ranges_{}; - - /* ********************************* */ - /* PRIVATE METHODS */ - /* ********************************* */ - - /** - * Adds a range to the range manager without performing any checkes. - * - * If the ranges are currently implicitly initialized, then they will be - * cleared before the new range is added. - * - * @param range The range to add. - */ - Status add_range_unrestricted(const Range& range); }; } // namespace tiledb::sm diff --git a/tiledb/sm/subarray/subarray.cc b/tiledb/sm/subarray/subarray.cc index e4f509bc80d8..3674f4a66f2e 100644 --- a/tiledb/sm/subarray/subarray.cc +++ b/tiledb/sm/subarray/subarray.cc @@ -425,6 +425,17 @@ Status Subarray::add_range( dim_idx, Range(&range[0], 2 * coord_size), err_on_range_oob_); } +Status Subarray::add_range_unsafe(uint32_t dim_idx, const Range& range) { + // Must reset the result size and tile overlap + est_result_size_computed_ = false; + tile_overlap_.clear(); + + // Add the range + throw_if_not_ok(range_subset_[dim_idx].add_range_unrestricted(range)); + is_default_[dim_idx] = range_subset_[dim_idx].is_implicitly_initialized(); + return Status::Ok(); +} + Status Subarray::add_point_ranges( unsigned dim_idx, const void* start, uint64_t count, bool check_for_label) { if (dim_idx >= this->array_->array_schema_latest().dim_num()) { @@ -2112,17 +2123,6 @@ void Subarray::add_default_ranges() { add_default_label_ranges(dim_num); } -Status Subarray::add_range_unsafe(uint32_t dim_idx, const Range& range) { - // Must reset the result size and tile overlap - est_result_size_computed_ = false; - tile_overlap_.clear(); - - // Add the range - throw_if_not_ok(range_subset_[dim_idx].add_range_unrestricted(range)); - is_default_[dim_idx] = range_subset_[dim_idx].is_implicitly_initialized(); - return Status::Ok(); -} - void Subarray::add_default_label_ranges(dimension_size_type dim_num) { label_range_subset_.clear(); label_range_subset_.resize(dim_num, nullopt); diff --git a/tiledb/sm/subarray/subarray.h b/tiledb/sm/subarray/subarray.h index cc51be6172aa..8ab378a4c7aa 100644 --- a/tiledb/sm/subarray/subarray.h +++ b/tiledb/sm/subarray/subarray.h @@ -151,9 +151,6 @@ class ITileRange { */ class Subarray { public: - /** Friend with Query to call `add_range_unsafe` */ - friend class Query; - /* ********************************* */ /* PUBLIC DATA TYPES */ /* ********************************* */ @@ -478,6 +475,12 @@ class Subarray { Status add_range( unsigned dim_idx, const void* start, const void* end, const void* stride); + /** + * Adds a range along the dimension with the given index, without + * performing any error checks. + */ + Status add_range_unsafe(uint32_t dim_idx, const Range& range); + /** * @brief Set point ranges from an array * @@ -1551,12 +1554,6 @@ class Subarray { */ void add_default_ranges(); - /** - * Adds a range along the dimension with the given index, without - * performing any error checks. - */ - Status add_range_unsafe(uint32_t dim_idx, const Range& range); - /** Computes the estimated result size for all attributes/dimensions. */ Status compute_est_result_size(const Config* config, ThreadPool* compute_tp);