-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Serialise index cursor #2048
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ namespace seqan3 | |
/*!\brief The SeqAn Bidirectional FM Index Cursor. | ||
* \implements seqan3::bi_fm_index_cursor_specialisation | ||
* \tparam index_t The type of the underlying index; must model seqan3::bi_fm_index_specialisation. | ||
* \implements seqan3::cerealisable | ||
* \details | ||
* | ||
* The cursor's interface provides searching a string both from left to right as well as from right to left in the | ||
|
@@ -1022,6 +1023,28 @@ class bi_fm_index_cursor | |
return locate_result_value_type{sequence_rank-1, sequence_position}; | ||
}); | ||
} | ||
|
||
/*!\cond DEV | ||
* \brief Serialisation support function. | ||
* \tparam archive_t Type of `archive`; must satisfy seqan3::cereal_archive. | ||
* \param archive The archive being serialised from/to. | ||
* | ||
* \attention These functions are never called directly, see \ref serialisation for more details. | ||
*/ | ||
template <cereal_archive archive_t> | ||
void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive) | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this function is not visible to the user, we should mention this in the class documentation. I think we might just used Also Can you add a changelog entry, since this seems to be of interest to users :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but then I would also rebase this against the release branch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, it would be great to see directly in the documentation which classes can be serialized with cereal, I had to study the code to see that neither cerealisation is possible, nor I can access the members on my own. I guess adding something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently the documentation is only reflected in the inheritance diagram as far as I can see, https://docs.seqan.de/seqan/3-master-user/interfaceseqan3_1_1cerealisable.html We should rework this |
||
archive(fwd_lb); | ||
archive(fwd_rb); | ||
archive(rev_lb); | ||
archive(rev_rb); | ||
archive(sigma); | ||
archive(parent_lb); | ||
archive(parent_rb); | ||
archive(_last_char); | ||
archive(depth); | ||
} | ||
//!\endcond | ||
}; | ||
|
||
//!\} | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -15,7 +15,7 @@ | |||||
#include <tuple> | ||||||
#include <type_traits> | ||||||
|
||||||
#include <seqan3/core/platform.hpp> | ||||||
#include <seqan3/core/concept/cereal.hpp> | ||||||
|
||||||
namespace seqan3::detail | ||||||
{ | ||||||
|
@@ -27,6 +27,7 @@ namespace seqan3::detail | |||||
/*!\brief Internal representation of the node of an FM index cursor. | ||||||
* \ingroup fm_index | ||||||
* \tparam index_t The type of the underlying index; must satisfy seqan3::fm_index_specialisation. | ||||||
* \implements seqan3::cerealisable | ||||||
*/ | ||||||
template <typename index_t> | ||||||
struct fm_index_cursor_node | ||||||
|
@@ -61,6 +62,23 @@ struct fm_index_cursor_node | |||||
{ | ||||||
return !(*this == rhs); | ||||||
} | ||||||
|
||||||
/*!\cond DEV | ||||||
* \brief Serialisation support function. | ||||||
* \tparam archive_t Type of `archive`; must satisfy seqan3::cereal_archive. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
* \param archive The archive being serialised from/to. | ||||||
* | ||||||
* \attention These functions are never called directly, see \ref serialisation for more details. | ||||||
*/ | ||||||
template <cereal_archive archive_t> | ||||||
void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive) | ||||||
{ | ||||||
archive(lb); | ||||||
archive(rb); | ||||||
archive(depth); | ||||||
archive(last_char); | ||||||
} | ||||||
//!\endcond | ||||||
}; | ||||||
|
||||||
// std::tuple get_suffix_array_range(fm_index_cursor<index_t> const & it) | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -35,6 +35,7 @@ namespace seqan3 | |||||
/*!\brief The SeqAn FM Index Cursor. | ||||||
* \implements seqan3::fm_index_cursor_specialisation | ||||||
* \tparam index_t The type of the underlying index; must model seqan3::fm_index_specialisation. | ||||||
* \implements seqan3::cerealisable | ||||||
* \details | ||||||
* | ||||||
* The cursor's interface provides searching a string from left to right in the indexed text. | ||||||
|
@@ -621,6 +622,23 @@ class fm_index_cursor | |||||
return locate_result_value_type{sequence_rank - 1, sequence_position}; | ||||||
}); | ||||||
} | ||||||
|
||||||
/*!\cond DEV | ||||||
* \brief Serialisation support function. | ||||||
* \tparam archive_t Type of `archive`; must satisfy seqan3::cereal_archive. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
* \param archive The archive being serialised from/to. | ||||||
* | ||||||
* \attention These functions are never called directly, see \ref serialisation for more details. | ||||||
*/ | ||||||
template <cereal_archive archive_t> | ||||||
void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive) | ||||||
{ | ||||||
archive(parent_lb); | ||||||
archive(parent_rb); | ||||||
archive(node); | ||||||
archive(sigma); | ||||||
} | ||||||
//!\endcond | ||||||
}; | ||||||
|
||||||
//!\} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use
satifsy
in every serialisation method (~12 times). Can I do this as separated PR?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure