New wxHashTable implementation when wxUSE_STL == 1. Replaces

the old implementation based upon wxHashMap. Removed support
for wxHashTable in wxHashMap.
  Rationale: using wxHashMap for wxHashTable implementation required
special support in wxHashMap. This precluded using STL-provided
hash_map to implement wxHashMap. This new implementation does not
use keyed wxList interface and should be almost totally compatible
with the old non-STL wxHashTable.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24638 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-11-23 08:12:34 +00:00
parent ff9ca1fd6f
commit 1a6d9c7680
6 changed files with 631 additions and 268 deletions

View File

@@ -70,7 +70,6 @@ protected:
static void CopyHashTable( _wxHashTable_NodeBase** srcTable,
size_t srcBuckets, _wxHashTableBase2* dst,
_wxHashTable_NodeBase** dstTable,
size_t dstBuckets,
BucketFromNode func, ProcessNode proc );
static void** AllocTable( size_t sz )
@@ -298,19 +297,6 @@ protected: \
\
return node; \
} \
void CreateNodeLast( const value_type& value ) \
{ \
size_t bucket = m_hasher( m_getKey(value) ) % m_tableBuckets; \
Node* curr = m_table[bucket], \
* next = m_table[bucket]; \
while( next ) { curr = next; next = next->m_next(); } \
Node** ptr = curr ? (Node**)&curr->m_nxt : &m_table[bucket]; \
*ptr = new Node( value ); \
/* must be after the node is inserted */ \
++m_items; \
if( SHOULD_GROW( m_tableBuckets, m_items ) ) \
ResizeTable( m_tableBuckets ); \
} \
void CreateNode( const value_type& value ) \
{\
CreateNode(value, m_hasher( m_getKey(value) ) % m_tableBuckets ); \
@@ -358,7 +344,7 @@ protected: \
m_tableBuckets = newSize; \
\
CopyHashTable( (_wxHashTable_NodeBase**)srcTable, srcBuckets, \
this, (_wxHashTable_NodeBase**)m_table, newSize, \
this, (_wxHashTable_NodeBase**)m_table, \
(BucketFromNode)GetBucketForNode,\
(ProcessNode)&DummyProcessNode ); \
free(srcTable); \
@@ -370,7 +356,7 @@ protected: \
ResizeTable( ht.size() ); \
CopyHashTable( (_wxHashTable_NodeBase**)ht.m_table, ht.m_tableBuckets,\
(_wxHashTableBase2*)this, \
(_wxHashTable_NodeBase**)m_table, m_tableBuckets, \
(_wxHashTable_NodeBase**)m_table, \
(BucketFromNode)GetBucketForNode, \
(ProcessNode)CopyNode ); \
} \