From f8455c40f15e4eff7b9e3c1a60e28a1dbc6eb94f Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos Date: Tue, 10 Dec 2024 12:45:44 +0200 Subject: [PATCH] Add template-specialization guards --- libtiledbsoma/src/soma/soma_column.cc | 29 ++++++++++++++++++++++++++- libtiledbsoma/src/soma/soma_column.h | 16 +++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/libtiledbsoma/src/soma/soma_column.cc b/libtiledbsoma/src/soma/soma_column.cc index 95a1cfecc1..6d43968878 100644 --- a/libtiledbsoma/src/soma/soma_column.cc +++ b/libtiledbsoma/src/soma/soma_column.cc @@ -52,9 +52,36 @@ SOMAColumn::core_current_domain_slot( if (current_domain.first == "" && (current_domain.second == "\x7f" || current_domain.second == "\xff")) { return std::pair("", ""); + } else { + throw TileDBSOMAError(std::format( + "[SOMAColumn][core_current_domain_slot] unexpected current " + "domain returnd ({}, {})", + current_domain.first, + current_domain.second)); } + } catch (const std::exception& e) { + throw TileDBSOMAError(e.what()); + } +} + +template <> +std::pair +SOMAColumn::core_current_domain_slot(NDRectangle& ndrect) const { + try { + std::pair + current_domain = std::any_cast>( + _core_current_domain_slot(ndrect)); - return current_domain; + if (current_domain.first == "" && (current_domain.second == "\x7f" || + current_domain.second == "\xff")) { + return std::pair("", ""); + } else { + throw TileDBSOMAError(std::format( + "[SOMAColumn][core_current_domain_slot] unexpected current " + "domain returnd ({}, {})", + current_domain.first, + current_domain.second)); + } } catch (const std::exception& e) { throw TileDBSOMAError(e.what()); } diff --git a/libtiledbsoma/src/soma/soma_column.h b/libtiledbsoma/src/soma/soma_column.h index 0528a349e5..9951c94348 100644 --- a/libtiledbsoma/src/soma/soma_column.h +++ b/libtiledbsoma/src/soma/soma_column.h @@ -390,6 +390,12 @@ class SOMAColumn { */ template std::pair core_domain_slot() const { + if (std::is_same_v) { + throw std::runtime_error( + "SOMAArray::soma_domain_slot: template-specialization " + "failure."); + } + try { return std::any_cast>(_core_domain_slot()); } catch (const std::exception& e) { @@ -457,6 +463,12 @@ class SOMAColumn { template std::pair core_current_domain_slot( const SOMAContext& ctx, Array& array) const { + if (std::is_same_v) { + throw std::runtime_error( + "SOMAArray::soma_domain_slot: template-specialization " + "failure."); + } + try { return std::any_cast>( _core_current_domain_slot(ctx, array)); @@ -534,5 +546,9 @@ std::pair SOMAColumn::core_current_domain_slot( const SOMAContext& ctx, Array& array) const; +template <> +std::pair +SOMAColumn::core_current_domain_slot(NDRectangle& ndrect) const; + } // namespace tiledbsoma #endif \ No newline at end of file