jpayne@69: // Copyright © 2015, Battelle National Biodefense Institute (BNBI); jpayne@69: // all rights reserved. Authored by: Brian Ondov, Todd Treangen, jpayne@69: // Sergey Koren, and Adam Phillippy jpayne@69: // jpayne@69: // See the LICENSE.txt file included with this software for license information. jpayne@69: jpayne@69: #ifndef HashSet_h jpayne@69: #define HashSet_h jpayne@69: jpayne@69: #include "HashList.h" jpayne@69: #include "robin_hood.h" jpayne@69: #include jpayne@69: jpayne@69: class HashSet jpayne@69: { jpayne@69: public: jpayne@69: jpayne@69: HashSet(bool use64New) : use64(use64New) {} jpayne@69: jpayne@69: int size() const {return use64 ? hashes64.size() : hashes32.size();} jpayne@69: void clear() {use64 ? hashes64.clear() : hashes32.clear();} jpayne@69: uint32_t count(hash_u hash) const; jpayne@69: void erase(hash_u hash); jpayne@69: void insert(hash_u hash, uint32_t count = 1); jpayne@69: void toHashList(HashList & hashList) const; jpayne@69: void toCounts(std::vector & counts) const; jpayne@69: jpayne@69: private: jpayne@69: jpayne@69: bool use64; jpayne@69: robin_hood::unordered_map hashes32; jpayne@69: robin_hood::unordered_map hashes64; jpayne@69: }; jpayne@69: jpayne@69: #endif