code/Hashtable.cpp
// NOTE: This retuns hastable items in undefined order!
This retuns hastable items in undefined order!
This retuns hastable items in undefined order!
HashtableIterator* Hashtable::GetIterator() {
   HashItem* item = NULL;
   HashtableIterator* first = NULL;
   HashtableIterator* last = NULL;
   for (uint32 slot = 0; slot < size; slot++) {
       item = table + slot;
       while (item && item->index != HASH_ITEM_UNINITIALIZED) {
           if (!first) {
               first = &item->iterator;
               first->prev = NULL;
               first->next = NULL;
               last = first;
           }
           else {
               last->next = &item->iterator;
               item->iterator.prev = last;
               item->iterator.next = NULL;
               last = &item->iterator;
           }
           item = item->next;
       };
   }
   return first;
}
HashtableIterator * Hashtable :: GetIterator ( ) { HashItem * item = NULL ; HashtableIterator * first = NULL ; HashtableIterator * last = NULL ; for ( uint32 slot = 0 ; slot < size ; slot ++ ) { item = table + slot ; while ( item && item -> index != HASH_ITEM_UNINITIALIZED ) { if ( ! first ) { first = & item -> iterator ; first -> prev = NULL ; first -> next = NULL ; last = first ; } else { last -> next = & item -> iterator ; item -> iterator . prev = last ; item -> iterator . next = NULL ; last = & item -> iterator ; } item = item -> next ; } ; } return first ; }
NOTE: This retuns hastable items in undefined order!
NOTE : This retuns hastable items in undefined order!
// First iterator item // Chain iterator