Skip to content

Commit bbb7844

Browse files
committed
[fix] workaround bug in cereal
1 parent f2c2c9d commit bbb7844

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/shared_definitions.hpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ using IndexSpec = fmindex_collection::occtable::interleavedEPR32V2::OccTable<Alp
237237
// ==========================================================================
238238

239239
template <typename TString>
240-
using TCDStringSet = seqan3::concatenated_sequences<TString>; //TODO seqan3::concatenated_sequences
240+
using TCDStringSet = seqan3::concatenated_sequences<TString>;
241241

242242
template <AlphabetEnum c_origSbjAlph, AlphabetEnum c_transAlph, AlphabetEnum c_redAlph>
243243
inline constexpr auto sbjTransView = []()
@@ -276,6 +276,34 @@ constexpr auto redView = []()
276276
return views::dna_n_to_random;
277277
}();
278278

279+
// ==========================================================================
280+
// overload serialisation
281+
// ==========================================================================
282+
283+
namespace cereal
284+
{
285+
286+
template <seqan3::alphabet alph_t>
287+
requires std::is_trivially_copyable_v<alph_t>
288+
void save(cereal::BinaryOutputArchive & archive, std::vector<alph_t> const & vec)
289+
{
290+
archive(static_cast<uint64_t>(vec.size()));
291+
archive(cereal::binary_data(vec.data(), vec.size() * sizeof(alph_t)));
292+
}
293+
294+
template <seqan3::alphabet alph_t>
295+
requires std::is_trivially_copyable_v<alph_t>
296+
void load(cereal::BinaryInputArchive & archive, std::vector<alph_t> & vec)
297+
{
298+
uint64_t s = 0;
299+
archive(s);
300+
301+
vec.resize(s);
302+
archive(cereal::binary_data(vec.data(), s * sizeof(alph_t)));
303+
}
304+
305+
}
306+
279307
// ==========================================================================
280308
// The index
281309
// ==========================================================================

0 commit comments

Comments
 (0)