From 0eefbab8ddf1e05880e4f5812370083e6611e3d4 Mon Sep 17 00:00:00 2001 From: simonsasse <59832939+simonsasse@users.noreply.github.com> Date: Thu, 27 Aug 2020 14:19:15 +0200 Subject: [PATCH] [Alignment Configuration] Rename align_cfg::alignment_result_capture to align_cfg::detail::result_type (#2031) * [Alignment Configuration] Rename align_cfg::alignment_result_capture to align_cfg::detail::result_type * Update include/seqan3/alignment/configuration/align_config_vectorised.hpp Co-authored-by: Marcel --- ...pture.hpp => align_config_result_type.hpp} | 20 +++--- .../seqan3/alignment/configuration/all.hpp | 2 +- .../seqan3/alignment/configuration/detail.hpp | 72 +++++++++---------- .../pairwise/alignment_configurator.hpp | 5 +- .../alignment/pairwise/detail/type_traits.hpp | 6 +- .../edit_distance_unbanded_benchmark.cpp | 4 +- .../align_config_common_test.cpp | 2 +- .../edit_distance_unbanded_test_template.hpp | 4 +- 8 files changed, 57 insertions(+), 58 deletions(-) rename include/seqan3/alignment/configuration/{align_config_alignment_result_capture.hpp => align_config_result_type.hpp} (82%) diff --git a/include/seqan3/alignment/configuration/align_config_alignment_result_capture.hpp b/include/seqan3/alignment/configuration/align_config_result_type.hpp similarity index 82% rename from include/seqan3/alignment/configuration/align_config_alignment_result_capture.hpp rename to include/seqan3/alignment/configuration/align_config_result_type.hpp index 341d917bc8..995a9289e7 100644 --- a/include/seqan3/alignment/configuration/align_config_alignment_result_capture.hpp +++ b/include/seqan3/alignment/configuration/align_config_result_type.hpp @@ -6,7 +6,7 @@ // ----------------------------------------------------------------------------------------------------- /*!\file - * \brief Provides seqan3::align_cfg::alignment_result_capture. + * \brief Provides seqan3::align_cfg::detail::result_type and seqan3::detail::result_type_tag. * \author Rene Rahn */ @@ -28,25 +28,23 @@ namespace seqan3::detail * * \details * - * Implementation of the alignment result capture config. + * Implementation of the alignment result type config. * - * \see seqan3::align_cfg::alignment_result_capture + * \see seqan3::align_cfg::detail::result_type */ template //!\cond requires is_type_specialisation_of_v //!\endcond -struct alignment_result_capture_element : - public pipeable_config_element, - std::type_identity> +struct result_type_tag : + public pipeable_config_element, std::type_identity> { //!\brief Internal id to check for consistent configuration settings. - static constexpr detail::align_config_id id{detail::align_config_id::alignment_result_capture}; + static constexpr detail::align_config_id id{detail::align_config_id::result_type}; }; - } // namespace seqan3::detail -namespace seqan3::align_cfg +namespace seqan3::align_cfg::detail { /*!\if DEV * \brief Configuration element capturing the configured seqan3::alignment_result for the alignment algorithm. @@ -73,5 +71,5 @@ template //!\cond requires seqan3::detail::is_type_specialisation_of_v //!\endcond -inline constexpr seqan3::detail::alignment_result_capture_element alignment_result_capture{}; -} // namespace seqan3::align_cfg +inline constexpr seqan3::detail::result_type_tag result_type{}; +} // namespace seqan3::align_cfg::detail diff --git a/include/seqan3/alignment/configuration/all.hpp b/include/seqan3/alignment/configuration/all.hpp index 5a0ca47e44..b079605b32 100644 --- a/include/seqan3/alignment/configuration/all.hpp +++ b/include/seqan3/alignment/configuration/all.hpp @@ -13,7 +13,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/include/seqan3/alignment/configuration/detail.hpp b/include/seqan3/alignment/configuration/detail.hpp index 561d5ba7ba..9d23772104 100644 --- a/include/seqan3/alignment/configuration/detail.hpp +++ b/include/seqan3/alignment/configuration/detail.hpp @@ -22,8 +22,7 @@ namespace seqan3::detail */ enum struct align_config_id : uint8_t { - //!\brief ID for the \ref seqan3::align_cfg::alignment_result_capture "alignment_result_capture" option. - alignment_result_capture, + aligned_ends, //!< ID for the \ref seqan3::align_cfg::aligned_ends "aligned_ends" option. band, //!< ID for the \ref seqan3::align_cfg::band_fixed_size "band" option. debug, //!< ID for the \ref seqan3::align_cfg::detail::debug "debug" option. @@ -40,6 +39,7 @@ enum struct align_config_id : uint8_t output_score, //!< ID for the \ref seqan3::align_cfg::output_score "score output" option. parallel, //!< ID for the \ref seqan3::align_cfg::parallel "parallel" option. result, //!< ID for the \ref seqan3::align_cfg::result "result" option. + result_type, //!< ID for the \ref seqan3::align_cfg::detail::result_type "result_type" option. scoring, //!< ID for the \ref seqan3::align_cfg::scoring_scheme "scoring_scheme" option. vectorised, //!< ID for the \ref seqan3::align_cfg::vectorised "vectorised" option. SIZE //!< Represents the number of configuration elements. @@ -58,42 +58,42 @@ template <> inline constexpr std::array(align_config_id::SIZE)>, static_cast(align_config_id::SIZE)> compatibility_table { - { //alignment_result_capture - //| aligned_ends - //| | band - //| | | debug - //| | | | gap - //| | | | | global - //| | | | | | local - //| | | | | | | max_error - //| | | | | | | | on_result - //| | | | | | | | | output_alignment - //| | | | | | | | | | output_begin_position - //| | | | | | | | | | | output_end_position - //| | | | | | | | | | | | output_sequence1_id - //| | | | | | | | | | | | | output_sequence2_id - //| | | | | | | | | | | | | | output_score - //| | | | | | | | | | | | | | | parallel - //| | | | | | | | | | | | | | | | result + { //aligned_ends + //| band + //| | debug + //| | | gap + //| | | | global + //| | | | | local + //| | | | | | max_error + //| | | | | | | on_result + //| | | | | | | | output_alignment + //| | | | | | | | | output_begin_position + //| | | | | | | | | | output_end_position + //| | | | | | | | | | | output_sequence1_id + //| | | | | | | | | | | | output_sequence2_id + //| | | | | | | | | | | | | output_score + //| | | | | | | | | | | | | | parallel + //| | | | | | | | | | | | | | | result + //| | | | | | | | | | | | | | | | result_type //| | | | | | | | | | | | | | | | | scoring //| | | | | | | | | | | | | | | | | | vectorised - { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 0: alignment_result_capture - { 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 1: aligned_ends - { 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 2: band - { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 3: debug - { 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 4: gap - { 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 5: global - { 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 6: local - { 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 7: max_error - { 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 8: on_result - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 9: output_alignment - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1}, // 10: output_begin_position - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1}, // 11: output_end_position - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1}, // 12: output_sequence1_id - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1}, // 13: output_sequence2_id - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1}, // 14: output_score - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1}, // 15: parallel - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}, // 16: result + { 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 0: aligned_ends + { 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 1: band + { 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 2: debug + { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 3: gap + { 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 4: global + { 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 5: local + { 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 6: max_error + { 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 7: on_result + { 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 8: output_alignment + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 9: output_begin_position + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1}, // 10: output_end_position + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1}, // 11: output_sequence1_id + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1}, // 12: output_sequence2_id + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1}, // 13: output_score + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1}, // 14: parallel + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1}, // 15: result + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}, // 16: result_type { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, // 17: scoring { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0} // 18: vectorised } diff --git a/include/seqan3/alignment/pairwise/alignment_configurator.hpp b/include/seqan3/alignment/pairwise/alignment_configurator.hpp index a877286849..60abbcdf9e 100644 --- a/include/seqan3/alignment/pairwise/alignment_configurator.hpp +++ b/include/seqan3/alignment/pairwise/alignment_configurator.hpp @@ -17,8 +17,9 @@ #include #include -#include + #include +#include #include #include #include @@ -295,7 +296,7 @@ struct alignment_configurator using function_wrapper_t = std::function; // Capture the alignment result type. - auto config_with_result_type = config_with_output | align_cfg::alignment_result_capture; + auto config_with_result_type = config_with_output | align_cfg::detail::result_type; // ---------------------------------------------------------------------------- // Test some basic preconditions diff --git a/include/seqan3/alignment/pairwise/detail/type_traits.hpp b/include/seqan3/alignment/pairwise/detail/type_traits.hpp index 44552f94d6..4620adcc04 100644 --- a/include/seqan3/alignment/pairwise/detail/type_traits.hpp +++ b/include/seqan3/alignment/pairwise/detail/type_traits.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include #include @@ -103,10 +103,10 @@ struct alignment_configuration_traits //!\brief Helper function to determine the alignment result type. static constexpr auto determine_alignment_result_type() noexcept { - if constexpr (configuration_t::template exists()) + if constexpr (configuration_t::template exists()) { using wrapped_result_t = - decltype(seqan3::get(std::declval()).value); + decltype(seqan3::get(std::declval()).value); return typename wrapped_result_t::type{}; // Unwrap the type_identity. } else diff --git a/test/performance/alignment/edit_distance_unbanded_benchmark.cpp b/test/performance/alignment/edit_distance_unbanded_benchmark.cpp index 565c1be82f..5340245eaf 100644 --- a/test/performance/alignment/edit_distance_unbanded_benchmark.cpp +++ b/test/performance/alignment/edit_distance_unbanded_benchmark.cpp @@ -71,7 +71,7 @@ void seqan3_edit_distance_dna4(benchmark::State & state) using alignment_result_t = alignment_result_type_t; auto edit_distance_cfg_with_result_type = edit_distance_cfg | - seqan3::align_cfg::alignment_result_capture; + seqan3::align_cfg::detail::result_type; using edit_traits_t = seqan3::detail::default_edit_distance_trait_type; auto edit_distance_cfg_with_result_type = edit_distance_cfg | - seqan3::align_cfg::alignment_result_capture; + seqan3::align_cfg::detail::result_type; using edit_traits_t = seqan3::detail::default_edit_distance_trait_type, seqan3::align_cfg::scoring_scheme>, seqan3::detail::vectorised_tag, - seqan3::detail::alignment_result_capture_element>; + seqan3::detail::result_type_tag>; TYPED_TEST_SUITE(alignment_configuration_test, test_types, ); diff --git a/test/unit/alignment/pairwise/edit_distance_unbanded_test_template.hpp b/test/unit/alignment/pairwise/edit_distance_unbanded_test_template.hpp index 8a9eabdfcd..f76f86cb92 100644 --- a/test/unit/alignment/pairwise/edit_distance_unbanded_test_template.hpp +++ b/test/unit/alignment/pairwise/edit_distance_unbanded_test_template.hpp @@ -9,7 +9,7 @@ #include -#include +#include #include #include @@ -94,7 +94,7 @@ auto edit_distance(database_t && database, query_t && query, align_cfg_t && alig std::remove_reference_t>::type; using alignment_result_t = seqan3::alignment_result; auto align_cfg_with_result_type = align_cfg_with_score_type | - seqan3::align_cfg::alignment_result_capture; + seqan3::align_cfg::detail::result_type; using align_config_with_result_type_t = decltype(align_cfg_with_result_type); using edit_traits = edit_traits_type