diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-12-25 07:54:25 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-12-25 07:54:25 +0000 |
commit | 333eb3d4ebae95aea4304c764e4e4a57666ae7c2 (patch) | |
tree | e3086ca4c45b07a9dccafa4e840c80030aaae426 | |
parent | 0436358ca2ea98018524869a29021406e6762c3c (diff) | |
download | ATCD-333eb3d4ebae95aea4304c764e4e4a57666ae7c2.tar.gz |
*** empty log message ***
-rw-r--r-- | ChangeLog-98b | 116 | ||||
-rw-r--r-- | ace/ACE.cpp | 34 | ||||
-rw-r--r-- | ace/ACE.h | 16 | ||||
-rw-r--r-- | ace/Filecache.cpp | 24 | ||||
-rw-r--r-- | ace/Hash_Map_Manager.cpp | 865 | ||||
-rw-r--r-- | ace/Hash_Map_Manager.h | 605 | ||||
-rw-r--r-- | ace/Hash_Map_Manager.i | 135 | ||||
-rw-r--r-- | ace/Hash_Map_Manager_T.cpp | 380 | ||||
-rw-r--r-- | ace/Hash_Map_Manager_T.h | 586 | ||||
-rw-r--r-- | ace/Hash_Map_Manager_T.i | 565 | ||||
-rw-r--r-- | ace/Local_Name_Space.cpp | 26 | ||||
-rw-r--r-- | ace/Makefile | 3 | ||||
-rw-r--r-- | ace/OS.h | 13 | ||||
-rw-r--r-- | ace/OS.i | 71 | ||||
-rw-r--r-- | ace/README | 3 | ||||
-rw-r--r-- | ace/SString.cpp | 6 | ||||
-rw-r--r-- | ace/Template_Instantiations.cpp | 55 | ||||
-rw-r--r-- | ace/ace_dll.dsp | 81 | ||||
-rw-r--r-- | ace/ace_lib.dsp | 378 | ||||
-rw-r--r-- | ace/config-win32-common.h | 1 | ||||
-rw-r--r-- | tests/Conn_Test.cpp | 24 | ||||
-rw-r--r-- | tests/Hash_Map_Manager_Test.cpp | 184 | ||||
-rw-r--r-- | tests/Hash_Map_Manager_Test.h | 60 | ||||
-rw-r--r-- | tests/Map_Manager_Test.cpp | 65 |
24 files changed, 2514 insertions, 1782 deletions
diff --git a/ChangeLog-98b b/ChangeLog-98b index 0cdad9f7028..1dc595ae799 100644 --- a/ChangeLog-98b +++ b/ChangeLog-98b @@ -1,3 +1,119 @@ +Thu Dec 24 03:14:25 1998 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/Hash_Map_Manager: There are two problems with the current + implementation of Hash_Map_Manager: + + (a) It requires a hash() method on the key type. If it is not + possible for the key type to have a hash() function (e.g., + the key is a primitive type such as an int, or is a pointer + type, or a three party class), the usual solution is to do + partial template specialization. + + This is usually not a very good option since some compilers + do not support partial template specialization. + + (b) The second problem is with comparing two keys. + Hash_Map_Manager assumes that keys can be compared using + operator==. This assumption causes problems in some cases, + e.g., when using char * as the key. Usually with char *, + you want to use strcmp and not compare pointers. + + Solution to these two problems is the new Hash_Map_Manager_Ex + class. Problem (a) is addressed by using a function object - the + type of which is specified by the user as an additional template + parameter. Problem (b) is addressed by using another function + object - the type of which is specified by the user as an + additional template parameter. So the new Hash_Map_Manager_Ex + takes five template parameters: + + <key, value, hash_key, compare_keys, mutex> + + Backward compatibility: Hash_Map_Manager now inherits from + Hash_Map_Manager_Ex, fixing the hash_key function object (which + simply calls key.hash()) and fixing compare_keys (which simply + uses operator== on the keys). + + There will be one problem: Users of compilers that do not + implicitly instantiate templates will have to update their list + of template instantiations. To help with this, please see + $ACE_ROOT/bin/Hash_Map_Manager_Helper.csh + + Other miscellaneous changes: Added two new classes: ACE_Hash<T> + and ACE_Equal_To<T>. ACE_Hash assumes a hash() method on T. + ACE_Equal_To compares by using operator==. However, the + ACE_Hash class has been specialized to work with: + + char, signed char, unsigned char, + short, unsigned short, + int, unsigned int, + long, unsigned long, + const char *, char *, + const wchar_t *, wchar_t *, + const ACE_USHORT16 *, ACE_USHORT16 *, + + Also, ACE_Equal_To has been specialized to work with: + + const char *, char *, + const wchar_t *, wchar_t *, + const ACE_USHORT16 *, ACE_USHORT16 *, + + Remember, you don't have to use these specialization. You can + always create your own. + + If we had default template parameters, we could default hash_key + to ACE_Hash<key> and compare_keys could default to + ACE_Equal_To<key>. + + BTW, note that the specialization with ACE_Hash and ACE_Equal_To + is not partial template specialization. It is complete template + specialization, and we don't know of compilers that cannot + handle complete template specialization. + + Since we now have template specialization, Hash_Map_Manager_T.* + files were created. I also took this opportunity to inline most + of the Hash_Map_Manager functions. + + Also, update the makefiles and project files. + + BTW, these changes grossly simplified + tests/Hash_Map_Manager_Test.cpp and tests/Map_Manager_Test.cpp. + These tests will now work with compilers that do not support + partial template specialization. Maybe James can change + Filecache to take advantage of these changes. + + Updated the following files with the new template instantiations: + + ace/Filecache.cpp + ace/Local_Name_Space.cpp + ace/Template_Instantiations.cpp + tests/Conn_Test.cpp + tests/Hash_Map_Manager_Test.cpp + tests/Map_Manager_Test.cpp + + Thanks to Carlos for suggesting these changes. Most of these + were inspired by SGI's STL. + + If these changes are successful (i.e., nobody is hunting me down + for breaking their code ;-)), we should add a similar comparison + function object to Map_Manager. + + * ace/ACE (hash_pjw): hash_pjw is now available for char *, + wchar_t *, and ACE_UINT16 *. + + * ace/OS (strlen, strcpy, strcmp): These functions are now + available for char *, wchar_t *, and ACE_UINT16 *. + + * ace/SString.cpp (ACE_WString::strlen): Simply calls + ACE_OS::strlen. + + * ace/config-win32-common.h (ACE_HAS_WCHAR_TYPEDEFS_USHORT): Since + Win32 typedefs wchar_t as a 16 bit unsigned short, this can + potentially cause problems with function overloading. + Therefore, I added ACE_HAS_WCHAR_TYPEDEFS_USHORT to the Win32 + config file. This is very similar to + ACE_HAS_WCHAR_TYPEDEFS_CHAR. Thanks to David Levine for helping + with this. + Thu Dec 24 09:37:32 1998 Douglas C. Schmidt <schmidt@cs.wustl.edu> * ACE version 4.6.8 released. diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 4f434f5d537..2a8bcd4b47e 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -360,6 +360,37 @@ ACE::hash_pjw (const char *str) return ACE::hash_pjw (str, ACE_OS::strlen (str)); } +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR) +u_long +ACE::hash_pjw (const wchar_t *str, size_t len) +{ + u_long hash = 0; + + for (size_t i = 0; i < len; i++) + { + const wchar_t temp = str[i]; + hash = (hash << 4) + (temp * 13); + + u_long g = hash & 0xf0000000; + + if (g) + { + hash ^= (g >> 24); + hash ^= g; + } + } + + return hash; +} + +u_long +ACE::hash_pjw (const wchar_t *str) +{ + return ACE::hash_pjw (str, ACE_OS::strlen (str)); +} +#endif /* ACE_HAS_WCHAR_TYPEDEFS_CHAR */ + +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT) u_long ACE::hash_pjw (const ACE_USHORT16 *str, size_t len) { @@ -385,8 +416,9 @@ ACE::hash_pjw (const ACE_USHORT16 *str, size_t len) u_long ACE::hash_pjw (const ACE_USHORT16 *str) { - return ACE::hash_pjw (str, ACE_WString::strlen (str)); + return ACE::hash_pjw (str, ACE_OS::strlen (str)); } +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */ // The CRC routine was taken from the FreeBSD implementation of cksum, // that falls under the following license: diff --git a/ace/ACE.h b/ace/ACE.h index 2b089ca2808..a1094bfc395 100644 --- a/ace/ACE.h +++ b/ace/ACE.h @@ -565,13 +565,21 @@ public: static u_long hash_pjw (const char *str, size_t len); // Computes the hash value of <str> using the ``Hash PJW'' routine. +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR) + static u_long hash_pjw (const wchar_t *str); + // Computes the hash value of <str> using the ``Hash PJW'' routine. + + static u_long hash_pjw (const wchar_t *str, size_t len); + // Computes the hash value of <str> using the ``Hash PJW'' routine. +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */ + +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT) static u_long hash_pjw (const ACE_USHORT16 *str); - // Computes the hash value of <str> using the ``Hash PJW'' routine - // (works for UNICODE strings). + // Computes the hash value of <str> using the ``Hash PJW'' routine. static u_long hash_pjw (const ACE_USHORT16 *str, size_t len); - // Computes the hash value of <str> using the ``Hash PJW'' routine - // (works for UNICODE strings). + // Computes the hash value of <str> using the ``Hash PJW'' routine. +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */ static u_long crc32 (const char *str); // Computes the ISO 8802-3 standard 32 bits CRC for the string diff --git a/ace/Filecache.cpp b/ace/Filecache.cpp index 01b1c389ca8..035e14eb932 100644 --- a/ace/Filecache.cpp +++ b/ace/Filecache.cpp @@ -675,28 +675,44 @@ ACE_Filecache_Object::update (void) const template class ACE_Hash_Map_Entry<const char *, ACE_Filecache_Object *>; template class ACE_Hash_Map_Manager<const char *, ACE_Filecache_Object *, ACE_Null_Mutex>; template class ACE_Hash_Map_Iterator<const char *, ACE_Filecache_Object *, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base<const char *, ACE_Filecache_Object *, ACE_Null_Mutex>; template class ACE_Hash_Map_Reverse_Iterator<const char *, ACE_Filecache_Object *, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; #else template class ACE_Hash_Map_Entry<ACE_CString, ACE_Filecache_Object *>; +template class ACE_Hash<ACE_CString>; +template class ACE_Equal_To<ACE_CString>; template class ACE_Hash_Map_Manager<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex>; template class ACE_Hash_Map_Iterator<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex>; template class ACE_Hash_Map_Reverse_Iterator<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; #endif /* ACE_HAS_TEMPLATE_SPECIALIZATION */ #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #if defined (ACE_HAS_TEMPLATE_SPECIALIZATION) #pragma instantiate ACE_Hash_Map_Entry<const char *, ACE_Filecache_Object *> #pragma instantiate ACE_Hash_Map_Manager<const char *, ACE_Filecache_Object *, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Iterator<const char *, ACE_Filecache_Object *, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base<const char *, ACE_Filecache_Object *, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Reverse_Iterator<const char *, ACE_Filecache_Object *, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> #else #pragma instantiate ACE_Hash_Map_Entry<ACE_CString, ACE_Filecache_Object *> +#pragma instantiate ACE_Hash<ACE_CString> +#pragma instantiate ACE_Equal_To<ACE_CString> #pragma instantiate ACE_Hash_Map_Manager<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Iterator<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Reverse_Iterator<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> #endif /* ACE_HAS_TEMPLATE_SPECIALIZATION */ #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/ace/Hash_Map_Manager.cpp b/ace/Hash_Map_Manager.cpp index ddd56223807..94353bcc055 100644 --- a/ace/Hash_Map_Manager.cpp +++ b/ace/Hash_Map_Manager.cpp @@ -13,870 +13,13 @@ // // ============================================================================ -#ifndef ACE_HASH_MAP_MANAGER_C -#define ACE_HASH_MAP_MANAGER_C +#define ACE_BUILD_DLL #include "ace/Hash_Map_Manager.h" -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Service_Config.h" -#include "ace/Malloc.h" - ACE_RCSID(ace, Hash_Map_Manager, "$Id$") -template <class EXT_ID, class INT_ID> -ACE_Hash_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Map_Entry (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev) - : next_ (next), - prev_ (prev) -{ -} - -template <class EXT_ID, class INT_ID> -ACE_Hash_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Map_Entry (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev) - : ext_id_ (ext_id), - int_id_ (int_id), - next_ (next), - prev_ (prev) -{ -} - -# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) -template <class EXT_ID, class INT_ID> -ACE_Hash_Map_Entry<EXT_ID, INT_ID>::~ACE_Hash_Map_Entry (void) -{ -} -# endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ - -template <class EXT_ID, class INT_ID> void -ACE_Hash_Map_Entry<EXT_ID, INT_ID>::dump (void) const -{ - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("next_ = %d"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("prev_ = %d"), this->prev_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> void -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::dump (void) const -{ - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("total_size_ = %d"), this->total_size_)); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\ncur_size_ = %d"), this->cur_size_)); - this->allocator_->dump (); - this->lock_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::create_buckets (size_t size) -{ - size_t bytes = size * sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>); - void *ptr; - - ACE_ALLOCATOR_RETURN (ptr, - this->allocator_->malloc (bytes), - -1); - - this->table_ = (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *) ptr; - - this->total_size_ = size; - - // Initialize each entry in the hash table to be a circular linked - // list with the dummy node in the front serving as the anchor of - // the list. - for (size_t i = 0; i < size; i++) - new (&this->table_[i]) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (&this->table_[i], - &this->table_[i]); - return 0; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::open (size_t size, - ACE_Allocator *alloc) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - if (alloc == 0) - alloc = ACE_Allocator::instance (); - - this->allocator_ = alloc; - - // This assertion is here to help track a situation that shouldn't - // happen, but did with Sun C++ 4.1 (before a change to this class - // was made: it used to have an enum that was supposed to be defined - // to be ACE_DEFAULT_MAP_SIZE, but instead was defined to be 0). - ACE_ASSERT (size != 0); - - // Calling this->close_i () to ensure we release previous allocated - // memory before allocating new one. - this->close_i (); - - return this->create_buckets (size); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Manager (size_t size, - ACE_Allocator *alloc) - : allocator_ (alloc), - table_ (0), - total_size_ (0), - cur_size_ (0) -{ - if (this->open (size, alloc) == -1) - ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_Hash_Map_Manager\n"))); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Manager (ACE_Allocator *alloc) - : allocator_ (alloc), - table_ (0), - total_size_ (0), - cur_size_ (0) -{ - if (this->open (ACE_DEFAULT_MAP_SIZE, alloc) == -1) - ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_Hash_Map_Manager\n"))); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::close_i (void) -{ - // Protect against "double-deletion" in case the destructor also - // gets called. - if (this->table_ != 0) - { - // Iterate through the entire map calling the destuctor of each - // <ACE_Hash_Map_Entry>. - for (size_t i = 0; i < this->total_size_; i++) - { - for (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp_ptr = this->table_[i].next_; - temp_ptr != &this->table_[i]; - ) - { - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *hold_ptr = temp_ptr; - temp_ptr = temp_ptr->next_; - - // Explicitly call the destructor. - ACE_DES_FREE_TEMPLATE2 (hold_ptr, this->allocator_->free, - ACE_Hash_Map_Entry, EXT_ID, INT_ID); - } - - // Destroy the dummy entry. - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry = &table_[i]; - // The "if" second argument results in a no-op instead of - // deallocation. - ACE_DES_FREE_TEMPLATE2 (entry, ACE_NOOP, - ACE_Hash_Map_Entry, EXT_ID, INT_ID); - } - - // Free table memory. - this->allocator_->free (this->table_); - this->cur_size_ = 0; - this->total_size_ = 0; - // Should be done last... - this->table_ = 0; - } - return 0; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::close (void) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->close_i (); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::~ACE_Hash_Map_Manager (void) -{ - this->close (); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> size_t -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::current_size (void) -{ - return this->cur_size_; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> size_t -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::total_size (void) -{ - return this->total_size_; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_LOCK & -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::mutex (void) -{ - ACE_TRACE ("ACE_Hash_Map_Manager::mutex"); - return this->lock_; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> u_long -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::hash (const EXT_ID &ext_id) -{ - return ext_id.hash (); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::equal (const EXT_ID &id1, - const EXT_ID &id2) -{ - return id1 == id2; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::bind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) -{ - u_long loc; - int result = this->shared_find (ext_id, entry, loc); - - if (result == -1) - { - void *ptr; - // Not found. - ACE_ALLOCATOR_RETURN (ptr, - this->allocator_->malloc (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)), - -1); - - entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (ext_id, - int_id, - this->table_[loc].next_, - &this->table_[loc]); - this->table_[loc].next_ = entry; - entry->next_->prev_ = entry; - this->cur_size_++; - return 0; - } - else - return 1; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::bind_i (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp; - - return this->bind_i (ext_id, int_id, temp); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::bind (const EXT_ID &ext_id, - const INT_ID &int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->bind_i (ext_id, int_id); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::bind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->bind_i (ext_id, int_id, entry); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::trybind_i (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) -{ - u_long loc; - int result = this->shared_find (ext_id, entry, loc); - - if (result == -1) - { - // Not found. - void *ptr; - ACE_ALLOCATOR_RETURN (ptr, - this->allocator_->malloc (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)), - -1); - - entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (ext_id, - int_id, - this->table_[loc].next_, - &this->table_[loc]); - this->table_[loc].next_ = entry; - entry->next_->prev_ = entry; - this->cur_size_++; - return 0; - } - else - return 1; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::trybind_i (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp; - - int result = this->trybind_i (ext_id, int_id, temp); - if (result == 1) - int_id = temp->int_id_; - return result; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::trybind (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->trybind_i (ext_id, int_id); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::trybind (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->trybind_i (ext_id, int_id, entry); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind_i (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp; - - u_long loc; - int result = this->shared_find (ext_id, temp, loc); - - if (result == -1) - { - errno = ENOENT; - return -1; - } - - int_id = temp->int_id_; - - return this->unbind_i (temp); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind_i (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry) -{ - entry->next_->prev_ = entry->prev_; - entry->prev_->next_ = entry->next_; - - // Explicitly call the destructor. - ACE_DES_FREE_TEMPLATE2 (entry, this->allocator_->free, - ACE_Hash_Map_Entry, EXT_ID, INT_ID); - this->cur_size_--; - return 0; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind_i (const EXT_ID &ext_id) -{ - INT_ID int_id; - - return this->unbind_i (ext_id, int_id); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_i (ext_id, int_id); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind (const EXT_ID &ext_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_i (ext_id) == -1 ? -1 : 0; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::unbind (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->unbind_i (entry) == -1 ? -1 : 0; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::shared_find (const EXT_ID &ext_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry, - u_long &loc) -{ - loc = this->hash (ext_id) % this->total_size_; - - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp = this->table_[loc].next_; - - while (temp != &this->table_[loc] && this->equal (temp->ext_id_, ext_id) == 0) - temp = temp->next_; - - if (temp == &this->table_[loc]) - { - errno = ENOENT; - return -1; - } - else - { - entry = temp; - return 0; - } -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::find_i (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry; - - u_long dummy; - if (this->shared_find (ext_id, entry, dummy) == -1) - return -1; - else - { - int_id = entry->int_id_; - return 0; - } -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::find_i (const EXT_ID &ext_id) -{ - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry; - - u_long dummy; - return this->shared_find (ext_id, entry, dummy); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::find (const EXT_ID &ext_id, - INT_ID &int_id) -{ - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->find_i (ext_id, int_id); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::find (const EXT_ID &ext_id) -{ - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->find_i (ext_id); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::find_i (const EXT_ID &ext_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) -{ - u_long dummy; - return this->shared_find (ext_id, entry, dummy); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::find (const EXT_ID &ext_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) -{ - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->find_i (ext_id, entry); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) -{ - u_long dummy; - if (this->shared_find (ext_id, entry, dummy) == -1) - return this->bind_i (ext_id, int_id); - else - { - old_ext_id = entry->ext_id_; - old_int_id = entry->int_id_; - entry->ext_id_ = ext_id; - entry->int_id_ = int_id; - return 1; - } -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id) -{ - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node; - - return this->rebind_i (ext_id, - int_id, - old_ext_id, - old_int_id, - node); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) -{ - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id, entry); -} - -// ------------------------------------------------------------ -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::begin (void) -{ - return ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> (*this); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::end (void) -{ - return ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> (*this, 1); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rbegin (void) -{ - return ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> (*this); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rend (void) -{ - return ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> (*this, 1); -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Iterator_Base) - -template <class EXT_ID, class INT_ID, class ACE_LOCK> void -ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::dump_i (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("index_ = %d "), this->index_)); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("next_ = %x"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Iterator_Base (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, - int head) - : map_man_ (&mm), - index_ (head != 0 ? -1 : ACE_static_cast (ssize_t, mm.total_size_)), - next_ (0) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Iterator_Base"); - - if (mm.table_ != 0) - this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1]; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::next"); - - if (this->map_man_->table_ != 0 - && this->index_ < ACE_static_cast (ssize_t, this->map_man_->total_size_) - && this->index_ >= 0 - && this->next_ != &this->map_man_->table_[this->index_]) - { - entry = this->next_; - return 1; - } - else - return 0; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::done (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::done"); - - return this->map_man_->table_ == 0 - || this->index_ >= ACE_static_cast (ssize_t, this->map_man_->total_size_) - || this->index_ < 0; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::forward_i (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::forward_i"); - - if (this->map_man_->table_ == 0) - return -1; - // Handle initial case specially. - else if (this->index_ == -1) - { - this->index_++; - return this->forward_i (); - } - else if (this->index_ >= ACE_static_cast (ssize_t, this->map_man_->total_size_)) - return 0; - - this->next_ = this->next_->next_; - if (this->next_ == &this->map_man_->table_[this->index_]) - { - while (++this->index_ < ACE_static_cast (ssize_t, - this->map_man_->total_size_)) - { - this->next_ = this->map_man_->table_[this->index_].next_; - if (this->next_ != &this->map_man_->table_[this->index_]) - break; - } - } - - return this->index_ < ACE_static_cast (ssize_t, this->map_man_->total_size_); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::reverse_i (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::reverse_i"); - - if (this->map_man_->table_ == 0) - return -1; - else if (this->index_ == ACE_static_cast (ssize_t, this->map_man_->total_size_)) - { - this->index_--; - return this->reverse_i (); - } - else if (this->index_ < 0) - return 0; - - this->next_ = this->next_->prev_; - if (this->next_ == &this->map_man_->table_[this->index_]) - { - while (--this->index_ >= 0) - { - this->next_ = this->map_man_->table_[this->index_].prev_; - if (this->next_ != &this->map_man_->table_[this->index_]) - break; - } - } - - return this->index_ >= 0; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Entry<EXT_ID, INT_ID> & -ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator* (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator*"); - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *retv = 0; - -# if !defined (ACE_NDEBUG) - int result = -# endif /* ACE_NDEBUG */ - this->next (retv); - - ACE_ASSERT (result != 0); - return *retv; -} - -// Returns the reference to the hash_map_manager that is being -// iterated over. -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>& -ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::map (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::map"); - return *this->map_man_; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator== (const ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &rhs) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator=="); - return this->map_man_ == rhs.map_man_ - && this->index_ == rhs.index_ - && this->next_ == rhs.next_; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator!= (const ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &rhs) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator!="); - return this->next_ != rhs.next_ - || this->index_ != rhs.index_ - || this->map_man_ != rhs.map_man_; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Iterator) - -template <class EXT_ID, class INT_ID, class ACE_LOCK> void -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::dump (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::dump"); - - this->dump_i (); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, - int tail) - : ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> (mm, - tail == 0 ? 1 : 0) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Iterator"); - if (tail == 0) - this->forward_i (); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::advance (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::advance"); - return this->forward_i (); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> & -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (void)"); - - this->forward_i (); - return *this; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (int)"); - - ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> retv (*this); - this->forward_i (); - return retv; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> & -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (void)"); - - this->reverse_i (); - return *this; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> -ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (int)"); - - ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> retv (*this); - this->reverse_i (); - return retv; -} - -ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Reverse_Iterator) - -template <class EXT_ID, class INT_ID, class ACE_LOCK> void -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::dump (void) const -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::dump"); - - this->dump_i (); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, int head) - : ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> (mm, head) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator"); - if (head == 0) - this->reverse_i (); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> int -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::advance (void) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::advance"); - return this->reverse_i (); -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> & -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (void) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (void)"); - - this->reverse_i (); - return *this; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (int) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator++ (int)"); - - ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> retv (*this); - this->reverse_i (); - return retv; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> & -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (void) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (void)"); - - this->forward_i (); - return *this; -} - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> -ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (int) -{ - ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (int)"); - - ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> retv (*this); - this->forward_i (); - return retv; -} +#if !defined (__ACE_INLINE__) +#include "ace/Hash_Map_Manager.i" +#endif /* __ACE_INLINE__ */ -#endif /* ACE_HASH_MAP_MANAGER_C */ diff --git a/ace/Hash_Map_Manager.h b/ace/Hash_Map_Manager.h index 0c3ba0c47ce..e7f2bc612eb 100644 --- a/ace/Hash_Map_Manager.h +++ b/ace/Hash_Map_Manager.h @@ -23,481 +23,220 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Synch.h" +// Forward declaration since we are going to specialize that template +// here. The template itself requires this file so every user of the +// template should also see the specialization. +template <class TYPE> class ACE_Hash; +template <class TYPE> class ACE_Equal_To; -class ACE_Allocator; - -template <class EXT_ID, class INT_ID> -class ACE_Hash_Map_Entry +class ACE_Export ACE_Hash<char> { // = TITLE - // Define an entry in the hash table. + // Function object for hashing a char public: - // = Initialization and termination methods. - ACE_Hash_Map_Entry (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next = 0, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev = 0); - // Constructor. - - ACE_Hash_Map_Entry (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev); - // Constructor. - -# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) - ~ACE_Hash_Map_Entry (void); - // Destructor. -#endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ - - EXT_ID ext_id_; - // Key used to look up an entry. - - INT_ID int_id_; - // The contents of the entry itself. - - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next_; - // Pointer to the next item in the bucket of overflow nodes. - - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev_; - // Pointer to the prev item in the bucket of overflow nodes. - - void dump (void) const; - // Dump the state of an object. + u_long operator () (char t) const; + // Simply returns t }; -// Forward decl. -template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Iterator_Base; - -// Forward decl. -template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Iterator; - -// Forward decl. -template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Reverse_Iterator; - -template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Manager +class ACE_Export ACE_Hash<signed char> { // = TITLE - // Define a map abstraction that efficiently associates - // <EXT_ID>s with <INT_ID>s. - // - // = DESCRIPTION - // This implementation of a map uses a hash table. Therefore, - // this class expects that the <EXT_ID> contains a method called - // <hash>. In addition, the <EXT_ID> must support <operator==>. - // Both of these constraints can be alleviated via template - // specialization, as shown in the $ACE_ROOT/tests/Conn_Test.cpp - // test. - // - // This class uses an <ACE_Allocator> to allocate memory. The - // user can make this a persistent class by providing an - // <ACE_Allocator> with a persistable memory pool. + // Function object for hashing a signed char public: - friend class ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>; - friend class ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>; - friend class ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>; - - typedef EXT_ID KEY; - typedef INT_ID VALUE; - typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID> - ENTRY; - typedef ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> - ITERATOR; - typedef ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> - REVERSE_ITERATOR; - // = STL-style iterator typedefs. - typedef ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> - iterator; - typedef ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> - reverse_iterator; - - // = Initialization and termination methods. - - ACE_Hash_Map_Manager (ACE_Allocator *alloc = 0); - // Initialize a <Hash_Map_Manager> with default size. - - ACE_Hash_Map_Manager (size_t size, - ACE_Allocator *alloc = 0); - // Initialize a <Hash_Map_Manager> with size <length>. - - int open (size_t size = ACE_DEFAULT_MAP_SIZE, - ACE_Allocator *alloc = 0); - // Initialize a <Hash_Map_Manager> with <size> elements. - - int close (void); - // Close down a <Hash_Map_Manager> and release dynamically allocated - // resources. - - ~ACE_Hash_Map_Manager (void); - // Initialize a <Hash_Map_Manager> with size <length>. - - int bind (const EXT_ID &item, - const INT_ID &int_id); - // Associate <ext_id> with <int_id>. If <ext_id> is already in the - // map then the <ACE_Hash_Map_Entry> is not changed. Returns 0 if a - // new entry is bound successfully, returns 1 if an attempt is made - // to bind an existing entry, and returns -1 if failures occur. - - int bind (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); - // Same as a normal bind, except the map entry is also passed back - // to the caller. The entry in this case will either be the newly - // created entry, or the existing one. - - int trybind (const EXT_ID &ext_id, - INT_ID &int_id); - // Associate <ext_id> with <int_id> if and only if <ext_id> is not - // in the map. If <ext_id> is already in the map then the <int_id> - // parameter is assigned the existing value in the map. Returns 0 - // if a new entry is bound successfully, returns 1 if an attempt is - // made to bind an existing entry, and returns -1 if failures occur. - - int trybind (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); - // Same as a normal trybind, except the map entry is also passed - // back to the caller. The entry in this case will either be the - // newly created entry, or the existing one. - - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id); - // Associate <ext_id> with <int_id>. If <ext_id> is not in the map - // then behaves just like <bind>. Otherwise, store the old values - // of <ext_id> and <int_id> into the "out" parameters and rebind the - // new parameters. This is very useful if you need to have an - // atomic way of updating <ACE_Hash_Map_Entrys> and you also need full - // control over memory allocation. Returns 0 if a new entry is - // bound successfully, returns 1 if an existing entry was rebound, - // and returns -1 if failures occur. - - int rebind (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); - // Same as a normal rebind, except the map entry is also passed back - // to the caller. The entry in this case will either be the newly - // created entry, or the existing one. - - int find (const EXT_ID &ext_id, - INT_ID &int_id); - // Locate <ext_id> and pass out parameter via <int_id>. If found, - // return 0, returns -1 if not found. - - int find (const EXT_ID &ext_id); - // Returns 0 if the <ext_id> is in the mapping, otherwise -1. - - int find (const EXT_ID &ext_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); - // Locate <ext_id> and pass out parameter via <entry>. If found, - // return 0, returns -1 if not found. - - int unbind (const EXT_ID &ext_id); - // Unbind (remove) the <ext_id> from the map. Don't return the - // <int_id> to the caller (this is useful for collections where the - // <int_id>s are *not* dynamically allocated...) - - int unbind (const EXT_ID &ext_id, - INT_ID &int_id); - // Break any association of <ext_id>. Returns the value of <int_id> - // in case the caller needs to deallocate memory. - - int unbind (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry); - // Remove entry from map. - - size_t current_size (void); - // Return the current size of the map. - - size_t total_size (void); - // Return the total size of the map. - - ACE_LOCK &mutex (void); - // Returns a reference to the underlying <ACE_LOCK>. This makes it - // possible to acquire the lock explicitly, which can be useful in - // some cases if you instantiate the <ACE_Atomic_Op> with an - // <ACE_Recursive_Mutex> or <ACE_Process_Mutex>, or if you need to - // guard the state of an iterator. NOTE: the right name would be - // <lock>, but HP/C++ will choke on that! - - void dump (void) const; - // Dump the state of an object. - - // = STL styled iterator factory functions. - - ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> begin (void); - ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> end (void); - // Return forward iterator. - - ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> rbegin (void); - ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> rend (void); - // Return reverse iterator. - -protected: - // = The following methods do the actual work. - - int equal (const EXT_ID &id1, const EXT_ID &id2); - // Returns 1 if <id1> == <id2>, else 0. This is defined as a - // separate method to facilitate template specialization. - - u_long hash (const EXT_ID &ext_id); - // Compute the hash value of the <ext_id>. This is defined as a - // separate method to facilitate template specialization. - - // = These methods assume locks are held by private methods. - - int bind_i (const EXT_ID &ext_id, - const INT_ID &int_id); - // Performs bind. Must be called with locks held. - - int bind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); - // Performs bind. Must be called with locks held. - - int trybind_i (const EXT_ID &ext_id, - INT_ID &int_id); - // Performs trybind. Must be called with locks held. - - int trybind_i (const EXT_ID &ext_id, - INT_ID &int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); - // Performs trybind. Must be called with locks held. - - int rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id); - // Performs rebind. Must be called with locks held. - - int rebind_i (const EXT_ID &ext_id, - const INT_ID &int_id, - EXT_ID &old_ext_id, - INT_ID &old_int_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); - // Performs rebind. Must be called with locks held. - - int find_i (const EXT_ID &ext_id, - INT_ID &int_id); - // Performs a find of <int_id> using <ext_id> as the key. Must be - // called with locks held. - - int find_i (const EXT_ID &ext_id); - // Performs a find using <ext_id> as the key. Must be called with - // locks held. - - int find_i (const EXT_ID &ext_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); - // Performs a find using <ext_id> as the key. Must be called with - // locks held. - - int unbind_i (const EXT_ID &ext_id, - INT_ID &int_id); - // Performs unbind. Must be called with locks held. - - int unbind_i (const EXT_ID &ext_id); - // Performs unbind. Must be called with locks held. - - int unbind_i (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry); - // Performs unbind. Must be called with locks held. - - int create_buckets (size_t size); - // Resize the map. Must be called with locks held. Note, that this - // method should never be called more than once or else all the - // hashing will get screwed up as the size will change. - - int close_i (void); - // Close down a <Map_Manager>. Must be called with - // locks held. - - ACE_Allocator *allocator_; - // Pointer to a memory allocator. - - ACE_LOCK lock_; - // Synchronization variable for the MT_SAFE <ACE_Hash_Map_Manager>. - -private: - int shared_find (const EXT_ID &ext_id, - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry, - u_long &loc); - // Returns the <ACE_Hash_Map_Entry> that corresponds to <ext_id>. - - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *table_; - // Array of <ACE_Hash_Map_Entry> *s, each of which points to an - // <ACE_Hash_Map_Entry> that serves as the beginning of a linked - // list of <EXT_ID>s that hash to that bucket. - - size_t total_size_; - // Total size of the hash table. - - size_t cur_size_; - // Current number of entries in the table (note that this can be - // larger than <total_size_> due to the bucket chaining). + u_long operator () (signed char t) const; + // Simply returns t }; -template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Iterator_Base +class ACE_Export ACE_Hash<unsigned char> { // = TITLE - // Base iterator for the <ACE_Hash_Map_Manager> - // - // = DESCRIPTION - // This class factors out common code from its templatized - // subclasses. + // Function object for hashing an unsigned char public: - // = Initialization method. - ACE_Hash_Map_Iterator_Base (ACE_Hash_Map_Manager <EXT_ID, INT_ID, ACE_LOCK> &mm, - int head); - // Contructor. If head != 0, the iterator constructed is positioned - // at the head of the map, it is positioned at the end otherwise. - - // = ITERATION methods. - - int next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&next_entry); - // Pass back the next <entry> that hasn't been seen in the Set. - // Returns 0 when all items have been seen, else 1. - - int done (void) const; - // Returns 1 when all items have been seen, else 0. - - ACE_Hash_Map_Entry<EXT_ID, INT_ID>& operator* (void); - // Returns a reference to the interal element <this> is pointing to. - - ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>& map (void); - // Returns reference the Hash_Map_Manager that is being iterated - // over. - - int operator== (const ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &) const; - int operator!= (const ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> &) const; - // Check if two iterators point to the same position - - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. - -protected: - int forward_i (void); - // Move forward by one element in the set. Returns 0 when there's - // no more item in the set after the current items, else 1. - - int reverse_i (void); - // Move backward by one element in the set. Returns 0 when there's - // no more item in the set before the current item, else 1. - - void dump_i (void) const; - // Dump the state of an object. - - ACE_Hash_Map_Manager <EXT_ID, INT_ID, ACE_LOCK> *map_man_; - // Map we are iterating over. - - ssize_t index_; - // Keeps track of how far we've advanced in the table. - - ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next_; - // Keeps track of how far we've advanced in a linked list in each - // table slot. + u_long operator () (unsigned char t) const; + // Simply returns t }; -template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Iterator : public ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> +class ACE_Export ACE_Hash<short> { // = TITLE - // Forward iterator for the <ACE_Hash_Map_Manager>. - // - // = DESCRIPTION - // This class does not perform any internal locking of the - // <ACE_Hash_Map_Manager> it is iterating upon since locking is - // inherently inefficient and/or error-prone within an STL-style - // iterator. If you require locking, you can explicitly use an - // <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager>'s - // internal lock, which is accessible via its <mutex> method. + // Function object for hashing a short public: - // = Initialization method. - ACE_Hash_Map_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, - int tail = 0); - - // = Iteration methods. - - int advance (void); - // Move forward by one element in the set. Returns 0 when all the - // items in the set have been seen, else 1. + u_long operator () (short t) const; + // Simply returns t +}; - void dump (void) const; - // Dump the state of an object. +class ACE_Export ACE_Hash<unsigned short> +{ + // = TITLE + // Function object for hashing an unsigned short +public: + u_long operator () (unsigned short t) const; + // Simply returns t +}; - // = STL styled iteration, compare, and reference functions. +class ACE_Export ACE_Hash<int> +{ + // = TITLE + // Function object for hashing an int +public: + u_long operator () (int t) const; + // Simply returns t +}; - ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> &operator++ (void); - // Prefix advance. +class ACE_Export ACE_Hash<unsigned int> +{ + // = TITLE + // Function object for hashing an unsigned int +public: + u_long operator () (unsigned int t) const; + // Simply returns t +}; - ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> operator++ (int); - // Postfix advance. +class ACE_Export ACE_Hash<long> +{ + // = TITLE + // Function object for hashing a long +public: + u_long operator () (long t) const; + // Simply returns t +}; - ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> &operator-- (void); - // Prefix reverse. +class ACE_Export ACE_Hash<unsigned long> +{ + // = TITLE + // Function object for hashing an unsigned long +public: + u_long operator () (unsigned long t) const; + // Simply returns t +}; - ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK> operator-- (int); - // Postfix reverse. +class ACE_Export ACE_Hash<const char *> +{ + // = TITLE + // Function object for hashing a const string +public: + u_long operator () (const char *t) const; + // Calls ACE::hash_pjw +}; - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. +class ACE_Export ACE_Hash<char *> +{ + // = TITLE + // Function object for hashing a string +public: + u_long operator () (const char *t) const; + // Calls ACE::hash_pjw }; -template <class EXT_ID, class INT_ID, class ACE_LOCK> -class ACE_Hash_Map_Reverse_Iterator : public ACE_Hash_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK> +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR) +class ACE_Export ACE_Hash<const wchar_t *> { // = TITLE - // Reverse iterator for the <ACE_Hash_Map_Manager>. - // - // = DESCRIPTION - // This class does not perform any internal locking of the - // <ACE_Hash_Map_Manager> it is iterating upon since locking is - // inherently inefficient and/or error-prone within an STL-style - // iterator. If you require locking, you can explicitly use an - // <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager>'s - // internal lock, which is accessible via its <mutex> method. + // Function object for hashing a const wide string public: - // = Initialization method. - ACE_Hash_Map_Reverse_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, - int head = 0); + u_long operator () (const wchar_t *t) const; + // Calls ACE::hash_pjw +}; - // = Iteration methods. +class ACE_Export ACE_Hash<wchar_t *> +{ + // = TITLE + // Function object for hashing a wide string +public: + u_long operator () (const wchar_t *t) const; + // Calls ACE::hash_pjw +}; +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */ - int advance (void); - // Move forward by one element in the set. Returns 0 when all the - // items in the set have been seen, else 1. +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT) +class ACE_Export ACE_Hash<const ACE_USHORT16 *> +{ + // = TITLE + // Function object for hashing a const wide string +public: + u_long operator () (const ACE_USHORT16 *t) const; + // Calls ACE::hash_pjw +}; - void dump (void) const; - // Dump the state of an object. +class ACE_Export ACE_Hash<ACE_USHORT16 *> +{ + // = TITLE + // Function object for hashing a wide string +public: + u_long operator () (const ACE_USHORT16 *t) const; + // Calls ACE::hash_pjw +}; +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */ - // = STL styled iteration, compare, and reference functions. +class ACE_Export ACE_Equal_To<const char *> +{ + // = TITLE + // Function object for comparing two const strings +public: + int operator () (const char *lhs, + const char *rhs) const; + // Simply calls strcmp +}; - ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> &operator++ (void); - // Prefix reverse. +class ACE_Export ACE_Equal_To<char *> +{ + // = TITLE + // Function object for comparing two strings +public: + int operator () (const char *lhs, + const char *rhs) const; + // Simply calls strcmp +}; - ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> operator++ (int); - // Postfix reverse. +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR) +class ACE_Export ACE_Equal_To<const wchar_t *> +{ + // = TITLE + // Function object for comparing two const wide strings +public: + int operator () (const wchar_t *lhs, + const wchar_t *rhs) const; + // Simply calls strcmp +}; - ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> &operator-- (void); - // Prefix advance. +class ACE_Export ACE_Equal_To<wchar_t *> +{ + // = TITLE + // Function object for comparing two wide strings +public: + int operator () (const wchar_t *lhs, + const wchar_t *rhs) const; + // Simply calls strcmp +}; +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */ - ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK> operator-- (int); - // Postfix advance. +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT) +class ACE_Export ACE_Equal_To<const ACE_USHORT16 *> +{ + // = TITLE + // Function object for comparing two const wide strings +public: + int operator () (const ACE_USHORT16 *lhs, + const ACE_USHORT16 *rhs) const; + // Simply calls strcmp +}; - ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. +class ACE_Export ACE_Equal_To<ACE_USHORT16 *> +{ + // = TITLE + // Function object for comparing two wide strings +public: + int operator () (const ACE_USHORT16 *lhs, + const ACE_USHORT16 *rhs) const; + // Simply calls strcmp }; +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */ -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "ace/Hash_Map_Manager.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ +// Include the templates here. +#include "ace/Hash_Map_Manager_T.h" -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation "Hash_Map_Manager.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ +#if defined (__ACE_INLINE__) +#include "ace/Hash_Map_Manager.i" +#endif /* __ACE_INLINE__ */ #endif /* ACE_HASH_MAP_MANAGER_H */ diff --git a/ace/Hash_Map_Manager.i b/ace/Hash_Map_Manager.i new file mode 100644 index 00000000000..038ad1157f5 --- /dev/null +++ b/ace/Hash_Map_Manager.i @@ -0,0 +1,135 @@ +// $Id$ + +ACE_INLINE u_long +ACE_Hash<char>::operator () (char t) const +{ + return t; +} + +ACE_INLINE u_long +ACE_Hash<signed char>::operator () (signed char t) const +{ + return t; +} + +ACE_INLINE u_long +ACE_Hash<unsigned char>::operator () (unsigned char t) const +{ + return t; +} + +ACE_INLINE u_long +ACE_Hash<short>::operator () (short t) const +{ + return t; +} + +ACE_INLINE u_long +ACE_Hash<unsigned short>::operator () (unsigned short t) const +{ + return t; +} + +ACE_INLINE u_long +ACE_Hash<int>::operator () (int t) const +{ + return t; +} + +ACE_INLINE u_long +ACE_Hash<unsigned int>::operator () (unsigned int t) const +{ + return t; +} + +ACE_INLINE u_long +ACE_Hash<long>::operator () (long t) const +{ + return t; +} + +ACE_INLINE u_long +ACE_Hash<unsigned long>::operator () (unsigned long t) const +{ + return t; +} + +ACE_INLINE u_long +ACE_Hash<const char *>::operator () (const char *t) const +{ + return ACE::hash_pjw (t); +} + +ACE_INLINE u_long +ACE_Hash<char *>::operator () (const char *t) const +{ + return ACE::hash_pjw (t); +} + +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR) +ACE_INLINE u_long +ACE_Hash<const wchar_t *>::operator () (const wchar_t *t) const +{ + return ACE::hash_pjw (t); +} + +ACE_INLINE u_long +ACE_Hash<wchar_t *>::operator () (const wchar_t *t) const +{ + return ACE::hash_pjw (t); +} +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */ + +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT) +ACE_INLINE u_long +ACE_Hash<const ACE_USHORT16 *>::operator () (const ACE_USHORT16 *t) const +{ + return ACE::hash_pjw (t); +} + +ACE_INLINE u_long +ACE_Hash<ACE_USHORT16 *>::operator () (const ACE_USHORT16 *t) const +{ + return ACE::hash_pjw (t); +} +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */ + +ACE_INLINE int +ACE_Equal_To<const char *>::operator () (const char *lhs, const char *rhs) const +{ + return !ACE_OS::strcmp (lhs, rhs); +} + +ACE_INLINE int +ACE_Equal_To<char *>::operator () (const char *lhs, const char *rhs) const +{ + return !ACE_OS::strcmp (lhs, rhs); +} + +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR) +ACE_INLINE int +ACE_Equal_To<const wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) const +{ + return !ACE_OS::strcmp (lhs, rhs); +} + +ACE_INLINE int +ACE_Equal_To<wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) const +{ + return !ACE_OS::strcmp (lhs, rhs); +} +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */ + +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT) +ACE_INLINE int +ACE_Equal_To<const ACE_USHORT16 *>::operator () (const ACE_USHORT16 *lhs, const ACE_USHORT16 *rhs) const +{ + return !ACE_OS::strcmp (lhs, rhs); +} + +ACE_INLINE int +ACE_Equal_To<ACE_USHORT16 *>::operator () (const ACE_USHORT16 *lhs, const ACE_USHORT16 *rhs) const +{ + return !ACE_OS::strcmp (lhs, rhs); +} +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */ diff --git a/ace/Hash_Map_Manager_T.cpp b/ace/Hash_Map_Manager_T.cpp new file mode 100644 index 00000000000..d542bd402ef --- /dev/null +++ b/ace/Hash_Map_Manager_T.cpp @@ -0,0 +1,380 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Hash_Map_Manager_T.cpp +// +// = AUTHOR +// Doug Schmidt +// +// ============================================================================ + +#ifndef ACE_HASH_MAP_MANAGER_T_CPP +#define ACE_HASH_MAP_MANAGER_T_CPP + +#include "ace/Hash_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Hash_Map_Manager_T.i" +#endif /* __ACE_INLINE__ */ + +#include "ace/Synch.h" +#include "ace/Service_Config.h" +#include "ace/Malloc.h" + +ACE_RCSID(ace, Hash_Map_Manager_T, "$Id$") + +template <class EXT_ID, class INT_ID> +ACE_Hash_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Map_Entry (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev) + : next_ (next), + prev_ (prev) +{ +} + +template <class EXT_ID, class INT_ID> +ACE_Hash_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Map_Entry (const EXT_ID &ext_id, + const INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev) + : ext_id_ (ext_id), + int_id_ (int_id), + next_ (next), + prev_ (prev) +{ +} + +# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) +template <class EXT_ID, class INT_ID> +ACE_Hash_Map_Entry<EXT_ID, INT_ID>::~ACE_Hash_Map_Entry (void) +{ +} +# endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ + +template <class EXT_ID, class INT_ID> void +ACE_Hash_Map_Entry<EXT_ID, INT_ID>::dump (void) const +{ + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("next_ = %d"), this->next_)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("prev_ = %d"), this->prev_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> void +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const +{ + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("total_size_ = %d"), this->total_size_)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\ncur_size_ = %d"), this->cur_size_)); + this->allocator_->dump (); + this->lock_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::create_buckets (size_t size) +{ + size_t bytes = size * sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>); + void *ptr; + + ACE_ALLOCATOR_RETURN (ptr, + this->allocator_->malloc (bytes), + -1); + + this->table_ = (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *) ptr; + + this->total_size_ = size; + + // Initialize each entry in the hash table to be a circular linked + // list with the dummy node in the front serving as the anchor of + // the list. + for (size_t i = 0; i < size; i++) + new (&this->table_[i]) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (&this->table_[i], + &this->table_[i]); + return 0; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::open (size_t size, + ACE_Allocator *alloc) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + if (alloc == 0) + alloc = ACE_Allocator::instance (); + + this->allocator_ = alloc; + + // This assertion is here to help track a situation that shouldn't + // happen, but did with Sun C++ 4.1 (before a change to this class + // was made: it used to have an enum that was supposed to be defined + // to be ACE_DEFAULT_MAP_SIZE, but instead was defined to be 0). + ACE_ASSERT (size != 0); + + // Calling this->close_i () to ensure we release previous allocated + // memory before allocating new one. + this->close_i (); + + return this->create_buckets (size); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::close_i (void) +{ + // Protect against "double-deletion" in case the destructor also + // gets called. + if (this->table_ != 0) + { + // Iterate through the entire map calling the destuctor of each + // <ACE_Hash_Map_Entry>. + for (size_t i = 0; i < this->total_size_; i++) + { + for (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp_ptr = this->table_[i].next_; + temp_ptr != &this->table_[i]; + ) + { + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *hold_ptr = temp_ptr; + temp_ptr = temp_ptr->next_; + + // Explicitly call the destructor. + ACE_DES_FREE_TEMPLATE2 (hold_ptr, this->allocator_->free, + ACE_Hash_Map_Entry, EXT_ID, INT_ID); + } + + // Destroy the dummy entry. + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry = &table_[i]; + // The "if" second argument results in a no-op instead of + // deallocation. + ACE_DES_FREE_TEMPLATE2 (entry, ACE_NOOP, + ACE_Hash_Map_Entry, EXT_ID, INT_ID); + } + + // Free table memory. + this->allocator_->free (this->table_); + this->cur_size_ = 0; + this->total_size_ = 0; + // Should be done last... + this->table_ = 0; + } + return 0; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind_i (const EXT_ID &ext_id, + const INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) +{ + u_long loc; + int result = this->shared_find (ext_id, entry, loc); + + if (result == -1) + { + void *ptr; + // Not found. + ACE_ALLOCATOR_RETURN (ptr, + this->allocator_->malloc (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)), + -1); + + entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (ext_id, + int_id, + this->table_[loc].next_, + &this->table_[loc]); + this->table_[loc].next_ = entry; + entry->next_->prev_ = entry; + this->cur_size_++; + return 0; + } + else + return 1; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind_i (const EXT_ID &ext_id, + INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) +{ + u_long loc; + int result = this->shared_find (ext_id, entry, loc); + + if (result == -1) + { + // Not found. + void *ptr; + ACE_ALLOCATOR_RETURN (ptr, + this->allocator_->malloc (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)), + -1); + + entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (ext_id, + int_id, + this->table_[loc].next_, + &this->table_[loc]); + this->table_[loc].next_ = entry; + entry->next_->prev_ = entry; + this->cur_size_++; + return 0; + } + else + return 1; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_i (const EXT_ID &ext_id, + INT_ID &int_id) +{ + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp; + + u_long loc; + int result = this->shared_find (ext_id, temp, loc); + + if (result == -1) + { + errno = ENOENT; + return -1; + } + + int_id = temp->int_id_; + + return this->unbind_i (temp); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_i (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry) +{ + entry->next_->prev_ = entry->prev_; + entry->prev_->next_ = entry->next_; + + // Explicitly call the destructor. + ACE_DES_FREE_TEMPLATE2 (entry, this->allocator_->free, + ACE_Hash_Map_Entry, EXT_ID, INT_ID); + this->cur_size_--; + return 0; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::shared_find (const EXT_ID &ext_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry, + u_long &loc) +{ + loc = this->hash (ext_id) % this->total_size_; + + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp = this->table_[loc].next_; + + while (temp != &this->table_[loc] && this->equal (temp->ext_id_, ext_id) == 0) + temp = temp->next_; + + if (temp == &this->table_[loc]) + { + errno = ENOENT; + return -1; + } + else + { + entry = temp; + return 0; + } +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind_i (const EXT_ID &ext_id, + const INT_ID &int_id, + EXT_ID &old_ext_id, + INT_ID &old_int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) +{ + u_long dummy; + if (this->shared_find (ext_id, entry, dummy) == -1) + return this->bind_i (ext_id, int_id); + else + { + old_ext_id = entry->ext_id_; + old_int_id = entry->int_id_; + entry->ext_id_ = ext_id; + entry->int_id_ = int_id; + return 1; + } +} + +// ------------------------------------------------------------ + +ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Iterator_Base_Ex) + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> void +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump_i (void) const +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("index_ = %d "), this->index_)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("next_ = %x"), this->next_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i (void) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i"); + + if (this->map_man_->table_ == 0) + return -1; + // Handle initial case specially. + else if (this->index_ == -1) + { + this->index_++; + return this->forward_i (); + } + else if (this->index_ >= ACE_static_cast (ssize_t, this->map_man_->total_size_)) + return 0; + + this->next_ = this->next_->next_; + if (this->next_ == &this->map_man_->table_[this->index_]) + { + while (++this->index_ < ACE_static_cast (ssize_t, + this->map_man_->total_size_)) + { + this->next_ = this->map_man_->table_[this->index_].next_; + if (this->next_ != &this->map_man_->table_[this->index_]) + break; + } + } + + return this->index_ < ACE_static_cast (ssize_t, this->map_man_->total_size_); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i (void) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i"); + + if (this->map_man_->table_ == 0) + return -1; + else if (this->index_ == ACE_static_cast (ssize_t, this->map_man_->total_size_)) + { + this->index_--; + return this->reverse_i (); + } + else if (this->index_ < 0) + return 0; + + this->next_ = this->next_->prev_; + if (this->next_ == &this->map_man_->table_[this->index_]) + { + while (--this->index_ >= 0) + { + this->next_ = this->map_man_->table_[this->index_].prev_; + if (this->next_ != &this->map_man_->table_[this->index_]) + break; + } + } + + return this->index_ >= 0; +} + +#endif /* ACE_HASH_MAP_MANAGER_T_CPP */ diff --git a/ace/Hash_Map_Manager_T.h b/ace/Hash_Map_Manager_T.h new file mode 100644 index 00000000000..3311d106e43 --- /dev/null +++ b/ace/Hash_Map_Manager_T.h @@ -0,0 +1,586 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Hash_Map_Manager_T.h +// +// = AUTHOR +// Doug Schmidt +// +// ============================================================================ + +#ifndef ACE_HASH_MAP_MANAGER_T_H +#define ACE_HASH_MAP_MANAGER_T_H + +#include "ace/OS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +template <class TYPE> +class ACE_Hash +{ + // = TITLE + // + // Function object for hashing + // +public: + u_long operator () (const TYPE &t); + // Simply calls t.hash () +}; + +template <class TYPE> +class ACE_Equal_To +{ + // = TITLE + // + // Function object for comparing types + // +public: + int operator () (const TYPE &lhs, + const TYPE &rhs); + // Simply calls operator== +}; + +template <class EXT_ID, class INT_ID> +class ACE_Hash_Map_Entry +{ + // = TITLE + // Define an entry in the hash table. +public: + // = Initialization and termination methods. + ACE_Hash_Map_Entry (const EXT_ID &ext_id, + const INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next = 0, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev = 0); + // Constructor. + + ACE_Hash_Map_Entry (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev); + // Constructor. + +# if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) + ~ACE_Hash_Map_Entry (void); + // Destructor. +#endif /* ! defined (ACE_HAS_BROKEN_NOOP_DTORS) */ + + EXT_ID ext_id_; + // Key used to look up an entry. + + INT_ID int_id_; + // The contents of the entry itself. + + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next_; + // Pointer to the next item in the bucket of overflow nodes. + + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *prev_; + // Pointer to the prev item in the bucket of overflow nodes. + + void dump (void) const; + // Dump the state of an object. +}; + +// Forward decl. +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +class ACE_Hash_Map_Iterator_Base_Ex; + +// Forward decl. +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +class ACE_Hash_Map_Iterator_Ex; + +// Forward decl. +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +class ACE_Hash_Map_Reverse_Iterator_Ex; + +// Forward decl. +class ACE_Allocator; + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +class ACE_Hash_Map_Manager_Ex +{ + // = TITLE + // Define a map abstraction that efficiently associates + // <EXT_ID>s with <INT_ID>s. + // + // = DESCRIPTION + // + // This implementation of a map uses a hash table. Key hashing + // is achieved through the HASH_KEY object and key comparison is + // achieved through the COMPARE_KEYS object. + // + // This class uses an <ACE_Allocator> to allocate memory. The + // user can make this a persistent class by providing an + // <ACE_Allocator> with a persistable memory pool. +public: + friend class ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>; + friend class ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>; + friend class ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>; + + typedef EXT_ID KEY; + typedef INT_ID VALUE; + typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID> ENTRY; + + // = ACE-style iterator typedefs. + typedef ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ITERATOR; + typedef ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> REVERSE_ITERATOR; + + // = STL-style iterator typedefs. + typedef ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> iterator; + typedef ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> reverse_iterator; + + // = Initialization and termination methods. + + ACE_Hash_Map_Manager_Ex (ACE_Allocator *alloc = 0); + // Initialize a <Hash_Map_Manager_Ex> with default size. + + ACE_Hash_Map_Manager_Ex (size_t size, + ACE_Allocator *alloc = 0); + // Initialize a <Hash_Map_Manager_Ex> with size <length>. + + int open (size_t size = ACE_DEFAULT_MAP_SIZE, + ACE_Allocator *alloc = 0); + // Initialize a <Hash_Map_Manager_Ex> with <size> elements. + + int close (void); + // Close down a <Hash_Map_Manager_Ex> and release dynamically allocated + // resources. + + ~ACE_Hash_Map_Manager_Ex (void); + // Initialize a <Hash_Map_Manager_Ex> with size <length>. + + int bind (const EXT_ID &item, + const INT_ID &int_id); + // Associate <ext_id> with <int_id>. If <ext_id> is already in the + // map then the <ACE_Hash_Map_Entry> is not changed. Returns 0 if a + // new entry is bound successfully, returns 1 if an attempt is made + // to bind an existing entry, and returns -1 if failures occur. + + int bind (const EXT_ID &ext_id, + const INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); + // Same as a normal bind, except the map entry is also passed back + // to the caller. The entry in this case will either be the newly + // created entry, or the existing one. + + int trybind (const EXT_ID &ext_id, + INT_ID &int_id); + // Associate <ext_id> with <int_id> if and only if <ext_id> is not + // in the map. If <ext_id> is already in the map then the <int_id> + // parameter is assigned the existing value in the map. Returns 0 + // if a new entry is bound successfully, returns 1 if an attempt is + // made to bind an existing entry, and returns -1 if failures occur. + + int trybind (const EXT_ID &ext_id, + INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); + // Same as a normal trybind, except the map entry is also passed + // back to the caller. The entry in this case will either be the + // newly created entry, or the existing one. + + int rebind (const EXT_ID &ext_id, + const INT_ID &int_id, + EXT_ID &old_ext_id, + INT_ID &old_int_id); + // Associate <ext_id> with <int_id>. If <ext_id> is not in the map + // then behaves just like <bind>. Otherwise, store the old values + // of <ext_id> and <int_id> into the "out" parameters and rebind the + // new parameters. This is very useful if you need to have an + // atomic way of updating <ACE_Hash_Map_Entrys> and you also need full + // control over memory allocation. Returns 0 if a new entry is + // bound successfully, returns 1 if an existing entry was rebound, + // and returns -1 if failures occur. + + int rebind (const EXT_ID &ext_id, + const INT_ID &int_id, + EXT_ID &old_ext_id, + INT_ID &old_int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); + // Same as a normal rebind, except the map entry is also passed back + // to the caller. The entry in this case will either be the newly + // created entry, or the existing one. + + int find (const EXT_ID &ext_id, + INT_ID &int_id); + // Locate <ext_id> and pass out parameter via <int_id>. If found, + // return 0, returns -1 if not found. + + int find (const EXT_ID &ext_id); + // Returns 0 if the <ext_id> is in the mapping, otherwise -1. + + int find (const EXT_ID &ext_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); + // Locate <ext_id> and pass out parameter via <entry>. If found, + // return 0, returns -1 if not found. + + int unbind (const EXT_ID &ext_id); + // Unbind (remove) the <ext_id> from the map. Don't return the + // <int_id> to the caller (this is useful for collections where the + // <int_id>s are *not* dynamically allocated...) + + int unbind (const EXT_ID &ext_id, + INT_ID &int_id); + // Break any association of <ext_id>. Returns the value of <int_id> + // in case the caller needs to deallocate memory. + + int unbind (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry); + // Remove entry from map. + + size_t current_size (void); + // Return the current size of the map. + + size_t total_size (void); + // Return the total size of the map. + + ACE_LOCK &mutex (void); + // Returns a reference to the underlying <ACE_LOCK>. This makes it + // possible to acquire the lock explicitly, which can be useful in + // some cases if you instantiate the <ACE_Atomic_Op> with an + // <ACE_Recursive_Mutex> or <ACE_Process_Mutex>, or if you need to + // guard the state of an iterator. NOTE: the right name would be + // <lock>, but HP/C++ will choke on that! + + void dump (void) const; + // Dump the state of an object. + + // = STL styled iterator factory functions. + + ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> begin (void); + ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> end (void); + // Return forward iterator. + + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> rbegin (void); + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> rend (void); + // Return reverse iterator. + +protected: + // = The following methods do the actual work. + + int equal (const EXT_ID &id1, const EXT_ID &id2); + // Returns 1 if <id1> == <id2>, else 0. This is defined as a + // separate method to facilitate template specialization. + + u_long hash (const EXT_ID &ext_id); + // Compute the hash value of the <ext_id>. This is defined as a + // separate method to facilitate template specialization. + + // = These methods assume locks are held by private methods. + + int bind_i (const EXT_ID &ext_id, + const INT_ID &int_id); + // Performs bind. Must be called with locks held. + + int bind_i (const EXT_ID &ext_id, + const INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); + // Performs bind. Must be called with locks held. + + int trybind_i (const EXT_ID &ext_id, + INT_ID &int_id); + // Performs trybind. Must be called with locks held. + + int trybind_i (const EXT_ID &ext_id, + INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); + // Performs trybind. Must be called with locks held. + + int rebind_i (const EXT_ID &ext_id, + const INT_ID &int_id, + EXT_ID &old_ext_id, + INT_ID &old_int_id); + // Performs rebind. Must be called with locks held. + + int rebind_i (const EXT_ID &ext_id, + const INT_ID &int_id, + EXT_ID &old_ext_id, + INT_ID &old_int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); + // Performs rebind. Must be called with locks held. + + int find_i (const EXT_ID &ext_id, + INT_ID &int_id); + // Performs a find of <int_id> using <ext_id> as the key. Must be + // called with locks held. + + int find_i (const EXT_ID &ext_id); + // Performs a find using <ext_id> as the key. Must be called with + // locks held. + + int find_i (const EXT_ID &ext_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); + // Performs a find using <ext_id> as the key. Must be called with + // locks held. + + int unbind_i (const EXT_ID &ext_id, + INT_ID &int_id); + // Performs unbind. Must be called with locks held. + + int unbind_i (const EXT_ID &ext_id); + // Performs unbind. Must be called with locks held. + + int unbind_i (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry); + // Performs unbind. Must be called with locks held. + + int create_buckets (size_t size); + // Resize the map. Must be called with locks held. Note, that this + // method should never be called more than once or else all the + // hashing will get screwed up as the size will change. + + int close_i (void); + // Close down a <Map_Manager_Ex>. Must be called with + // locks held. + + ACE_Allocator *allocator_; + // Pointer to a memory allocator. + + ACE_LOCK lock_; + // Synchronization variable for the MT_SAFE <ACE_Hash_Map_Manager_Ex>. + + HASH_KEY hash_key_; + // Function object used for hashing keys. + + COMPARE_KEYS compare_keys_; + // Function object used for comparing keys. + +private: + int shared_find (const EXT_ID &ext_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry, + u_long &loc); + // Returns the <ACE_Hash_Map_Entry> that corresponds to <ext_id>. + + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *table_; + // Array of <ACE_Hash_Map_Entry> *s, each of which points to an + // <ACE_Hash_Map_Entry> that serves as the beginning of a linked + // list of <EXT_ID>s that hash to that bucket. + + size_t total_size_; + // Total size of the hash table. + + size_t cur_size_; + // Current number of entries in the table (note that this can be + // larger than <total_size_> due to the bucket chaining). +}; + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +class ACE_Hash_Map_Iterator_Base_Ex +{ + // = TITLE + // Base iterator for the <ACE_Hash_Map_Manager_Ex> + // + // = DESCRIPTION + // This class factors out common code from its templatized + // subclasses. +public: + // = Initialization method. + ACE_Hash_Map_Iterator_Base_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + int head); + // Contructor. If head != 0, the iterator constructed is positioned + // at the head of the map, it is positioned at the end otherwise. + + // = ITERATION methods. + + int next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&next_entry); + // Pass back the next <entry> that hasn't been seen in the Set. + // Returns 0 when all items have been seen, else 1. + + int done (void) const; + // Returns 1 when all items have been seen, else 0. + + ACE_Hash_Map_Entry<EXT_ID, INT_ID>& operator* (void); + // Returns a reference to the interal element <this> is pointing to. + + ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& map (void); + // Returns reference the Hash_Map_Manager_Ex that is being iterated + // over. + + int operator== (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; + int operator!= (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &) const; + // Check if two iterators point to the same position + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +protected: + int forward_i (void); + // Move forward by one element in the set. Returns 0 when there's + // no more item in the set after the current items, else 1. + + int reverse_i (void); + // Move backward by one element in the set. Returns 0 when there's + // no more item in the set before the current item, else 1. + + void dump_i (void) const; + // Dump the state of an object. + + ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *map_man_; + // Map we are iterating over. + + ssize_t index_; + // Keeps track of how far we've advanced in the table. + + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next_; + // Keeps track of how far we've advanced in a linked list in each + // table slot. +}; + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +class ACE_Hash_Map_Iterator_Ex : public ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +{ + // = TITLE + // Forward iterator for the <ACE_Hash_Map_Manager_Ex>. + // + // = DESCRIPTION + // This class does not perform any internal locking of the + // <ACE_Hash_Map_Manager_Ex> it is iterating upon since locking is + // inherently inefficient and/or error-prone within an STL-style + // iterator. If you require locking, you can explicitly use an + // <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager_Ex>'s + // internal lock, which is accessible via its <mutex> method. +public: + // = Initialization method. + ACE_Hash_Map_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + int tail = 0); + + // = Iteration methods. + + int advance (void); + // Move forward by one element in the set. Returns 0 when all the + // items in the set have been seen, else 1. + + void dump (void) const; + // Dump the state of an object. + + // = STL styled iteration, compare, and reference functions. + + ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void); + // Prefix advance. + + ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int); + // Postfix advance. + + ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void); + // Prefix reverse. + + ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int); + // Postfix reverse. + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. +}; + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> +class ACE_Hash_Map_Reverse_Iterator_Ex : public ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +{ + // = TITLE + // Reverse iterator for the <ACE_Hash_Map_Manager_Ex>. + // + // = DESCRIPTION + // This class does not perform any internal locking of the + // <ACE_Hash_Map_Manager_Ex> it is iterating upon since locking is + // inherently inefficient and/or error-prone within an STL-style + // iterator. If you require locking, you can explicitly use an + // <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager_Ex>'s + // internal lock, which is accessible via its <mutex> method. +public: + // = Initialization method. + ACE_Hash_Map_Reverse_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + int head = 0); + + // = Iteration methods. + + int advance (void); + // Move forward by one element in the set. Returns 0 when all the + // items in the set have been seen, else 1. + + void dump (void) const; + // Dump the state of an object. + + // = STL styled iteration, compare, and reference functions. + + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator++ (void); + // Prefix reverse. + + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator++ (int); + // Postfix reverse. + + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &operator-- (void); + // Prefix advance. + + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> operator-- (int); + // Postfix advance. + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. +}; + +template <class EXT_ID, class INT_ID, class ACE_LOCK> +class ACE_Hash_Map_Manager : public ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> +{ + // = TITLE + // Wrapper for backward compatibility. + // + // = DESCRIPTION + // + // This implementation of a map uses a hash table. This class + // expects that the <EXT_ID> contains a method called <hash>. + // In addition, the <EXT_ID> must support <operator==>. Both of + // these constraints can be alleviated via template + // specialization, as shown in the $ACE_ROOT/tests/Conn_Test.cpp + // test. + // +public: + ACE_Hash_Map_Manager (ACE_Allocator *alloc = 0); + // Initialize a <Hash_Map_Manager> with default size. + + ACE_Hash_Map_Manager (size_t size, + ACE_Allocator *alloc = 0); + // Initialize a <Hash_Map_Manager> with size <length>. + + // = The following two are necessary for template specialization of + // ACE_Hash_Map_Manager to work. + int equal (const EXT_ID &id1, const EXT_ID &id2); + u_long hash (const EXT_ID &ext_id); +}; + +template <class EXT_ID, class INT_ID, class ACE_LOCK> +class ACE_Hash_Map_Iterator : public ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> +{ + // = TITLE + // Wrapper for backward compatibility. + // +public: + // = Initialization method. + ACE_Hash_Map_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, + int tail = 0); +}; + +template <class EXT_ID, class INT_ID, class ACE_LOCK> +class ACE_Hash_Map_Reverse_Iterator : public ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> +{ + // = TITLE + // Wrapper for backward compatibility. + // +public: + // = Initialization method. + ACE_Hash_Map_Reverse_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, + int head = 0); +}; + +#if defined (__ACE_INLINE__) +#include "ace/Hash_Map_Manager_T.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Hash_Map_Manager_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation "Hash_Map_Manager_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* ACE_HASH_MAP_MANAGER_T_H */ diff --git a/ace/Hash_Map_Manager_T.i b/ace/Hash_Map_Manager_T.i new file mode 100644 index 00000000000..c26de8bf6ac --- /dev/null +++ b/ace/Hash_Map_Manager_T.i @@ -0,0 +1,565 @@ +// $Id$ + +#include "ace/Synch.h" + +template <class TYPE> ACE_INLINE u_long +ACE_Hash<TYPE>::operator () (const TYPE &t) +{ + return t.hash (); +} + +template <class TYPE> ACE_INLINE int +ACE_Equal_To<TYPE>::operator () (const TYPE &lhs, + const TYPE &rhs) +{ + return lhs == rhs; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Manager_Ex (size_t size, + ACE_Allocator *alloc) + : allocator_ (alloc), + table_ (0), + total_size_ (0), + cur_size_ (0) +{ + if (this->open (size, alloc) == -1) + ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_Hash_Map_Manager_Ex\n"))); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Manager_Ex (ACE_Allocator *alloc) + : allocator_ (alloc), + table_ (0), + total_size_ (0), + cur_size_ (0) +{ + if (this->open (ACE_DEFAULT_MAP_SIZE, alloc) == -1) + ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_Hash_Map_Manager_Ex\n"))); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::close (void) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->close_i (); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::~ACE_Hash_Map_Manager_Ex (void) +{ + this->close (); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE size_t +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::current_size (void) +{ + return this->cur_size_; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE size_t +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::total_size (void) +{ + return this->total_size_; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE ACE_LOCK & +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::mutex (void) +{ + ACE_TRACE ("ACE_Hash_Map_Manager_Ex::mutex"); + return this->lock_; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE u_long +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::hash (const EXT_ID &ext_id) +{ + return this->hash_key_ (ext_id); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::equal (const EXT_ID &id1, + const EXT_ID &id2) +{ + return this->compare_keys_ (id1, id2); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind_i (const EXT_ID &ext_id, + const INT_ID &int_id) +{ + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp; + + return this->bind_i (ext_id, int_id, temp); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id, + const INT_ID &int_id) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->bind_i (ext_id, int_id); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id, + const INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->bind_i (ext_id, int_id, entry); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind_i (const EXT_ID &ext_id, + INT_ID &int_id) +{ + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp; + + int result = this->trybind_i (ext_id, int_id, temp); + if (result == 1) + int_id = temp->int_id_; + return result; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_id, + INT_ID &int_id) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->trybind_i (ext_id, int_id); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_id, + INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->trybind_i (ext_id, int_id, entry); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_i (const EXT_ID &ext_id) +{ + INT_ID int_id; + + return this->unbind_i (ext_id, int_id); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id, + INT_ID &int_id) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->unbind_i (ext_id, int_id); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->unbind_i (ext_id) == -1 ? -1 : 0; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->unbind_i (entry) == -1 ? -1 : 0; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_i (const EXT_ID &ext_id, + INT_ID &int_id) +{ + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry; + + u_long dummy; + if (this->shared_find (ext_id, entry, dummy) == -1) + return -1; + else + { + int_id = entry->int_id_; + return 0; + } +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_i (const EXT_ID &ext_id) +{ + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry; + + u_long dummy; + return this->shared_find (ext_id, entry, dummy); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id, + INT_ID &int_id) +{ + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->find_i (ext_id, int_id); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id) +{ + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->find_i (ext_id); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find_i (const EXT_ID &ext_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) +{ + u_long dummy; + return this->shared_find (ext_id, entry, dummy); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &ext_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) +{ + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->find_i (ext_id, entry); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind_i (const EXT_ID &ext_id, + const INT_ID &int_id, + EXT_ID &old_ext_id, + INT_ID &old_int_id) +{ + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node; + + return this->rebind_i (ext_id, + int_id, + old_ext_id, + old_int_id, + node); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id, + const INT_ID &int_id, + EXT_ID &old_ext_id, + INT_ID &old_int_id) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_id, + const INT_ID &int_id, + EXT_ID &old_ext_id, + INT_ID &old_int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id, entry); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::begin (void) +{ + return ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::end (void) +{ + return ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rbegin (void) +{ + return ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rend (void) +{ + return ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + int head) + : map_man_ (&mm), + index_ (head != 0 ? -1 : ACE_static_cast (ssize_t, mm.total_size_)), + next_ (0) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex"); + + if (mm.table_ != 0) + this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1]; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next"); + + if (this->map_man_->table_ != 0 + && this->index_ < ACE_static_cast (ssize_t, this->map_man_->total_size_) + && this->index_ >= 0 + && this->next_ != &this->map_man_->table_[this->index_]) + { + entry = this->next_; + return 1; + } + else + return 0; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done (void) const +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done"); + + return this->map_man_->table_ == 0 + || this->index_ >= ACE_static_cast (ssize_t, this->map_man_->total_size_) + || this->index_ < 0; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Entry<EXT_ID, INT_ID> & +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator* (void) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*"); + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *retv = 0; + + int result = this->next (retv); + + ACE_UNUSED_ARG (result); + ACE_ASSERT (result != 0); + + return *retv; +} + +// Returns the reference to the hash_map_manager_ex that is being +// iterated over. +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>& +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map (void) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map"); + return *this->map_man_; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator== (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator=="); + return this->map_man_ == rhs.map_man_ + && this->index_ == rhs.index_ + && this->next_ == rhs.next_; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!= (const ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &rhs) const +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!="); + return this->next_ != rhs.next_ + || this->index_ != rhs.index_ + || this->map_man_ != rhs.map_man_; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Iterator_Ex) + + template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump"); + + this->dump_i (); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, + int tail) + : ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (mm, + tail == 0 ? 1 : 0) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Ex"); + if (tail == 0) + this->forward_i (); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance"); + return this->forward_i (); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)"); + + this->forward_i (); + return *this; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)"); + + ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); + this->forward_i (); + return retv; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)"); + + this->reverse_i (); + return *this; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int) +{ + ACE_TRACE ("ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)"); + + ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); + this->reverse_i (); + return retv; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Map_Reverse_Iterator_Ex) + + template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump (void) const +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump"); + + this->dump_i (); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm, int head) + : ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (mm, head) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator_Ex"); + if (head == 0) + this->reverse_i (); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance"); + return this->reverse_i (); +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (void)"); + + this->reverse_i (); + return *this; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator++ (int)"); + + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); + this->reverse_i (); + return retv; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> & +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (void)"); + + this->forward_i (); + return *this; +} + +template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> +ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int) +{ + ACE_TRACE ("ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator-- (int)"); + + ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> retv (*this); + this->forward_i (); + return retv; +} + +template <class EXT_ID, class INT_ID, class ACE_LOCK> +ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Manager (ACE_Allocator *alloc) + : ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (alloc) +{ +} + +template <class EXT_ID, class INT_ID, class ACE_LOCK> +ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Manager (size_t size, + ACE_Allocator *alloc) + : ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (size, + alloc) +{ +} + +template <class EXT_ID, class INT_ID, class ACE_LOCK> int +ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::equal (const EXT_ID &id1, const EXT_ID &id2) +{ + return ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::equal (id1, id2); +} + +template <class EXT_ID, class INT_ID, class ACE_LOCK> u_long +ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::hash (const EXT_ID &ext_id) +{ + return ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK>::hash (ext_id); +} + +template <class EXT_ID, class INT_ID, class ACE_LOCK> +ACE_Hash_Map_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, + int tail) + : ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (mm, + tail) +{ +} + +template <class EXT_ID, class INT_ID, class ACE_LOCK> +ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::ACE_Hash_Map_Reverse_Iterator (ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm, + int head) + : ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> (mm, + head) +{ +} diff --git a/ace/Local_Name_Space.cpp b/ace/Local_Name_Space.cpp index cb153b17c66..d98b8ff9472 100644 --- a/ace/Local_Name_Space.cpp +++ b/ace/Local_Name_Space.cpp @@ -154,17 +154,22 @@ ACE_NS_Internal::type (void) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) #if (1) +template class ACE_Hash_Map_Entry<ACE_NS_String, ACE_NS_Internal>; +template class ACE_Hash<ACE_NS_String>; +template class ACE_Equal_To<ACE_NS_String>; template class ACE_Hash_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; template class ACE_Hash_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; template class ACE_Hash_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; -template class ACE_Hash_Map_Entry <ACE_NS_String, ACE_NS_Internal>; +template class ACE_Hash_Map_Manager_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; #else +template class ACE_Map_Entry<ACE_NS_String, ACE_NS_Internal>; template class ACE_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; -template class ACE_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; template class ACE_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; template class ACE_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; -template class ACE_Map_Entry <ACE_NS_String, ACE_NS_Internal>; +template class ACE_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; #endif template class ACE_Unbounded_Set<ACE_Name_Binding>; template class ACE_Unbounded_Set_Iterator<ACE_Name_Binding>; @@ -177,17 +182,22 @@ template class ACE_Read_Guard<ACE_RW_Process_Mutex>; template class ACE_Write_Guard<ACE_RW_Process_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #if (1) +#pragma instantiate ACE_Hash_Map_Entry<ACE_NS_String, ACE_NS_Internal> +#pragma instantiate ACE_Hash<ACE_NS_String> +#pragma instantiate ACE_Equal_To<ACE_NS_String> #pragma instantiate ACE_Hash_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Entry <ACE_NS_String, ACE_NS_Internal> +#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex> #else +#pragma instantiate ACE_Map_Entry<ACE_NS_String, ACE_NS_Internal> #pragma instantiate ACE_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> #pragma instantiate ACE_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> #pragma instantiate ACE_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Entry <ACE_NS_String, ACE_NS_Internal> +#pragma instantiate ACE_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> #endif #pragma instantiate ACE_Unbounded_Set<ACE_Name_Binding> #pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Name_Binding> diff --git a/ace/Makefile b/ace/Makefile index eadd65c5517..d599c2c3981 100644 --- a/ace/Makefile +++ b/ace/Makefile @@ -41,6 +41,7 @@ FILES = Log_Msg \ Functor \ Get_Opt \ Handle_Set \ + Hash_Map_Manager \ High_Res_Timer \ INET_Addr \ IOStream \ @@ -162,7 +163,7 @@ TEMPLATE_FILES = \ Free_List \ Functor_T \ Future \ - Hash_Map_Manager \ + Hash_Map_Manager_T \ IOStream_T \ Local_Name_Space_T \ Malloc_T \ @@ -5226,8 +5226,18 @@ public: static size_t strlen (const wchar_t *s); static wchar_t *strcpy (wchar_t *s, const wchar_t *t); + static int strcmp (const wchar_t *s, + const wchar_t *t); # endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */ +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT) + static size_t strlen (const ACE_UINT16 *s); + static ACE_UINT16 *strcpy (ACE_UINT16 *s, + const ACE_UINT16 *t); + static int strcmp (const ACE_USHORT16 *s, + const ACE_USHORT16 *t); +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */ + // The following WChar typedef and functions are used by TAO. TAO // does not use wchar_t because the size of wchar_t is // platform-dependent. @@ -5255,8 +5265,6 @@ public: static const wchar_t *strnchr (const wchar_t *s, wint_t c, size_t len); - static int strcmp (const wchar_t *s, - const wchar_t *t); static int strncmp (const wchar_t *s, const wchar_t *t, size_t len); @@ -5341,7 +5349,6 @@ public: static wchar_t *dlerror (void); # endif /* !ACE_HAS_WINCE */ static ACE_SHLIB_HANDLE dlopen (ACE_WIDE_DL_TYPE filename, - int mode = ACE_DEFAULT_SHLIB_MODE); static void *dlsym (ACE_SHLIB_HANDLE handle, ACE_WIDE_DL_TYPE symbol); static wchar_t *mktemp (wchar_t *t); @@ -9623,8 +9623,72 @@ ACE_OS::strcpy (wchar_t *s, const wchar_t *t) # endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ # endif /* ACE_HAS_UNICODE */ } + +ACE_INLINE int +ACE_OS::strcmp (const wchar_t *s, const wchar_t *t) +{ + // ACE_TRACE ("ACE_OS::strcmp"); +# if defined (ACE_HAS_UNICODE) + return ::wcscmp (s, t); +# else +# if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) + return wcscmp (s, t); +# else + while (*s != 0 && + *t != 0 && + *s == *t) + { + s++; + t++; + } + + return *s - *t; +# endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ +# endif /* ACE_HAS_UNICODE */ +} #endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */ +#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT) +ACE_INLINE size_t +ACE_OS::strlen (const ACE_USHORT16 *s) +{ + // ACE_TRACE ("ACE_OS::strlen"); + u_int len = 0; + + while (*s++ != 0) + len++; + + return len; +} + +ACE_INLINE ACE_USHORT16 * +ACE_OS::strcpy (ACE_USHORT16 *s, const ACE_USHORT16 *t) +{ + // ACE_TRACE ("ACE_OS::strcpy"); + ACE_USHORT16 *result = s; + + while ((*s++ = *t++) != 0) + continue; + + return result; +} + +ACE_INLINE int +ACE_OS::strcmp (const ACE_USHORT16 *s, const ACE_USHORT16 *t) +{ + // ACE_TRACE ("ACE_OS::strcpy"); + while (*s != 0 && + *t != 0 && + *s == *t) + { + s++; + t++; + } + + return *s - *t; +} +#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */ + ACE_INLINE u_int ACE_OS::wslen (const WChar *s) { @@ -9744,13 +9808,6 @@ ACE_OS::strrchr (wchar_t *s, wint_t c) # endif /* ACE_HAS_WINCE */ } -ACE_INLINE int -ACE_OS::strcmp (const wchar_t *s, const wchar_t *t) -{ - // ACE_TRACE ("ACE_OS::strcmp"); - return ::wcscmp (s, t); -} - ACE_INLINE wint_t ACE_OS::to_lower (wint_t c) { diff --git a/ace/README b/ace/README index 3da35860b15..396e16b9e71 100644 --- a/ace/README +++ b/ace/README @@ -404,7 +404,8 @@ ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS Platform will recurse ACE_HAS_REENTRANT_FUNCTIONS Platform supports reentrant functions (i.e., all the POSIX *_r functions). -ACE_HAS_WCHAR_TYPEDEFS_CHAR Compiler typedefs wchar with +ACE_HAS_WCHAR_TYPEDEFS_CHAR Compiler typedefs wchar with char. +ACE_HAS_WCHAR_TYPEDEFS_USHORT Compiler typedefs wchar with ushort. char. ACE_HAS_XPG4_MULTIBYTE_CHAR Platform has support for multi-byte character support diff --git a/ace/SString.cpp b/ace/SString.cpp index bfecd825af4..8817644b56c 100644 --- a/ace/SString.cpp +++ b/ace/SString.cpp @@ -586,12 +586,8 @@ size_t ACE_WString::strlen (const ACE_USHORT16 *s) { ACE_TRACE ("ACE_WString::strlen"); - int i; - for (i = 0; s[i] != 0; i++) - continue; - - return i; + return ACE_OS::strlen (s); } // Get the underlying pointer as an ASCII char. diff --git a/ace/Template_Instantiations.cpp b/ace/Template_Instantiations.cpp index 6a8f254c567..eb19acdc688 100644 --- a/ace/Template_Instantiations.cpp +++ b/ace/Template_Instantiations.cpp @@ -205,8 +205,6 @@ template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>; template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> >; template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> >; -template class ACE_Hash_Map_Entry <ACE_NS_String, ACE_NS_Internal>; -template class ACE_Map_Entry <ACE_NS_String, ACE_NS_Internal>; template class ACE_Map_Entry <ACE_Token_Name, ACE_Tokens *>; template class ACE_Map_Entry<ACE_Token_Name, ACE_Mutex_Invariants *>; template class ACE_Map_Entry<ACE_Token_Name, ACE_RWLock_Invariants *>; @@ -222,52 +220,61 @@ template class ACE_Singleton <ACE_TSS_Connection, ACE_Null_Mutex>; template class ACE_TSS_Singleton<ACE_Dynamic, ACE_Null_Mutex>; - +// from Local_Name_Space.cpp +#if (1) +template class ACE_Hash_Map_Entry<ACE_NS_String, ACE_NS_Internal>; +template class ACE_Hash<ACE_NS_String>; +template class ACE_Equal_To<ACE_NS_String>; +template class ACE_Hash_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; template class ACE_Hash_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; - - - -template class ACE_Hash_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; - +template class ACE_Hash_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; +#else +template class ACE_Map_Entry<ACE_NS_String, ACE_NS_Internal>; +template class ACE_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; +template class ACE_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; +template class ACE_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; +template class ACE_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; +#endif // from Filecache.cpp #if defined (ACE_HAS_TEMPLATE_SPECIALIZATION) template class ACE_Hash_Map_Entry<const char *, ACE_Filecache_Object *>; -template class ACE_Hash_Map_Iterator<const char *, ACE_Filecache_Object *, ACE_Null_Mutex>; template class ACE_Hash_Map_Manager<const char *, ACE_Filecache_Object *, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base<const char *, ACE_Filecache_Object *, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator<const char *, ACE_Filecache_Object *, ACE_Null_Mutex>; template class ACE_Hash_Map_Reverse_Iterator<const char *, ACE_Filecache_Object *, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<const char *, ACE_Filecache_Object *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; #else template class ACE_Hash_Map_Entry<ACE_CString, ACE_Filecache_Object *>; -template class ACE_Hash_Map_Iterator<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex>; +template class ACE_Hash<ACE_CString>; +template class ACE_Equal_To<ACE_CString>; template class ACE_Hash_Map_Manager<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex>; template class ACE_Hash_Map_Reverse_Iterator<ACE_CString, ACE_Filecache_Object *, ACE_Null_Mutex>; -#endif /* defined (ACE_HAS_TEMPLATE_SPECIALIZATION) */ - -template class ACE_Hash_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, ACE_Filecache_Object *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +#endif /* ACE_HAS_TEMPLATE_SPECIALIZATION */ - - -template class ACE_Hash_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; - - -template class ACE_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; template class ACE_Map_Iterator<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Iterator<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Iterator<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex>; template class ACE_Map_Iterator<ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex>; -template class ACE_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; template class ACE_Map_Iterator_Base<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Iterator_Base<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Iterator_Base<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex>; template class ACE_Map_Iterator_Base<ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex>; template class ACE_Map_Manager <ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex>; -template class ACE_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; template class ACE_Map_Manager<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Manager<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Manager<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex>; -template class ACE_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; template class ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex>; template class ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex>; diff --git a/ace/ace_dll.dsp b/ace/ace_dll.dsp index 1c80b03dfb6..fe8ce53c8a7 100644 --- a/ace/ace_dll.dsp +++ b/ace/ace_dll.dsp @@ -3272,6 +3272,52 @@ DEP_CPP_HANDL=\ # End Source File
# Begin Source File
+SOURCE=.\Hash_Map_Manager.cpp
+
+!IF "$(CFG)" == "ACE dynamic library - Win32 Debug"
+
+# PROP BASE Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Release"
+
+# PROP BASE Exclude_From_Build 1
+# PROP Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Unicode Debug"
+
+# PROP BASE Exclude_From_Build 1
+# PROP Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Unicode Release"
+
+# PROP BASE Exclude_From_Build 1
+# PROP Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Alpha Debug"
+
+# PROP BASE Exclude_From_Build 1
+# PROP Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Alpha Release"
+
+# PROP BASE Exclude_From_Build 1
+# PROP Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Alpha Unicode Debug"
+
+# PROP BASE Exclude_From_Build 1
+# PROP Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Alpha Unicode Release"
+
+# PROP BASE Exclude_From_Build 1
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=.\High_Res_Timer.cpp
!IF "$(CFG)" == "ACE dynamic library - Win32 Debug"
@@ -14723,6 +14769,10 @@ SOURCE=.\Hash_Map_Manager.h # End Source File
# Begin Source File
+SOURCE=.\Hash_Map_Manager_T.h
+# End Source File
+# Begin Source File
+
SOURCE=.\High_Res_Timer.h
# End Source File
# Begin Source File
@@ -15451,6 +15501,14 @@ SOURCE=.\Handle_Set.i # End Source File
# Begin Source File
+SOURCE=.\Hash_Map_Manager.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\Hash_Map_Manager_T.i
+# End Source File
+# Begin Source File
+
SOURCE=.\High_Res_Timer.i
# End Source File
# Begin Source File
@@ -16000,9 +16058,28 @@ SOURCE=.\Functor_T.cpp # End Source File
# Begin Source File
-SOURCE=.\Hash_Map_Manager.cpp
-# PROP BASE Exclude_From_Build 1
+SOURCE=.\Hash_Map_Manager_T.cpp
+
+!IF "$(CFG)" == "ACE dynamic library - Win32 Debug"
+
# PROP Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Unicode Debug"
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Unicode Release"
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Alpha Debug"
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Alpha Release"
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Alpha Unicode Debug"
+
+!ELSEIF "$(CFG)" == "ACE dynamic library - Win32 Alpha Unicode Release"
+
+!ENDIF
+
# End Source File
# Begin Source File
diff --git a/ace/ace_lib.dsp b/ace/ace_lib.dsp index 11dee59b1d5..304ea1149a9 100644 --- a/ace/ace_lib.dsp +++ b/ace/ace_lib.dsp @@ -8,17 +8,17 @@ CFG=ACE static library - Win32 Alpha Unicode Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
-!MESSAGE
+!MESSAGE
!MESSAGE NMAKE /f "ace_lib.mak".
-!MESSAGE
+!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
+!MESSAGE
!MESSAGE NMAKE /f "ace_lib.mak"\
CFG="ACE static library - Win32 Alpha Unicode Debug"
-!MESSAGE
+!MESSAGE
!MESSAGE Possible choices for configuration are:
-!MESSAGE
+!MESSAGE
!MESSAGE "ACE static library - Win32 Debug" (based on\
"Win32 (x86) Static Library")
!MESSAGE "ACE static library - Win32 Release" (based on\
@@ -35,7 +35,7 @@ CFG=ACE static library - Win32 Alpha Unicode Debug "Win32 (ALPHA) Static Library")
!MESSAGE "ACE static library - Win32 Alpha Unicode Release" (based on\
"Win32 (ALPHA) Static Library")
-!MESSAGE
+!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
@@ -229,7 +229,7 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo /out:".\aceus.lib"
# ADD LIB32 /nologo /out:".\aceus.lib"
-!ENDIF
+!ENDIF
# Begin Target
@@ -264,7 +264,7 @@ SOURCE=.\ACE.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -287,7 +287,7 @@ SOURCE=.\Activation_Queue.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -310,7 +310,7 @@ SOURCE=.\Addr.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -333,7 +333,7 @@ SOURCE=.\Arg_Shifter.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -356,7 +356,7 @@ SOURCE=.\ARGV.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -379,7 +379,7 @@ SOURCE=.\Asynch_Acceptor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -402,7 +402,7 @@ SOURCE=.\Asynch_IO.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -425,7 +425,7 @@ SOURCE=.\Basic_Types.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -464,7 +464,7 @@ SOURCE=.\Containers.cpp # PROP BASE Exclude_From_Build 1
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -487,7 +487,7 @@ SOURCE=.\CORBA_Handler.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -510,7 +510,7 @@ SOURCE=.\CORBA_Ref.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -533,7 +533,7 @@ SOURCE=.\Date_Time.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -556,7 +556,7 @@ SOURCE=.\DEV.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -579,7 +579,7 @@ SOURCE=.\DEV_Addr.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -602,7 +602,7 @@ SOURCE=.\DEV_Connector.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -625,7 +625,7 @@ SOURCE=.\DEV_IO.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -648,7 +648,7 @@ SOURCE=.\Dirent.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -671,7 +671,7 @@ SOURCE=.\DLL.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -694,7 +694,7 @@ SOURCE=.\Dump.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -717,7 +717,7 @@ SOURCE=.\Dynamic.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -740,7 +740,7 @@ SOURCE=.\Dynamic_Service.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -763,7 +763,7 @@ SOURCE=.\Event_Handler.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -786,7 +786,7 @@ SOURCE=.\Event_Handler_T.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -809,7 +809,7 @@ SOURCE=.\FIFO.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -832,7 +832,7 @@ SOURCE=.\FIFO_Recv.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -855,7 +855,7 @@ SOURCE=.\FIFO_Recv_Msg.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -878,7 +878,7 @@ SOURCE=.\FIFO_Send.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -901,7 +901,7 @@ SOURCE=.\FIFO_Send_Msg.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -924,7 +924,7 @@ SOURCE=.\FILE.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -947,7 +947,7 @@ SOURCE=.\FILE_Addr.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -970,7 +970,7 @@ SOURCE=.\FILE_Connector.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -993,7 +993,7 @@ SOURCE=.\FILE_IO.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1016,7 +1016,7 @@ SOURCE=.\Filecache.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1039,7 +1039,7 @@ SOURCE=.\Future.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1062,7 +1062,7 @@ SOURCE=.\Get_Opt.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1085,7 +1085,30 @@ SOURCE=.\Handle_Set.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\Hash_Map_Manager.cpp
+
+!IF "$(CFG)" == "ACE static library - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Unicode Debug"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Unicode Release"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Debug"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Release"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Debug"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
+
+!ENDIF
# End Source File
# Begin Source File
@@ -1108,7 +1131,7 @@ SOURCE=.\High_Res_Timer.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1131,7 +1154,7 @@ SOURCE=.\INET_Addr.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1154,7 +1177,7 @@ SOURCE=.\IO_Cntl_Msg.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1177,7 +1200,7 @@ SOURCE=.\IO_SAP.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1200,7 +1223,7 @@ SOURCE=.\IOStream.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1223,7 +1246,7 @@ SOURCE=.\IPC_SAP.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1246,7 +1269,7 @@ SOURCE=.\Local_Name_Space.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1269,7 +1292,7 @@ SOURCE=.\Local_Tokens.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1292,7 +1315,7 @@ SOURCE=.\Log_Msg.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1315,7 +1338,7 @@ SOURCE=.\Log_Record.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1338,7 +1361,7 @@ SOURCE=.\LSOCK.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1361,7 +1384,7 @@ SOURCE=.\LSOCK_Acceptor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1384,7 +1407,7 @@ SOURCE=.\LSOCK_CODgram.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1407,7 +1430,7 @@ SOURCE=.\LSOCK_Connector.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1430,7 +1453,7 @@ SOURCE=.\LSOCK_Dgram.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1453,7 +1476,7 @@ SOURCE=.\LSOCK_Stream.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1476,7 +1499,7 @@ SOURCE=.\Malloc.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1499,7 +1522,7 @@ SOURCE=.\Mem_Map.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1522,7 +1545,7 @@ SOURCE=.\Memory_Pool.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1545,7 +1568,7 @@ SOURCE=.\Message_Block.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1584,7 +1607,7 @@ SOURCE=.\Message_Queue.cpp # PROP BASE Exclude_From_Build 1
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1607,7 +1630,7 @@ SOURCE=.\Method_Request.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1630,7 +1653,7 @@ SOURCE=.\Multiplexor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1653,7 +1676,7 @@ SOURCE=.\Name_Proxy.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1676,7 +1699,7 @@ SOURCE=.\Name_Request_Reply.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1699,7 +1722,7 @@ SOURCE=.\Name_Space.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1722,7 +1745,7 @@ SOURCE=.\Naming_Context.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1745,7 +1768,7 @@ SOURCE=.\NT_Service.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1768,7 +1791,7 @@ SOURCE=.\Object_Manager.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1791,7 +1814,7 @@ SOURCE=.\Obstack.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1814,7 +1837,7 @@ SOURCE=.\OS.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1837,7 +1860,7 @@ SOURCE=.\Parse_Node.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1860,7 +1883,7 @@ SOURCE=.\Pipe.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1883,7 +1906,7 @@ SOURCE=.\Priority_Reactor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1906,7 +1929,7 @@ SOURCE=.\Proactor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1929,7 +1952,7 @@ SOURCE=.\Process.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1952,7 +1975,7 @@ SOURCE=.\Process_Manager.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1975,7 +1998,7 @@ SOURCE=.\Profile_Timer.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -1998,7 +2021,7 @@ SOURCE=.\Reactor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2021,7 +2044,7 @@ SOURCE=.\Read_Buffer.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2044,7 +2067,7 @@ SOURCE=.\Registry.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2067,7 +2090,7 @@ SOURCE=.\Registry_Name_Space.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2090,7 +2113,7 @@ SOURCE=.\Remote_Name_Space.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2113,7 +2136,7 @@ SOURCE=.\Remote_Tokens.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2136,7 +2159,7 @@ SOURCE=.\Sched_Params.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2159,7 +2182,7 @@ SOURCE=.\Select_Reactor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2182,7 +2205,7 @@ SOURCE=.\Select_Reactor_Base.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2205,7 +2228,7 @@ SOURCE=.\Service_Config.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2228,7 +2251,7 @@ SOURCE=.\Service_Manager.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2251,7 +2274,7 @@ SOURCE=.\Service_Object.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2274,7 +2297,7 @@ SOURCE=.\Service_Repository.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2297,7 +2320,7 @@ SOURCE=.\Service_Types.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2320,7 +2343,7 @@ SOURCE=.\Shared_Memory.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2343,7 +2366,7 @@ SOURCE=.\Shared_Memory_MM.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2366,7 +2389,7 @@ SOURCE=.\Shared_Memory_SV.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2389,7 +2412,7 @@ SOURCE=.\Shared_Object.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2412,7 +2435,7 @@ SOURCE=.\Signal.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2435,7 +2458,7 @@ SOURCE=.\SOCK.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2458,7 +2481,7 @@ SOURCE=.\SOCK_Acceptor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2481,7 +2504,7 @@ SOURCE=.\SOCK_CODgram.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2504,7 +2527,7 @@ SOURCE=.\SOCK_Connector.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2527,7 +2550,7 @@ SOURCE=.\SOCK_Dgram.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2550,7 +2573,7 @@ SOURCE=.\SOCK_Dgram_Bcast.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2573,7 +2596,7 @@ SOURCE=.\SOCK_Dgram_Mcast.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2596,7 +2619,7 @@ SOURCE=.\SOCK_IO.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2619,7 +2642,7 @@ SOURCE=.\SOCK_Stream.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2642,7 +2665,7 @@ SOURCE=.\SPIPE.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2665,7 +2688,7 @@ SOURCE=.\SPIPE_Acceptor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2688,7 +2711,7 @@ SOURCE=.\SPIPE_Addr.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2711,7 +2734,7 @@ SOURCE=.\SPIPE_Connector.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2734,7 +2757,7 @@ SOURCE=.\SPIPE_Stream.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2757,7 +2780,7 @@ SOURCE=.\SString.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2780,7 +2803,7 @@ SOURCE=.\Stats.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2803,7 +2826,7 @@ SOURCE=.\Strategies.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2826,7 +2849,7 @@ SOURCE=.\SV_Message.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2849,7 +2872,7 @@ SOURCE=.\SV_Message_Queue.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2872,7 +2895,7 @@ SOURCE=.\SV_Semaphore_Complex.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2895,7 +2918,7 @@ SOURCE=.\SV_Semaphore_Simple.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2918,7 +2941,7 @@ SOURCE=.\SV_Shared_Memory.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2941,7 +2964,7 @@ SOURCE=.\Svc_Conf_l.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2964,7 +2987,7 @@ SOURCE=.\Svc_Conf_y.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -2987,7 +3010,7 @@ SOURCE=.\Svc_Handler.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3010,7 +3033,7 @@ SOURCE=.\Synch.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3033,7 +3056,7 @@ SOURCE=.\Synch_Options.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3056,7 +3079,7 @@ SOURCE=.\System_Time.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3079,7 +3102,7 @@ SOURCE=.\Task.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3102,7 +3125,7 @@ SOURCE=.\Thread.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3125,7 +3148,7 @@ SOURCE=.\Thread_Manager.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3148,7 +3171,7 @@ SOURCE=.\Time_Request_Reply.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3171,7 +3194,7 @@ SOURCE=.\Timeprobe.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3194,7 +3217,7 @@ SOURCE=.\Timer_Hash.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3217,7 +3240,7 @@ SOURCE=.\Timer_Heap.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3240,7 +3263,7 @@ SOURCE=.\Timer_List.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3263,7 +3286,7 @@ SOURCE=.\Timer_Queue.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3286,7 +3309,7 @@ SOURCE=.\Timer_Queue_Adapters.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3309,7 +3332,7 @@ SOURCE=.\Timer_Wheel.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3332,7 +3355,7 @@ SOURCE=.\TLI.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3355,7 +3378,7 @@ SOURCE=.\TLI_Acceptor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3378,7 +3401,7 @@ SOURCE=.\TLI_Connector.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3401,7 +3424,7 @@ SOURCE=.\TLI_Stream.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3424,7 +3447,7 @@ SOURCE=.\Token.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3447,7 +3470,7 @@ SOURCE=.\Token_Collection.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3470,7 +3493,7 @@ SOURCE=.\Token_Invariants.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3493,7 +3516,7 @@ SOURCE=.\Token_Manager.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3516,7 +3539,7 @@ SOURCE=.\Token_Request_Reply.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3539,7 +3562,7 @@ SOURCE=.\TP_Reactor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3562,7 +3585,7 @@ SOURCE=.\Trace.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3585,7 +3608,7 @@ SOURCE=.\TTY_IO.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3608,7 +3631,7 @@ SOURCE=.\Typed_SV_Message.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3631,7 +3654,7 @@ SOURCE=.\Typed_SV_Message_Queue.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3654,7 +3677,7 @@ SOURCE=.\UNIX_Addr.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3677,7 +3700,7 @@ SOURCE=.\UPIPE_Acceptor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3700,7 +3723,7 @@ SOURCE=.\UPIPE_Connector.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3723,7 +3746,7 @@ SOURCE=.\UPIPE_Stream.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3746,7 +3769,7 @@ SOURCE=.\WFMO_Reactor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -3769,7 +3792,7 @@ SOURCE=.\XtReactor.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# End Group
@@ -3954,6 +3977,10 @@ SOURCE=.\Hash_Map_Manager.h # End Source File
# Begin Source File
+SOURCE=.\Hash_Map_Manager_T.h
+# End Source File
+# Begin Source File
+
SOURCE=.\High_Res_Timer.h
# End Source File
# Begin Source File
@@ -4618,6 +4645,14 @@ SOURCE=.\Handle_Set.i # End Source File
# Begin Source File
+SOURCE=.\Hash_Map_Manager.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\Hash_Map_Manager_T.i
+# End Source File
+# Begin Source File
+
SOURCE=.\High_Res_Timer.i
# End Source File
# Begin Source File
@@ -5029,7 +5064,7 @@ SOURCE=.\Connector.cpp !ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
-!ENDIF
+!ENDIF
# End Source File
# Begin Source File
@@ -5046,9 +5081,28 @@ SOURCE=.\Free_List.cpp # End Source File
# Begin Source File
-SOURCE=.\Hash_Map_Manager.cpp
-# PROP BASE Exclude_From_Build 1
+SOURCE=.\Hash_Map_Manager_T.cpp
+
+!IF "$(CFG)" == "ACE static library - Win32 Debug"
+
# PROP Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Unicode Debug"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Unicode Release"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Debug"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Release"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Debug"
+
+!ELSEIF "$(CFG)" == "ACE static library - Win32 Alpha Unicode Release"
+
+!ENDIF
+
# End Source File
# Begin Source File
diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h index 5a6600d681b..b8e35a37665 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -15,6 +15,7 @@ #define ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS #endif /* ! ACE_HAS_WINCE */ +#define ACE_HAS_WCHAR_TYPEDEFS_USHORT #define ACE_HAS_MSG #define ACE_HAS_SOCKADDR_MSG_NAME #define ACE_LACKS_GETPGID diff --git a/tests/Conn_Test.cpp b/tests/Conn_Test.cpp index 905409a95b7..d9b62b1954c 100644 --- a/tests/Conn_Test.cpp +++ b/tests/Conn_Test.cpp @@ -709,14 +709,22 @@ template class ACE_Connect_Strategy<Svc_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Connector<Svc_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Creation_Strategy<Svc_Handler>; template class ACE_Hash_Map_Entry<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *>; +template class ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>; +template class ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>; template class ACE_Hash_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Null_Mutex>; template class ACE_Hash_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Null_Mutex>; template class ACE_Hash_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Null_Mutex>; template class ACE_Hash_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Hash_Map_Iterator_Base<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_SYNCH_RW_MUTEX>; +template class ACE_Hash_Map_Iterator_Base_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_SYNCH_RW_MUTEX>; template class ACE_Hash_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Hash_Map_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_SYNCH_RW_MUTEX>; template class ACE_Hash_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_SYNCH_RW_MUTEX>; template class ACE_LOCK_SOCK_Acceptor<ACCEPTOR_LOCKING>; template class ACE_Oneshot_Acceptor<Svc_Handler, LOCK_SOCK_ACCEPTOR>; template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *>; @@ -747,14 +755,22 @@ template class ACE_Unbounded_Queue<ACE_Thread_Descriptor*>; #pragma instantiate ACE_Connector<Svc_Handler, ACE_SOCK_CONNECTOR> #pragma instantiate ACE_Creation_Strategy<Svc_Handler> #pragma instantiate ACE_Hash_Map_Entry<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *> +#pragma instantiate ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR> +#pragma instantiate ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR> #pragma instantiate ACE_Hash_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Hash_Map_Iterator_Base<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_SYNCH_RW_MUTEX> #pragma instantiate ACE_Hash_Map_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_SYNCH_RW_MUTEX> #pragma instantiate ACE_Hash_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_SYNCH_RW_MUTEX> #pragma instantiate ACE_LOCK_SOCK_Acceptor<ACCEPTOR_LOCKING> #pragma instantiate ACE_Oneshot_Acceptor<Svc_Handler, LOCK_SOCK_ACCEPTOR> #pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *> diff --git a/tests/Hash_Map_Manager_Test.cpp b/tests/Hash_Map_Manager_Test.cpp index d828feb5a78..e172015f03d 100644 --- a/tests/Hash_Map_Manager_Test.cpp +++ b/tests/Hash_Map_Manager_Test.cpp @@ -22,7 +22,6 @@ #include "test_config.h" #include "ace/Hash_Map_Manager.h" #include "ace/Malloc_T.h" -#include "ace/SString.h" #include "ace/Synch.h" ACE_RCSID(tests, Hash_Map_Manager_Test, "$Id$") @@ -32,147 +31,26 @@ USELIB("..\ace\aced.lib"); //--------------------------------------------------------------------------- #endif /* defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 */ -#if defined (ACE_HAS_TEMPLATE_SPECIALIZATION) +typedef ACE_Hash_Map_Entry<ASYS_TCHAR *, + ASYS_TCHAR *> HASH_STRING_ENTRY; -#define HASH_STRING_ENTRY ACE_Hash_Map_Entry<ASYS_TCHAR *, ASYS_TCHAR *> -#define HASH_STRING_MAP ACE_Hash_Map_Manager<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Null_Mutex> -#define HASH_STRING_ITER ACE_Hash_Map_Iterator<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Null_Mutex> -#define HASH_STRING_REVERSE_ITER ACE_Hash_Map_Reverse_Iterator<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Null_Mutex> +typedef ACE_Hash_Map_Manager_Ex<ASYS_TCHAR *, + ASYS_TCHAR *, + ACE_Hash<ASYS_TCHAR *>, + ACE_Equal_To<ASYS_TCHAR *>, + ACE_Null_Mutex> HASH_STRING_MAP; -#define MAP_STRING ASYS_TCHAR * -#define ENTRY entry +typedef ACE_Hash_Map_Iterator_Ex<ASYS_TCHAR *, + ASYS_TCHAR *, + ACE_Hash<ASYS_TCHAR *>, + ACE_Equal_To<ASYS_TCHAR *>, + ACE_Null_Mutex> HASH_STRING_ITER; -HASH_STRING_ENTRY::ACE_Hash_Map_Entry (ASYS_TCHAR *const &ext_id, - ASYS_TCHAR *const &int_id, - HASH_STRING_ENTRY *next, - HASH_STRING_ENTRY *prev) - : ext_id_ (ACE_OS::strdup (ext_id)), - int_id_ (ACE_OS::strdup (int_id)), - next_ (next), - prev_ (prev) -{ - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("Creating `%s' and `%s'\n"), - ext_id_, - int_id_)); -} - -HASH_STRING_ENTRY::ACE_Hash_Map_Entry (HASH_STRING_ENTRY *next, - HASH_STRING_ENTRY *prev) - : ext_id_ (0), - int_id_ (0), - next_ (next), - prev_ (prev) -{ -} - -HASH_STRING_ENTRY::~ACE_Hash_Map_Entry (void) -{ - ASYS_TCHAR *key = ext_id_; - ASYS_TCHAR *value = int_id_; - - if (key != 0 && value != 0) - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("Freeing `%s' and `%s'\n"), - key, - value)); - ACE_OS::free (key); - ACE_OS::free (value); -} - -// We need this template specialization since KEY is defined as a -// ASYS_TCHAR*, which doesn't have a hash() method defined on it. - -long unsigned int -HASH_STRING_MAP::hash (ASYS_TCHAR *const &ext_id) -{ - return ACE::hash_pjw (ext_id); -} - -int -HASH_STRING_MAP::equal (ASYS_TCHAR *const &id1, - ASYS_TCHAR *const &id2) -{ - return ACE_OS::strcmp (id1, id2) == 0; -} - -#else - -// Do this if we don't have template specialization. It's not as efficient - -#include "Hash_Map_Manager_Test.h" // Dumb_String is in here - -#define HASH_STRING_ENTRY ACE_Hash_Map_Entry<Dumb_String, Dumb_String> -#define HASH_STRING_MAP \ - ACE_Hash_Map_Manager<Dumb_String, Dumb_String, ACE_Null_Mutex> -#define HASH_STRING_ITER \ - ACE_Hash_Map_Iterator<Dumb_String, Dumb_String, ACE_Null_Mutex> -#define HASH_STRING_REVERSE_ITER \ - ACE_Hash_Map_Reverse_Iterator<Dumb_String, Dumb_String, ACE_Null_Mutex> - -#define MAP_STRING Dumb_String -#define ENTRY ((ASYS_TCHAR *) entry) - -Dumb_String::Dumb_String (ASYS_TCHAR *s) - : s_ (s ? ACE_OS::strdup (s) : s), - copy_ (s ? *(new int (1)) : junk_), - junk_ (1) -{ -} - -Dumb_String::Dumb_String (const Dumb_String &ds) - : s_ (ds.s_), - copy_ (ds.copy_), - junk_ (1) -{ - copy_++; -} - -Dumb_String::~Dumb_String (void) -{ - if (--copy_ == 0) - { - ACE_OS::free (s_); - if (©_ != &junk_) - delete ©_; - } -} - -u_long -Dumb_String::hash (void) const -{ - return ACE::hash_pjw (s_); -} - -int -Dumb_String::operator== (ASYS_TCHAR const * s) const -{ - return ACE_OS::strcmp (s_, s) == 0; -} - -int -Dumb_String::operator== (const Dumb_String &ds) const -{ - return ACE_OS::strcmp (s_, ds.s_) == 0; -} - -ASYS_TCHAR * -Dumb_String::operator= (const Dumb_String &ds) -{ - this->Dumb_String::~Dumb_String (); - new (this) Dumb_String (ds); - return s_; -} - -Dumb_String::operator ASYS_TCHAR * (void) const -{ - return s_; -} - -// Note that in this version, you will not get the Creating and -// Freeing diagnostic messages. - -#endif /* ACE_HAS_TEMPLATE_SPECIALIZATION */ +typedef ACE_Hash_Map_Reverse_Iterator_Ex<ASYS_TCHAR *, + ASYS_TCHAR *, + ACE_Hash<ASYS_TCHAR *>, + ACE_Equal_To<ASYS_TCHAR *>, + ACE_Null_Mutex> HASH_STRING_REVERSE_ITER; struct String_Table { @@ -227,7 +105,7 @@ run_test (void) ASYS_TEXT ("bind"), string_table[i].key_), -1); - MAP_STRING entry; + ASYS_TCHAR *entry; // Check the <find> operation. for (i = 0; string_table[i].key_ != 0; i++) @@ -236,7 +114,7 @@ run_test (void) ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("`%s' found `%s'\n"), string_table[i].key_, - ENTRY)); + entry)); else ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("`%s' not found\n"), @@ -245,7 +123,7 @@ run_test (void) // Check the <trybind> operation. { - MAP_STRING pc = string_table[1].value_; + ASYS_TCHAR *pc = string_table[1].value_; if (hash.trybind (string_table[0].key_, pc) != 1) ACE_ERROR_RETURN ((LM_ERROR, @@ -284,7 +162,7 @@ run_test (void) ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("`%s' found `%s'\n"), string_table[i].key_, - ENTRY)); + entry)); else if (i != 2) ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("`%s' not found\n"), @@ -326,17 +204,17 @@ main (int, ASYS_TCHAR *[]) } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Hash_Map_Entry<MAP_STRING, MAP_STRING>; -template class ACE_Hash_Map_Manager<MAP_STRING, MAP_STRING, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator<MAP_STRING, MAP_STRING, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base<MAP_STRING, MAP_STRING, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator<MAP_STRING, MAP_STRING, ACE_Null_Mutex>; +template class ACE_Hash_Map_Entry<ASYS_TCHAR *, ASYS_TCHAR *>; +template class ACE_Hash_Map_Manager_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex>; template class ACE_Static_Allocator<String_Table_size>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Hash_Map_Entry<MAP_STRING, MAP_STRING> -#pragma instantiate ACE_Hash_Map_Manager<MAP_STRING, MAP_STRING, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator<MAP_STRING, MAP_STRING, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base<MAP_STRING, MAP_STRING, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator<MAP_STRING, MAP_STRING, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Entry<ASYS_TCHAR *, ASYS_TCHAR *> +#pragma instantiate ACE_Hash_Map_Manager_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex> #pragma instantiate ACE_Static_Allocator<String_Table_size> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/Hash_Map_Manager_Test.h b/tests/Hash_Map_Manager_Test.h deleted file mode 100644 index 235e7a28579..00000000000 --- a/tests/Hash_Map_Manager_Test.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// = FILENAME -// Hash_Map_Manager_Test.h -// -// = DESCRIPTION -// This file contains the definition of Dumb_String. Some -// compilers need it in a .h file for template instantiation (such -// as AIX C Set++). -// -// = AUTHOR -// James Hu, Steve Huston -// -// ============================================================================ - -#ifndef HASH_MAP_MANAGER_TEST_H -#define HASH_MAP_MANAGER_TEST_H - -class Dumb_String -{ - // = TITLE - // Desperate times call for desperate measures. Bug your - // compiler vendor to support template specialization. -public: - Dumb_String (char *s = 0); - // Default constructor - - Dumb_String (const Dumb_String &ds); - // Copy constructor - - ~Dumb_String (void); - // Default destructor - - u_long hash (void) const; - // To satisfy Hash_Map_Manager - - int operator== (const Dumb_String &ds) const; - // To satisfy Hash_Map_Manager - - char *operator= (const Dumb_String &ds); - // To satisfy Hash_Map_Manager - - int operator== (char const * s) const; - operator char * (void) const; - // These make life a little easier - -private: - char *s_; - // The string. - - int ©_; - // Reference counter. - - int junk_; - // default reference counter initializer. -}; - -#endif /* HASH_MAP_MANAGER_TEST_H */ diff --git a/tests/Map_Manager_Test.cpp b/tests/Map_Manager_Test.cpp index f6a10c7f9ae..eaa66c9561c 100644 --- a/tests/Map_Manager_Test.cpp +++ b/tests/Map_Manager_Test.cpp @@ -19,9 +19,6 @@ // ============================================================================ #include "test_config.h" - -#if defined (ACE_HAS_TEMPLATE_SPECIALIZATION) - #include "ace/Map_Manager.h" #include "ace/Hash_Map_Manager.h" #include "ace/Profile_Timer.h" @@ -35,32 +32,17 @@ USELIB("..\ace\aced.lib"); #endif /* defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 */ typedef ACE_Null_Mutex MUTEX; -typedef size_t TYPE; - -#if defined (ACE_HAS_TEMPLATE_SPECIALIZATION) - -// We need this template specialization since TYPE is defined as a -// size_t, which doesn't have a hash() method defined on it. Template -// specialization is a powerful C++ feature that makes it possible to -// customize the implementation of designated template methods to -// either (1) improve performance or (2) support built-in types that -// lack "methods" (as in this case, where size_t lacks hash()). - -u_long -ACE_Hash_Map_Manager<TYPE, TYPE, MUTEX>::hash (const TYPE& ext_id) -{ - return ext_id; -} - -#endif /* ACE_HAS_TEMPLATE_SPECIALIZATION */ +typedef unsigned long TYPE; +typedef ACE_Hash<TYPE> HASH_KEY; +typedef ACE_Equal_To<TYPE> COMPARE_KEYS; typedef ACE_Map_Manager <TYPE, TYPE, MUTEX> MAP_MANAGER; typedef ACE_Map_Iterator <TYPE, TYPE, MUTEX> ITERATOR; typedef ACE_Map_Reverse_Iterator <TYPE, TYPE, MUTEX> REVERSE_ITERATOR; typedef ACE_Map_Entry <TYPE, TYPE> ENTRY; -typedef ACE_Hash_Map_Manager <TYPE, TYPE, MUTEX> HASH_MAP_MANAGER; -typedef ACE_Hash_Map_Iterator <TYPE, TYPE, MUTEX> HASH_ITERATOR; -typedef ACE_Hash_Map_Reverse_Iterator <TYPE, TYPE, MUTEX> HASH_REVERSE_ITERATOR; +typedef ACE_Hash_Map_Manager_Ex <TYPE, TYPE, HASH_KEY, COMPARE_KEYS, MUTEX> HASH_MAP_MANAGER; +typedef ACE_Hash_Map_Iterator_Ex <TYPE, TYPE, HASH_KEY, COMPARE_KEYS, MUTEX> HASH_ITERATOR; +typedef ACE_Hash_Map_Reverse_Iterator_Ex <TYPE, TYPE, HASH_KEY, COMPARE_KEYS, MUTEX> HASH_REVERSE_ITERATOR; typedef ACE_Hash_Map_Entry <TYPE, TYPE> HASH_ENTRY; static void @@ -510,22 +492,24 @@ main (int argc, ASYS_TCHAR *argv[]) } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Hash_Map_Manager<TYPE, TYPE, MUTEX>; -template class ACE_Hash_Map_Iterator_Base<TYPE, TYPE, MUTEX>; -template class ACE_Hash_Map_Iterator<TYPE, TYPE, MUTEX>; -template class ACE_Hash_Map_Reverse_Iterator<TYPE, TYPE, MUTEX>; +template class ACE_Hash_Map_Manager_Ex<TYPE, TYPE, HASH_KEY, COMPARE_KEYS, MUTEX>; +template class ACE_Hash_Map_Iterator_Base_Ex<TYPE, TYPE, HASH_KEY, COMPARE_KEYS, MUTEX>; +template class ACE_Hash_Map_Iterator_Ex<TYPE, TYPE, HASH_KEY, COMPARE_KEYS, MUTEX>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<TYPE, TYPE, HASH_KEY, COMPARE_KEYS, MUTEX>; template class ACE_Hash_Map_Entry<TYPE, TYPE>; +template class ACE_Equal_To<TYPE>; template class ACE_Map_Manager<TYPE, TYPE, MUTEX>; template class ACE_Map_Iterator_Base<TYPE, TYPE, MUTEX>; template class ACE_Map_Iterator<TYPE, TYPE, MUTEX>; template class ACE_Map_Reverse_Iterator<TYPE, TYPE, MUTEX>; template class ACE_Map_Entry<TYPE, TYPE>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Hash_Map_Manager<TYPE, TYPE, MUTEX> -#pragma instantiate ACE_Hash_Map_Iterator_Base<TYPE, TYPE, MUTEX> -#pragma instantiate ACE_Hash_Map_Iterator<TYPE, TYPE, MUTEX> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator<TYPE, TYPE, MUTEX> +#pragma instantiate ACE_Hash_Map_Manager_Ex<TYPE, TYPE, HASH_KEY, COMPARE_KEYS, MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<TYPE, TYPE, HASH_KEY, COMPARE_KEYS, MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<TYPE, TYPE, HASH_KEY, COMPARE_KEYS, MUTEX> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<TYPE, TYPE, HASH_KEY, COMPARE_KEYS, MUTEX> #pragma instantiate ACE_Hash_Map_Entry<TYPE, TYPE> +#pragma instantiate ACE_Equal_To<TYPE> #pragma instantiate ACE_Map_Manager<TYPE, TYPE, MUTEX> #pragma instantiate ACE_Map_Iterator_Base<TYPE, TYPE, MUTEX> #pragma instantiate ACE_Map_Iterator<TYPE, TYPE, MUTEX> @@ -533,20 +517,3 @@ template class ACE_Map_Entry<TYPE, TYPE>; #pragma instantiate ACE_Map_Entry<TYPE, TYPE> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ -#else /* ACE_HAS_TEMPLATE_SPECIALIZATION */ - -int -main (int argc, ASYS_TCHAR *argv[]) -{ - ACE_START_TEST (ASYS_TEXT ("Map_Manager_Test")); - - ACE_UNUSED_ARG (argc); - ACE_UNUSED_ARG (argv); - ACE_ERROR ((LM_INFO, - ASYS_TEXT ("Template specializations not supported on this platform\n"))); - - ACE_END_TEST; - return 0; -} - -#endif /* ACE_HAS_TEMPLATE_SPECIALIZATION */ |