A hash table mapping vertices to vertex properties. */
| 24 | |
| 25 | /** A hash table mapping vertices to vertex properties. */ |
| 26 | class SequenceCollectionHash |
| 27 | { |
| 28 | public: |
| 29 | typedef SequenceDataHash::key_type key_type; |
| 30 | typedef SequenceDataHash::mapped_type mapped_type; |
| 31 | typedef SequenceDataHash::value_type value_type; |
| 32 | typedef SequenceDataHash::iterator iterator; |
| 33 | typedef SequenceDataHash::const_iterator const_iterator; |
| 34 | |
| 35 | typedef mapped_type::Symbol Symbol; |
| 36 | typedef mapped_type::SymbolSet SymbolSet; |
| 37 | typedef mapped_type::SymbolSetPair SymbolSetPair; |
| 38 | |
| 39 | typedef key_type vertex_descriptor; |
| 40 | typedef mapped_type vertex_bundled; |
| 41 | typedef std::pair<key_type, key_type> edge_descriptor; |
| 42 | |
| 43 | /** Remove the specified sequence if it exists. */ |
| 44 | void remove(const key_type& seq) |
| 45 | { |
| 46 | setFlag(seq, SF_DELETE); |
| 47 | } |
| 48 | |
| 49 | /** Shrink the hash table. */ |
| 50 | void shrink() { |
| 51 | m_data.rehash(0); |
| 52 | printLoad(); |
| 53 | } |
| 54 | |
| 55 | /** Return the data associated with the specified key. */ |
| 56 | const mapped_type operator[](const key_type& key) const |
| 57 | { |
| 58 | bool rc; |
| 59 | const_iterator it = find(key, rc); |
| 60 | assert(it != m_data.end()); |
| 61 | return rc ? ~it->second : it->second; |
| 62 | } |
| 63 | |
| 64 | iterator begin() { return m_data.begin(); } |
| 65 | const_iterator begin() const { return m_data.begin(); } |
| 66 | iterator end() { return m_data.end(); } |
| 67 | const_iterator end() const { return m_data.end(); } |
| 68 | |
| 69 | /** Return true if this collection is empty. */ |
| 70 | bool empty() const { return m_data.empty(); } |
| 71 | |
| 72 | /** Return the number of sequences in this collection. */ |
| 73 | size_t size() const { return m_data.size(); } |
| 74 | |
| 75 | // Not a network sequence collection. Nothing to do. |
| 76 | size_t pumpNetwork() { return 0; } |
| 77 | |
| 78 | /** The observer callback function. */ |
| 79 | typedef void (*SeqObserver)(SequenceCollectionHash* c, |
| 80 | const value_type& seq); |
| 81 | |
| 82 | /** Attach the specified observer. */ |
| 83 | void attach(SeqObserver f) |