diff --git a/include/hibf/sketch/hyperloglog.hpp b/include/hibf/sketch/hyperloglog.hpp index af3f303a..32a1199c 100644 --- a/include/hibf/sketch/hyperloglog.hpp +++ b/include/hibf/sketch/hyperloglog.hpp @@ -17,6 +17,9 @@ #include // for istream, ostream #include // for vector +#include +#include + #include // for aligned_allocator #include @@ -125,6 +128,21 @@ class hyperloglog double normalization_factor{}; //!\brief Internal data. Also called register in publications. std::vector> data{}; + + friend class cereal::access; + + template + void serialize(archive_t & archive) + { + uint32_t version{1}; + archive(CEREAL_NVP(version)); + + archive(CEREAL_NVP(bits)); + archive(CEREAL_NVP(size)); + archive(CEREAL_NVP(rank_mask)); + archive(CEREAL_NVP(normalization_factor)); + archive(CEREAL_NVP(data)); + } }; } // namespace seqan::hibf::sketch diff --git a/include/hibf/sketch/minhashes.hpp b/include/hibf/sketch/minhashes.hpp index fe3ce30c..f1227203 100644 --- a/include/hibf/sketch/minhashes.hpp +++ b/include/hibf/sketch/minhashes.hpp @@ -14,6 +14,8 @@ #include // for span #include // for vector +#include + #include namespace seqan::hibf::sketch @@ -59,6 +61,19 @@ struct minhashes //!\brief Pushes `value` to the heap if it is smaller than the current largest element. static void push_to_heap_if_smaller(uint64_t const value, std::vector & heap); + +private: + friend class cereal::access; + + template + void serialize(archive_t & archive) + { + uint32_t version{1}; + archive(CEREAL_NVP(version)); + + // other members are const static currently + archive(CEREAL_NVP(table)); + } }; } // namespace seqan::hibf::sketch