Mercurial > repos > rliterman > csp2
diff CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/mash/HashSet.h @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/mash/HashSet.h Tue Mar 18 17:55:14 2025 -0400 @@ -0,0 +1,35 @@ +// Copyright © 2015, Battelle National Biodefense Institute (BNBI); +// all rights reserved. Authored by: Brian Ondov, Todd Treangen, +// Sergey Koren, and Adam Phillippy +// +// See the LICENSE.txt file included with this software for license information. + +#ifndef HashSet_h +#define HashSet_h + +#include "HashList.h" +#include "robin_hood.h" +#include <vector> + +class HashSet +{ +public: + + HashSet(bool use64New) : use64(use64New) {} + + int size() const {return use64 ? hashes64.size() : hashes32.size();} + void clear() {use64 ? hashes64.clear() : hashes32.clear();} + uint32_t count(hash_u hash) const; + void erase(hash_u hash); + void insert(hash_u hash, uint32_t count = 1); + void toHashList(HashList & hashList) const; + void toCounts(std::vector<uint32_t> & counts) const; + +private: + + bool use64; + robin_hood::unordered_map<hash32_t, uint32_t> hashes32; + robin_hood::unordered_map<hash64_t, uint32_t> hashes64; +}; + +#endif