Mercurial > repos > rliterman > csp2
annotate 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 |
rev | line source |
---|---|
jpayne@69 | 1 // Copyright © 2015, Battelle National Biodefense Institute (BNBI); |
jpayne@69 | 2 // all rights reserved. Authored by: Brian Ondov, Todd Treangen, |
jpayne@69 | 3 // Sergey Koren, and Adam Phillippy |
jpayne@69 | 4 // |
jpayne@69 | 5 // See the LICENSE.txt file included with this software for license information. |
jpayne@69 | 6 |
jpayne@69 | 7 #ifndef HashSet_h |
jpayne@69 | 8 #define HashSet_h |
jpayne@69 | 9 |
jpayne@69 | 10 #include "HashList.h" |
jpayne@69 | 11 #include "robin_hood.h" |
jpayne@69 | 12 #include <vector> |
jpayne@69 | 13 |
jpayne@69 | 14 class HashSet |
jpayne@69 | 15 { |
jpayne@69 | 16 public: |
jpayne@69 | 17 |
jpayne@69 | 18 HashSet(bool use64New) : use64(use64New) {} |
jpayne@69 | 19 |
jpayne@69 | 20 int size() const {return use64 ? hashes64.size() : hashes32.size();} |
jpayne@69 | 21 void clear() {use64 ? hashes64.clear() : hashes32.clear();} |
jpayne@69 | 22 uint32_t count(hash_u hash) const; |
jpayne@69 | 23 void erase(hash_u hash); |
jpayne@69 | 24 void insert(hash_u hash, uint32_t count = 1); |
jpayne@69 | 25 void toHashList(HashList & hashList) const; |
jpayne@69 | 26 void toCounts(std::vector<uint32_t> & counts) const; |
jpayne@69 | 27 |
jpayne@69 | 28 private: |
jpayne@69 | 29 |
jpayne@69 | 30 bool use64; |
jpayne@69 | 31 robin_hood::unordered_map<hash32_t, uint32_t> hashes32; |
jpayne@69 | 32 robin_hood::unordered_map<hash64_t, uint32_t> hashes64; |
jpayne@69 | 33 }; |
jpayne@69 | 34 |
jpayne@69 | 35 #endif |