diff options
40 files changed, 5026 insertions, 150 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b index 28d98f43424..82b906a202a 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,3 +1,104 @@ +Fri Feb 05 21:57:24 1999 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/Map_T: Added a new Map mini framework to ACE. The classes + in this mini framework allows the Map interface to be used + without caring about the specific Map implementation being used. + There is the class hierarchy of the framework: + + forwards + ACE_Iterator --------> ACE_Iterator_Impl (abstract) + + ACE_Iterator_Impl is subclassed by: + + - ACE_Map_Impl_Iterator_Adapter<IMPLEMENTATION> + - ACE_Active_Map_Manager_Iterator_Adapter + - ACE_Hash_Map_Manager_Ex_Iterator_Adapter + - ACE_Map_Manager_Iterator_Adapter + + forwards + ACE_Reverse_Iterator --------> ACE_Reverse_Iterator_Impl (abstract) + + ACE_Reverse_Iterator_Impl is subclassed by: + + - ACE_Map_Impl_Reverse_Iterator_Adapter<IMPLEMENTATION> + - ACE_Active_Map_Manager_Reverse_Iterator_Adapter + - ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter + - ACE_Map_Manager_Reverse_Iterator_Adapter + + ACE_Map is subclassed by: + + - ACE_Map_Impl<IMPLEMENTATION> + - ACE_Active_Map_Manager_Adapter + - ACE_Hash_Map_Manager_Edapter + - ACE_Map_Manager_Adapter + + Also included in the framework is a Key Generator class and a + Key Adapter class. The Key Generator class is used by some map + adapters to generate keys since the maps they adapt do not + generate keys. The Key Adapter class is used by the active map + adapter to allow encoding and decoding of active keys into user + keys. + + Note that the iterators use the bridge pattern while the map + class uses an abstract base class based inheritance approach. + The reason for this is that STL containers return the iterators + by value. An abstract base class cannot be returned by value. + + An alternative design would be to add an abstract base class + that the ACE maps would derive fro Unfortunately, this would + break many things including the ability to add these maps to + shared memory and explicit template instantiations. + + This mini framework would have been idle to apply the external + polymorphism pattern. However, the ACE map classes are + different enough that adaption was necessary. This turned out + to be a blessing in disguise since I was able to add extra + common functionality such as the key generator and key adapter + to the map adapters. I did add the external polymorphic + subclasses to the framework for future use. + + The classes in this framework are as close STL containers as I + would dare to make them ;) Thanks to Carlos for helping design + them. + + * tests/Map_Test: New test to illustrate and test the workings of + the new ACE Map classes. There are two aspect to this test: + (a) functionality testing includes testing the iterators and + various operations, and (b) performance testing to compare the + relative performance of the maps. + + * ace/Pair: Added new Pair class to ACE that holds instances of + the template arguments. Also, added a Reference_Pair class that + only hold references of the template arguments. + + * ace/Hash_Map_Manager_T.* (ACE_Hash_Map_Manager_Ex): + * ace/Map_Manager.* (Map_Manager): + Added new rebind() methods to make interface compatible with + other maps. Also, fixed the constness of some functions. + + * ace/Hash_Map_Manager.h: Fixed order of inclusion of template + code. + + * ace/Active_Map_Manager_T.h (ACE_Active_Map_Manager): Added new + versions of bind, find, and unbind to reduce the number of data + copies. + + * ace/Active_Map_Manager.h (ACE_Active_Map_Manager_Key): Added the + ability for the active key to encode and decode into and out of + a data stream. This relieves the developer from concerning + herself about the internal structure of the active key. + + * ace/config-win32-common.h: Define WIN32 if not already defined. + + * tests/SString_Test.cpp: Added testing for substring creation and + comparisons. + + * ace/OS.h (ACE_dynamic_cast_*_ptr and ACE_dynamic_cast_*_ref): + Added new macros to handle casting of template class. + + * tests/test_config.h: Removed global KEY class that was not being + used anymore anyway. + Fri Feb 05 21:12:56 1999 Douglas C. Schmidt <schmidt@cs.wustl.edu> * ACE version 4.6.20 released. diff --git a/ace/Active_Map_Manager.h b/ace/Active_Map_Manager.h index b28d45f5ea8..90e98caaa7a 100644 --- a/ace/Active_Map_Manager.h +++ b/ace/Active_Map_Manager.h @@ -43,24 +43,31 @@ public: // generation number from the client. u_long index (void) const; - // Get the index. + void index (u_long i); + // Get/Set the index. u_long generation (void) const; - // Get the generation number. + void generation (u_long g); + // Get/Set the generation number. + static size_t size (void); + // Size required to store information about active key. + + void decode (const void *data); + // Recover state of active key from <data>. User must make sure + // that <data> encoded using the <encode> method. + + void encode (void *data) const; + // Encode state of the active key into <data>. <data> must be as + // big as the value returned from <size>. + int operator== (const ACE_Active_Map_Manager_Key &rhs) const; int operator!= (const ACE_Active_Map_Manager_Key &rhs) const; // Compare keys. - // = These really should be protected but because of template + // = This really should be protected but because of template // friends, they are not. - void index (u_long i); - // Set the index. - - void generation (u_long g); - // Set the generation number. - void increment_generation_count (void); // Increment the generation number. diff --git a/ace/Active_Map_Manager.i b/ace/Active_Map_Manager.i index 080b6fd74d1..8980a49002f 100644 --- a/ace/Active_Map_Manager.i +++ b/ace/Active_Map_Manager.i @@ -61,3 +61,49 @@ ACE_Active_Map_Manager_Key::increment_generation_count (void) ++this->generation_; } +/* static */ +ACE_INLINE size_t +ACE_Active_Map_Manager_Key::size (void) +{ + return sizeof (u_long) + sizeof (u_long); +} + +ACE_INLINE void +ACE_Active_Map_Manager_Key::decode (const void *d) +{ + // Cast so that we can do pointer arithmetic. + const char *data = (const char *) d; + + // Grab the index first. + ACE_OS::memcpy (&this->index_, + data, + sizeof this->index_); + + // Move along... + data += sizeof this->index_; + + // Grab the generation second. + ACE_OS::memcpy (&this->generation_, + data, + sizeof this->generation_); +} + +ACE_INLINE void +ACE_Active_Map_Manager_Key::encode (void *d) const +{ + // Cast so that we can do pointer arithmetic. + char *data = (char *) d; + + // Grab the index first. + ACE_OS::memcpy (data, + &this->index_, + sizeof this->index_); + + // Move along... + data += sizeof this->index_; + + // Grab the generation second. + ACE_OS::memcpy (data, + &this->generation_, + sizeof this->generation_); +} diff --git a/ace/Active_Map_Manager_T.cpp b/ace/Active_Map_Manager_T.cpp index b7432589dc0..a544bc28fda 100644 --- a/ace/Active_Map_Manager_T.cpp +++ b/ace/Active_Map_Manager_T.cpp @@ -17,4 +17,4 @@ ACE_RCSID(ace, Active_Map_Manager_T, "$Id$") ACE_ALLOC_HOOK_DEFINE(ACE_Active_Map_Manager) -#endif /* ACE_ACTIVE_MAP_MANAGER_C */ +#endif /* ACE_ACTIVE_MAP_MANAGER_T_C */ diff --git a/ace/Active_Map_Manager_T.h b/ace/Active_Map_Manager_T.h index 9e95fdc1b0f..1c5201e7860 100644 --- a/ace/Active_Map_Manager_T.h +++ b/ace/Active_Map_Manager_T.h @@ -77,6 +77,21 @@ public: // Add <value> to the map. The user does not care about the // corresponding key produced by the Active_Map_Manager. + int bind (ACE_Active_Map_Manager_Key &key, + T *&internal_value); + // Reserves a slot in the internal structure and returns the key and + // a pointer to the value. User should place their <value> into + // <*internal_value>. This method is useful in reducing the number + // of copies required in some cases. Note that <internal_value> is + // only a temporary pointer and will change when the map resizes. + // Therefore, the user should use the pointer immediately and not + // hold on to it. + + int rebind (const ACE_Active_Map_Manager_Key &key, + const T &value); + // Reassociate <key> with <value>. The function fails if <key> is + // not in the map. + int rebind (const ACE_Active_Map_Manager_Key &key, const T &value, T &old_value); @@ -85,9 +100,12 @@ public: // in the map. int rebind (const ACE_Active_Map_Manager_Key &key, - const T &value); - // Reassociate <key> with <value>. The function fails if <key> is - // not in the map. + const T &value, + ACE_Active_Map_Manager_Key &old_key, + T &old_value); + // Reassociate <key> with <value>, storing the old key and value + // into the "out" parameter <old_key> and <old_value>. The function + // fails if <key> is not in the map. int find (const ACE_Active_Map_Manager_Key &key, T &value); @@ -96,13 +114,34 @@ public: int find (const ACE_Active_Map_Manager_Key &key); // Is <key> in the map? + int find (const ACE_Active_Map_Manager_Key &key, + T *&internal_value); + // Locate <value> associated with <key>. The value is returned via + // <internal_value> and hence a copy is saved. Note that + // <internal_value> is only a temporary pointer and will change when + // the map resizes. Therefore, the user should use the pointer + // immediately and not hold on to it. + + // Creates a key. User should place their <value> into + // <*internal_value>. This method is useful in reducing the number + // of copies required in some cases. + int unbind (const ACE_Active_Map_Manager_Key &key); // Remove <key> from the map. - int unbind (const ACE_Active_Map_Manager_Key &key, T &value); + int unbind (const ACE_Active_Map_Manager_Key &key, + T &value); // Remove <key> from the map, and return the <value> associated with // <key>. + int unbind (const ACE_Active_Map_Manager_Key &key, + T *&internal_value); + // Locate <value> associated with <key>. The value is returned via + // <internal_value> and hence a copy is saved. Note that + // <internal_value> is only a temporary pointer and will change when + // the map resizes or when this slot is reused. Therefore, the user + // should use the pointer immediately and not hold on to it. + size_t current_size (void); // Return the current size of the map. @@ -130,12 +169,6 @@ protected: typedef ACE_Map_Manager<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> ACE_AMM_BASE; // Private base class - int create_key (ACE_Active_Map_Manager_Key &key); - // Creates a key. - - void shared_unbind (const ACE_Active_Map_Manager_Key &key); - // Remove <key> from the map. - private: // = Disallow these operations. diff --git a/ace/Active_Map_Manager_T.i b/ace/Active_Map_Manager_T.i index 357a154db29..b3bffe68fac 100644 --- a/ace/Active_Map_Manager_T.i +++ b/ace/Active_Map_Manager_T.i @@ -1,7 +1,8 @@ // $Id$ template <class T> ACE_INLINE int -ACE_Active_Map_Manager<T>::create_key (ACE_Active_Map_Manager_Key &key) +ACE_Active_Map_Manager<T>::bind (ACE_Active_Map_Manager_Key &key, + T *&internal_value) { size_t index; int result = this->next_free (index); @@ -17,38 +18,44 @@ ACE_Active_Map_Manager<T>::create_key (ACE_Active_Map_Manager_Key &key) // Copy the key for the user. key = this->search_structure_[index].ext_id_; + + // This is where the user should place the value. + internal_value = &this->search_structure_[index].int_id_; + + // Update the current size. + ++this->cur_size_; } return result; } template <class T> ACE_INLINE int -ACE_Active_Map_Manager<T>::bind (const T &value) -{ - ACE_Active_Map_Manager_Key key; - return this->bind (value, key); -} - -template <class T> ACE_INLINE int ACE_Active_Map_Manager<T>::bind (const T &value, ACE_Active_Map_Manager_Key &key) { - int result = this->create_key (key); + T *internal_value = 0; + int result = this->bind (key, + internal_value); if (result == 0) { // Store new value. - this->search_structure_[key.index ()].int_id_ = value; - - // Update the current size. - ++this->cur_size_; + *internal_value = value; } return result; } template <class T> ACE_INLINE int -ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key) +ACE_Active_Map_Manager<T>::bind (const T &value) +{ + ACE_Active_Map_Manager_Key key; + return this->bind (value, key); +} + +template <class T> ACE_INLINE int +ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key, + T *&internal_value) { size_t index = key.index (); size_t generation = key.generation (); @@ -56,22 +63,52 @@ ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key) if (index > this->total_size_ || this->search_structure_[index].ext_id_.generation () != generation || this->search_structure_[index].ext_id_.index () == this->free_list_id ()) - return -1; + { + return -1; + } + else + { + // This is where the user value is. + internal_value = &this->search_structure_[index].int_id_; + } return 0; } template <class T> ACE_INLINE int +ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key) +{ + T *internal_value = 0; + return this->find (key, + internal_value); +} + +template <class T> ACE_INLINE int ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key, T &value) { + T *internal_value = 0; + int result = this->find (key, + internal_value); + + if (result == 0) + { + value = *internal_value; + } + + return result; +} + +template <class T> ACE_INLINE int +ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key, + const T &value) +{ int result = this->find (key); if (result == 0) { - // Get current value for key. - size_t index = key.index (); - value = this->search_structure_[index].int_id_; + // Store new value. + this->search_structure_[key.index ()].int_id_ = value; } return result; @@ -98,12 +135,20 @@ ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key, template <class T> ACE_INLINE int ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key, - const T &value) + const T &value, + ACE_Active_Map_Manager_Key &old_key, + T &old_value) { int result = this->find (key); if (result == 0) { + // Copy old key. + old_key = this->search_structure_[key.index ()].ext_id_; + + // Copy old value. + old_value = this->search_structure_[key.index ()].int_id_; + // Store new value. this->search_structure_[key.index ()].int_id_ = value; } @@ -111,35 +156,42 @@ ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key, return result; } -template <class T> ACE_INLINE void -ACE_Active_Map_Manager<T>::shared_unbind (const ACE_Active_Map_Manager_Key &key) +template <class T> ACE_INLINE int +ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key, + T *&internal_value) { - size_t index = key.index (); + int result = this->find (key, + internal_value); + + if (result == 0) + { + size_t index = key.index (); + + // Move from occupied list to free list + this->move_from_occupied_list_to_free_list (index); - // Move from occupied list to free list - this->move_from_occupied_list_to_free_list (index); + // Reset the index. This will tell us that this entry is free. + this->search_structure_[index].ext_id_.index (this->free_list_id ()); - // Reset the index. This will tell us that this entry is free. - this->search_structure_[index].ext_id_.index (this->free_list_id ()); + // Update the current size. + --this->cur_size_; + } - // Update the current size. - --this->cur_size_; + return result; } template <class T> ACE_INLINE int ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key, T &value) { - int result = this->find (key); + T *internal_value; + int result = this->unbind (key, + internal_value); if (result == 0) { // Copy old value. - size_t index = key.index (); - value = this->search_structure_[index].int_id_; - - // Unbind. - this->shared_unbind (key); + value = *internal_value; } return result; @@ -148,15 +200,9 @@ ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key, template <class T> ACE_INLINE int ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key) { - int result = this->find (key); - - if (result == 0) - { - // Unbind. - this->shared_unbind (key); - } - - return result; + T *internal_value; + return this->unbind (key, + internal_value); } template <class T> ACE_INLINE diff --git a/ace/Hash_Map_Manager.h b/ace/Hash_Map_Manager.h index f2735981288..a7b455152a8 100644 --- a/ace/Hash_Map_Manager.h +++ b/ace/Hash_Map_Manager.h @@ -24,12 +24,11 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Include the templates here. -#include "ace/Hash_Map_Manager_T.h" - #if defined (__ACE_INLINE__) #include "ace/Hash_Map_Manager.i" #endif /* __ACE_INLINE__ */ +// Include the templates here. +#include "ace/Hash_Map_Manager_T.h" + #endif /* ACE_HASH_MAP_MANAGER_H */ diff --git a/ace/Hash_Map_Manager_T.cpp b/ace/Hash_Map_Manager_T.cpp index 1921304ccb1..8d1dc0161d5 100644 --- a/ace/Hash_Map_Manager_T.cpp +++ b/ace/Hash_Map_Manager_T.cpp @@ -295,6 +295,40 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::share 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, + 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 + { + entry->ext_id_ = ext_id; + entry->int_id_ = int_id; + 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>::rebind_i (const EXT_ID &ext_id, + const INT_ID &int_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_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 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) diff --git a/ace/Hash_Map_Manager_T.h b/ace/Hash_Map_Manager_T.h index e9ab623d08c..b963bedefae 100644 --- a/ace/Hash_Map_Manager_T.h +++ b/ace/Hash_Map_Manager_T.h @@ -160,6 +160,37 @@ public: // newly created entry, or the existing one. int rebind (const EXT_ID &ext_id, + const INT_ID &int_id); + // Reassociate <ext_id> with <int_id>. If <ext_id> is not in the + // map then behaves just like <bind>. 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, + 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 rebind (const EXT_ID &ext_id, + const INT_ID &int_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 value of + // <int_id> into the "out" parameter and rebind the new parameters. + // 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, + 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 rebind (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id); @@ -167,8 +198,8 @@ public: // 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 + // 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. @@ -266,6 +297,26 @@ protected: // Performs trybind. Must be called with locks held. int rebind_i (const EXT_ID &ext_id, + const INT_ID &int_id); + // Performs rebind. Must be called with locks held. + + int rebind_i (const EXT_ID &ext_id, + const INT_ID &int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); + // Performs rebind. Must be called with locks held. + + int rebind_i (const EXT_ID &ext_id, + const INT_ID &int_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, + INT_ID &old_int_id, + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry); + // 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); @@ -360,14 +411,14 @@ public: // = ITERATION methods. - int next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&next_entry); + int next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&next_entry) const; // 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); + ACE_Hash_Map_Entry<EXT_ID, INT_ID>& operator* (void) const; // 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); diff --git a/ace/Hash_Map_Manager_T.i b/ace/Hash_Map_Manager_T.i index c0decdeaf7e..1f5f8e015f2 100644 --- a/ace/Hash_Map_Manager_T.i +++ b/ace/Hash_Map_Manager_T.i @@ -224,6 +224,30 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find 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) +{ + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node; + + return this->rebind_i (ext_id, + 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_i (const EXT_ID &ext_id, + const INT_ID &int_id, + INT_ID &old_int_id) +{ + ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node; + + return this->rebind_i (ext_id, + int_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_i (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id) @@ -239,6 +263,46 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin 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) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->rebind_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>::rebind (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->rebind_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>::rebind (const EXT_ID &ext_id, + const INT_ID &int_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_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, + 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_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>::rebind (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id) @@ -302,7 +366,7 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>: } 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_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) const { ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next"); @@ -330,7 +394,7 @@ ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>: 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_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator* (void) const { 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; diff --git a/ace/Makefile b/ace/Makefile index 4dc5a4d3dc8..93640e7529b 100644 --- a/ace/Makefile +++ b/ace/Makefile @@ -59,6 +59,7 @@ FILES = Log_Msg \ LSOCK_Stream \ Log_Record \ Malloc \ + Map \ Mem_Map \ Memory_Pool \ Message_Block \ @@ -173,6 +174,7 @@ TEMPLATE_FILES = \ Malloc_T \ Managed_Object \ Map_Manager \ + Map_T \ Message_Block_T \ Message_Queue_T \ Module \ diff --git a/ace/Map.cpp b/ace/Map.cpp new file mode 100644 index 00000000000..f5ff9e3e60e --- /dev/null +++ b/ace/Map.cpp @@ -0,0 +1,25 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Map.cpp +// +// = AUTHOR +// Irfan Pyarali +// +// ============================================================================ + +#define ACE_BUILD_DLL + +#include "ace/Map.h" + +ACE_RCSID(ace, Map, "$Id$") + +#if !defined (__ACE_INLINE__) +#include "ace/Map.i" +#endif /* __ACE_INLINE__ */ + diff --git a/ace/Map.h b/ace/Map.h new file mode 100644 index 00000000000..de488018258 --- /dev/null +++ b/ace/Map.h @@ -0,0 +1,33 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Map.h +// +// = AUTHOR +// Irfan Pyarali +// +// ============================================================================ + +#ifndef ACE_MAP_H +#define ACE_MAP_H + +#include "ace/OS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (__ACE_INLINE__) +#include "ace/Map.i" +#endif /* __ACE_INLINE__ */ + +// Include the templates here. +#include "ace/Map_T.h" + +#endif /* ACE_MAP_H */ diff --git a/ace/Map.i b/ace/Map.i new file mode 100644 index 00000000000..74e88caa0c5 --- /dev/null +++ b/ace/Map.i @@ -0,0 +1,2 @@ +// $Id$ + diff --git a/ace/Map_Manager.cpp b/ace/Map_Manager.cpp index 781b5af7d53..92ddb7572bd 100644 --- a/ace/Map_Manager.cpp +++ b/ace/Map_Manager.cpp @@ -245,6 +245,38 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind_i (const EXT_ID &ext_id, template <class EXT_ID, class INT_ID, class ACE_LOCK> int ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind_i (const EXT_ID &ext_id, + const INT_ID &int_id, + INT_ID &old_int_id) +{ + // First try to find the key. + size_t index = 0; + int result = this->find_and_return_index (ext_id, + index); + + if (result == 0) + { + // We found it, so make copies of the old entries and rebind + // current entries. + ENTRY &ss = this->search_structure_[index]; + old_int_id = ss.int_id_; + ss.ext_id_ = ext_id; + ss.int_id_ = int_id; + + // Sync changed entry. + this->allocator_->sync (&ss, sizeof ss); + + return 1; + } + else + { + // We didn't find it, so let's add it. + return this->shared_bind (ext_id, + int_id); + } +} + +template <class EXT_ID, class INT_ID, class ACE_LOCK> int +ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind_i (const EXT_ID &ext_id, const INT_ID &int_id) { diff --git a/ace/Map_Manager.h b/ace/Map_Manager.h index 93b9adc5b08..d2d7d26e303 100644 --- a/ace/Map_Manager.h +++ b/ace/Map_Manager.h @@ -159,6 +159,16 @@ public: // and returns -1 if failures occur. int rebind (const EXT_ID &ext_id, + const INT_ID &int_id, + INT_ID &old_int_id); + // Reassociate <ext_id> with <int_id>. If <ext_id> is not in the + // map then behaves just like <bind>. Otherwise, store the old + // values of <int_id> into the "out" parameter and rebind the new + // parameters. 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); // Reassociate <ext_id> with <int_id>. Old values in the map are // ignored. @@ -247,6 +257,12 @@ protected: // values. Must be called with locks held. int rebind_i (const EXT_ID &ext_id, + const INT_ID &int_id, + INT_ID &old_int_id); + // Performs a rebinding of <ext_it> to <int_id>. Also, recovers old + // values. Must be called with locks held. + + int rebind_i (const EXT_ID &ext_id, const INT_ID &int_id); // Performs a rebinding of <ext_it> to <int_id>. Must be called // with locks held. @@ -375,14 +391,14 @@ public: // = Iteration methods. - int next (ACE_Map_Entry<EXT_ID, INT_ID> *&next_entry); + int next (ACE_Map_Entry<EXT_ID, INT_ID> *&next_entry) const; // 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_Map_Entry<EXT_ID, INT_ID>& operator* (void); + ACE_Map_Entry<EXT_ID, INT_ID>& operator* (void) const; // Returns a reference to the interal element <this> is pointing to. ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>& map (void); diff --git a/ace/Map_Manager.i b/ace/Map_Manager.i index 816eaccc890..959ec90966d 100644 --- a/ace/Map_Manager.i +++ b/ace/Map_Manager.i @@ -95,6 +95,28 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind (const EXT_ID &ext_id, } template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int +ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind (const EXT_ID &ext_id, + const INT_ID &int_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_int_id); +} + +template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int +ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rebind (const EXT_ID &ext_id, + const INT_ID &int_id) +{ + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + return this->rebind_i (ext_id, + int_id); +} + +template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::trybind (const EXT_ID &ext_id, INT_ID &int_id) { @@ -250,7 +272,7 @@ ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Iterator_Base (ACE_Map_ } template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE int -ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::next (ACE_Map_Entry<EXT_ID, INT_ID> *&mm) +ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::next (ACE_Map_Entry<EXT_ID, INT_ID> *&mm) const { if (this->next_ != this->map_man_.occupied_list_id ()) { @@ -301,7 +323,7 @@ ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::reverse_i (void) template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE ACE_Map_Entry<EXT_ID, INT_ID>& -ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator* (void) +ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::operator* (void) const { ACE_Map_Entry<EXT_ID, INT_ID> *retv = 0; diff --git a/ace/Map_T.cpp b/ace/Map_T.cpp new file mode 100644 index 00000000000..e2329089630 --- /dev/null +++ b/ace/Map_T.cpp @@ -0,0 +1,18 @@ +// $Id$ + +#ifndef ACE_MAP_T_C +#define ACE_MAP_T_C + +#include "ace/Map_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Map_T.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Map_T, "$Id$") + +#endif /* ACE_MAP_T_C */ diff --git a/ace/Map_T.h b/ace/Map_T.h new file mode 100644 index 00000000000..2f145845eb2 --- /dev/null +++ b/ace/Map_T.h @@ -0,0 +1,1435 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Map_T.h +// +// = AUTHOR +// Irfan Pyarali +// +// ============================================================================ + +#ifndef ACE_MAP_T_H +#define ACE_MAP_T_H + +#include "ace/Map.h" +#include "ace/Pair.h" +#include "ace/Map_Manager.h" +#include "ace/Hash_Map_Manager.h" +#include "ace/Active_Map_Manager.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> +class ACE_Incremental_Key_Generator +{ + // = TITLE + // Defines a simple incremental key generator. + // + // = DESCRIPTION + // Generates a new key of type T by incrementing current + // value. Requirements on T are: + // + // - Constructor that accepts 0 in the constructor. + // - Prefix increment. + // - Assignment. + // + // Note that a primitive types such as u_long, int, etc., are + // suitable for this class. +public: + + ACE_Incremental_Key_Generator (void); + // Constructor. + + int operator() (T &t); + // Functor method: generates a new key. + + T& current_value (void); + // Returns the current value. + +protected: + + T t_; + // Current value. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> +class ACE_Iterator_Impl +{ + // = TITLE + // Defines a abstract iterator. + // + // = DESCRIPTION + // Implementation to be provided by subclasses. +public: + + virtual ~ACE_Iterator_Impl (void); + // Destructor. + + virtual ACE_Iterator_Impl<T> *clone (void) const = 0; + // Clone. + + virtual int compare (const ACE_Iterator_Impl<T> &rhs) const = 0; + // Comparison. + + virtual T dereference () const = 0; + // Dereference. + + virtual void plus_plus (void) = 0; + // Advance. + + virtual void minus_minus (void) = 0; + // Reverse. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> +class ACE_Reverse_Iterator_Impl +{ + // = TITLE + // Defines a abstract reverse iterator. + // + // = DESCRIPTION + // Implementation to be provided by subclasses. +public: + + virtual ~ACE_Reverse_Iterator_Impl (void); + // Destructor. + + virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const = 0; + // Clone. + + virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const = 0; + // Comparison. + + virtual T dereference () const = 0; + // Dereference. + + virtual void plus_plus (void) = 0; + // Advance. + + virtual void minus_minus (void) = 0; + // Reverse. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> +class ACE_Iterator +{ + // = TITLE + // Defines the iterator interface. + // + // = DESCRIPTION + // Implementation to be provided by forwarding. +public: + + // = Traits. + typedef T value_type; + typedef ACE_Iterator_Impl<T> implementation; + + ACE_Iterator (implementation *impl); + // Constructor. + + ACE_Iterator (const ACE_Iterator<T> &rhs); + // Copy constructor. + + ~ACE_Iterator (void); + // Destructor. + + ACE_Iterator<T> &operator= (const ACE_Iterator<T> &rhs); + // Assignment operator. + + int operator== (const ACE_Iterator<T> &rhs) const; + int operator!= (const ACE_Iterator<T> &rhs) const; + // Comparison operators. + + T operator* () const; + // Dereference operator. + + ACE_Iterator<T> &operator++ (void); + // Prefix advance. + + ACE_Iterator<T> operator++ (int); + // Postfix advance. + + ACE_Iterator<T> &operator-- (void); + // Prefix reverse. + + ACE_Iterator<T> operator-- (int); + // Postfix reverse. + + implementation &impl (void); + // Accessor to implementation object. + +protected: + + implementation *implementation_; + // Implementation pointer. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> +class ACE_Reverse_Iterator +{ + // = TITLE + // Defines the reverse iterator interface. + // + // = DESCRIPTION + // Implementation to be provided by forwarding. +public: + + // = Traits. + typedef T value_type; + typedef ACE_Reverse_Iterator_Impl<T> implementation; + + ACE_Reverse_Iterator (implementation *impl); + // Constructor. + + ACE_Reverse_Iterator (const ACE_Reverse_Iterator<T> &rhs); + // Copy constructor. + + ~ACE_Reverse_Iterator (void); + // Destructor. + + ACE_Reverse_Iterator<T> &operator= (const ACE_Reverse_Iterator<T> &rhs); + // Assignment operator. + + int operator== (const ACE_Reverse_Iterator<T> &rhs) const; + int operator!= (const ACE_Reverse_Iterator<T> &rhs) const; + // Comparison operators. + + T operator* () const; + // Dereference operator. + + ACE_Reverse_Iterator<T> &operator++ (void); + // Prefix advance. + + ACE_Reverse_Iterator<T> operator++ (int); + // Postfix advance. + + ACE_Reverse_Iterator<T> &operator-- (void); + // Prefix reverse. + + ACE_Reverse_Iterator<T> operator-- (int); + // Postfix reverse. + + implementation &impl (void); + // Accessor to implementation object. + +protected: + + implementation *implementation_; + // Implementation pointer. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class KEY, class VALUE> +class ACE_Map +{ + // = TITLE + // Defines a map interface. + // + // = DESCRIPTION + // Implementation to be provided by subclasses. +public: + + // = Traits. + typedef KEY key_type; + typedef VALUE mapped_type; + typedef ACE_Reference_Pair<const KEY, VALUE> value_type; + typedef ACE_Iterator<value_type> iterator; + typedef ACE_Reverse_Iterator<value_type> reverse_iterator; + typedef ACE_Iterator_Impl<value_type> iterator_implementation; + typedef ACE_Reverse_Iterator_Impl<value_type> reverse_iterator_implementation; + + virtual ~ACE_Map (void); + // Close down and release dynamically allocated resources. + + virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE, + ACE_Allocator *alloc = 0) = 0; + // Initialize a <Map> with size <length>. + + virtual int close (void) = 0; + // Close down a <Map> and release dynamically allocated resources. + + virtual int bind (const KEY &key, + const VALUE &value) = 0; + // Add <key>/<value> pair to the map. If <key> is already in the + // map then no changes are made and 1 is returned. Returns 0 on a + // successful addition. This function fails for maps that do not + // allow user specified keys. <key> is an "in" parameter. + + virtual int bind_modify_key (const VALUE &value, + KEY &key) = 0; + // Add <key>/<value> pair to the map. <key> is an "inout" parameter + // and maybe modified/extended by the map to add additional + // information. To recover original key, call the <recover_key> + // method. + + virtual int bind_create_key (const VALUE &value, + KEY &key) = 0; + // Add <value> to the map, and the corresponding key produced by the + // Map is returned through <key> which is an "out" parameter. For + // maps that do not naturally produce keys, the map adapters will + // use the <KEY_GENERATOR> class to produce a key. However, the + // users are responsible for not jeopardizing this key production + // scheme by using user specified keys with keys produced by the key + // generator. + + virtual int bind_create_key (const VALUE &value) = 0; + // Add <value> to the map. The user does not care about the + // corresponding key produced by the Map. For maps that do not + // naturally produce keys, the map adapters will use the + // <KEY_GENERATOR> class to produce a key. However, the users are + // responsible for not jeopardizing this key production scheme by + // using user specified keys with keys produced by the key + // generator. + + virtual int recover_key (const KEY &modified_key, + KEY &original_key) = 0; + // Recovers the original key potentially modified by the map during + // <bind_modify_key>. + + virtual int rebind (const KEY &key, + const VALUE &value) = 0; + // Reassociate <key> with <value>. The function fails if <key> is + // not in the map for maps that do not allow user specified keys. + // However, for maps that allow user specified keys, if the key is + // not in the map, a new <key>/<value> association is created. + + virtual int rebind (const KEY &key, + const VALUE &value, + VALUE &old_value) = 0; + // Reassociate <key> with <value>, storing the old value into the + // "out" parameter <old_value>. The function fails if <key> is not + // in the map for maps that do not allow user specified keys. + // However, for maps that allow user specified keys, if the key is + // not in the map, a new <key>/<value> association is created. + + virtual int rebind (const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value) = 0; + // Reassociate <key> with <value>, storing the old key and value + // into the "out" parameters <old_key> and <old_value>. The + // function fails if <key> is not in the map for maps that do not + // allow user specified keys. However, for maps that allow user + // specified keys, if the key is not in the map, a new <key>/<value> + // association is created. + + virtual int trybind (const KEY &key, + VALUE &value) = 0; + // Associate <key> with <value> if and only if <key> is not in the + // map. If <key> is already in the map, then the <value> parameter + // is overwritten with the existing value in the map. Returns 0 if a + // new <key>/<value> association is created. Returns 1 if an + // attempt is made to bind an existing entry. This function fails + // for maps that do not allow user specified keys. + + virtual int find (const KEY &key, + VALUE &value) = 0; + // Locate <value> associated with <key>. + + virtual int find (const KEY &key) = 0; + // Is <key> in the map? + + virtual int unbind (const KEY &key) = 0; + // Remove <key> from the map. + + virtual int unbind (const KEY &key, + VALUE &value) = 0; + // Remove <key> from the map, and return the <value> associated with + // <key>. + + virtual size_t current_size (void) = 0; + // Return the current size of the map. + + virtual size_t total_size (void) = 0; + // Return the total size of the map. + + virtual void dump (void) const = 0; + // Dump the state of an object. + + // = STL styled iterator factory functions. + + iterator begin (void); + iterator end (void); + // Return forward iterator. + + reverse_iterator rbegin (void); + reverse_iterator rend (void); + // Return reverse iterator. + +protected: + + // = Protected no-op constructor. + ACE_Map (void); + + virtual iterator_implementation *begin_impl (void) = 0; + virtual iterator_implementation *end_impl (void) = 0; + // Return forward iterator. + + virtual reverse_iterator_implementation *rbegin_impl (void) = 0; + virtual reverse_iterator_implementation *rend_impl (void) = 0; + // Return reverse iterator. + +private: + + // = Disallow these operations. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Map<KEY, VALUE> &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Map (const ACE_Map<KEY, VALUE> &)) +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class IMPLEMENTATION, class ENTRY> +class ACE_Map_Impl_Iterator_Adapter : public ACE_Iterator_Impl<T> +{ + // = TITLE + // Defines a iterator implementation for the Map_Impl class. + // + // = DESCRIPTION + // Implementation to be provided by <IMPLEMENTATION>. +public: + + // = Traits. + typedef IMPLEMENTATION implementation; + + ACE_Map_Impl_Iterator_Adapter (const implementation &impl); + // Constructor. + + virtual ~ACE_Map_Impl_Iterator_Adapter (void); + // Destructor. + + virtual ACE_Iterator_Impl<T> *clone (void) const; + // Clone. + + virtual int compare (const ACE_Iterator_Impl<T> &rhs) const; + // Comparison. + + virtual T dereference () const; + // Dereference. + + virtual void plus_plus (void); + // Advance. + + virtual void minus_minus (void); + // Reverse. + + implementation &impl (void); + // Accessor to implementation object. + +protected: + + implementation implementation_; + // All implementation details are forwarded to this class. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class IMPLEMENTATION, class ENTRY> +class ACE_Map_Impl_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T> +{ + // = TITLE + // Defines a reverse iterator implementation for the Map_Impl class. + // + // = DESCRIPTION + // Implementation to be provided by IMPLEMENTATION. +public: + + // = Traits. + typedef IMPLEMENTATION implementation; + + ACE_Map_Impl_Reverse_Iterator_Adapter (const implementation &impl); + // Constructor. + + virtual ~ACE_Map_Impl_Reverse_Iterator_Adapter (void); + // Destructor. + + virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const; + // Clone. + + virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const; + // Comparison. + + virtual T dereference () const; + // Dereference. + + virtual void plus_plus (void); + // Advance. + + virtual void minus_minus (void); + // Reverse. + + implementation &impl (void); + // Accessor to implementation object. + +protected: + + implementation implementation_; + // All implementation details are forwarded to this class. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class KEY, class VALUE, class IMPLEMENTATION> +class ACE_Map_Impl : public ACE_Map<KEY, VALUE> +{ + // = TITLE + // Defines a map implementation. + // + // = DESCRIPTION + // Implementation to be provided by <IMPLEMENTATION>. +public: + + // = Traits. + typedef ACE_Map_Impl_Iterator_Adapter<value_type, IMPLEMENTATION::iterator, IMPLEMENTATION::ENTRY> iterator_impl; + typedef ACE_Map_Impl_Reverse_Iterator_Adapter<value_type, IMPLEMENTATION::reverse_iterator, IMPLEMENTATION::ENTRY> reverse_iterator_impl; + typedef IMPLEMENTATION implementation; + + // = Initialization and termination methods. + ACE_Map_Impl (ACE_Allocator *alloc = 0); + // Initialize with the <ACE_DEFAULT_MAP_SIZE>. + + ACE_Map_Impl (size_t size, + ACE_Allocator *alloc = 0); + // Initialize with <size> entries. The <size> parameter is ignore + // by maps for which an initialize size does not make sense. + + virtual ~ACE_Map_Impl (void); + // Close down and release dynamically allocated resources. + + virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE, + ACE_Allocator *alloc = 0); + // Initialize a <Map> with size <length>. + + virtual int close (void); + // Close down a <Map> and release dynamically allocated resources. + + virtual int bind (const KEY &key, + const VALUE &value); + // Add <key>/<value> pair to the map. If <key> is already in the + // map then no changes are made and 1 is returned. Returns 0 on a + // successful addition. This function fails for maps that do not + // allow user specified keys. <key> is an "in" parameter. + + virtual int bind_modify_key (const VALUE &value, + KEY &key); + // Add <key>/<value> pair to the map. <key> is an "inout" parameter + // and maybe modified/extended by the map to add additional + // information. To recover original key, call the <recover_key> + // method. + + virtual int bind_create_key (const VALUE &value, + KEY &key); + // Add <value> to the map, and the corresponding key produced by the + // Map is returned through <key> which is an "out" parameter. For + // maps that do not naturally produce keys, the map adapters will + // use the <KEY_GENERATOR> class to produce a key. However, the + // users are responsible for not jeopardizing this key production + // scheme by using user specified keys with keys produced by the key + // generator. + + virtual int bind_create_key (const VALUE &value); + // Add <value> to the map. The user does not care about the + // corresponding key produced by the Map. For maps that do not + // naturally produce keys, the map adapters will use the + // <KEY_GENERATOR> class to produce a key. However, the users are + // responsible for not jeopardizing this key production scheme by + // using user specified keys with keys produced by the key + // generator. + + virtual int recover_key (const KEY &modified_key, + KEY &original_key); + // Recovers the original key potentially modified by the map during + // <bind_modify_key>. + + virtual int rebind (const KEY &key, + const VALUE &value); + // Reassociate <key> with <value>. The function fails if <key> is + // not in the map for maps that do not allow user specified keys. + // However, for maps that allow user specified keys, if the key is + // not in the map, a new <key>/<value> association is created. + + virtual int rebind (const KEY &key, + const VALUE &value, + VALUE &old_value); + // Reassociate <key> with <value>, storing the old value into the + // "out" parameter <old_value>. The function fails if <key> is not + // in the map for maps that do not allow user specified keys. + // However, for maps that allow user specified keys, if the key is + // not in the map, a new <key>/<value> association is created. + + virtual int rebind (const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value); + // Reassociate <key> with <value>, storing the old key and value + // into the "out" parameters <old_key> and <old_value>. The + // function fails if <key> is not in the map for maps that do not + // allow user specified keys. However, for maps that allow user + // specified keys, if the key is not in the map, a new <key>/<value> + // association is created. + + virtual int trybind (const KEY &key, + VALUE &value); + // Associate <key> with <value> if and only if <key> is not in the + // map. If <key> is already in the map, then the <value> parameter + // is overwritten with the existing value in the map. Returns 0 if a + // new <key>/<value> association is created. Returns 1 if an + // attempt is made to bind an existing entry. This function fails + // for maps that do not allow user specified keys. + + virtual int find (const KEY &key, + VALUE &value); + // Locate <value> associated with <key>. + + virtual int find (const KEY &key); + // Is <key> in the map? + + virtual int unbind (const KEY &key); + // Remove <key> from the map. + + virtual int unbind (const KEY &key, + VALUE &value); + // Remove <key> from the map, and return the <value> associated with + // <key>. + + virtual size_t current_size (void); + // Return the current size of the map. + + virtual size_t total_size (void); + // Return the total size of the map. + + virtual void dump (void) const; + // Dump the state of an object. + + implementation &impl (void); + // Accessor to implementation object. + +protected: + + implementation implementation_; + // All implementation details are forwarded to this class. + + // = STL styled iterator factory functions. + + virtual iterator_implementation *begin_impl (void); + virtual iterator_implementation *end_impl (void); + // Return forward iterator. + + virtual reverse_iterator_implementation *rbegin_impl (void); + virtual reverse_iterator_implementation *rend_impl (void); + // Return reverse iterator. + +private: + + // = Disallow these operations. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION> &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Map_Impl (const ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION> &)) +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class VALUE> +class ACE_Active_Map_Manager_Iterator_Adapter : public ACE_Iterator_Impl<T> +{ + // = TITLE + // Defines a iterator implementation for the Active_Map_Manager_Adapter. + // + // = DESCRIPTION + // Implementation to be provided by ACE_Active_Map_Manager::iterator. +public: + + // = Traits. + typedef ACE_Active_Map_Manager<VALUE>::iterator implementation; + + ACE_Active_Map_Manager_Iterator_Adapter (const implementation &impl); + // Constructor. + + virtual ~ACE_Active_Map_Manager_Iterator_Adapter (void); + // Destructor. + + virtual ACE_Iterator_Impl<T> *clone (void) const; + // Clone. + + virtual int compare (const ACE_Iterator_Impl<T> &rhs) const; + // Comparison. + + virtual T dereference () const; + // Dereference. + + virtual void plus_plus (void); + // Advance. + + virtual void minus_minus (void); + // Reverse. + + implementation &impl (void); + // Accessor to implementation object. + +protected: + + implementation implementation_; + // All implementation details are forwarded to this class. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class VALUE> +class ACE_Active_Map_Manager_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T> +{ + // = TITLE + // Defines a reverse iterator implementation for the Active_Map_Manager_Adapter. + // + // = DESCRIPTION + // Implementation to be provided by ACE_Active_Map_Manager::reverse_iterator. +public: + + // = Traits. + typedef ACE_Active_Map_Manager<VALUE>::reverse_iterator implementation; + + ACE_Active_Map_Manager_Reverse_Iterator_Adapter (const implementation &impl); + // Constructor. + + virtual ~ACE_Active_Map_Manager_Reverse_Iterator_Adapter (void); + // Destructor. + + virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const; + // Clone. + + virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const; + // Comparison. + + virtual T dereference () const; + // Dereference. + + virtual void plus_plus (void); + // Advance. + + virtual void minus_minus (void); + // Reverse. + + implementation &impl (void); + // Accessor to implementation object. + +protected: + + implementation implementation_; + // All implementation details are forwarded to this class. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class KEY, class VALUE, class KEY_ADAPTER> +class ACE_Active_Map_Manager_Adapter : public ACE_Map<KEY, VALUE> +{ + // = TITLE + // Defines a map implementation. + // + // = DESCRIPTION + // Implementation to be provided by <ACE_Active_Map_Manager>. +public: + + // = Traits. + typedef ACE_Pair<KEY, VALUE> expanded_value; + typedef ACE_Active_Map_Manager_Iterator_Adapter<value_type, expanded_value> iterator_impl; + typedef ACE_Active_Map_Manager_Reverse_Iterator_Adapter<value_type, expanded_value> reverse_iterator_impl; + typedef ACE_Active_Map_Manager<expanded_value> implementation; + + // = Initialization and termination methods. + ACE_Active_Map_Manager_Adapter (ACE_Allocator *alloc = 0); + // Initialize with the <ACE_DEFAULT_MAP_SIZE>. + + ACE_Active_Map_Manager_Adapter (size_t size, + ACE_Allocator *alloc = 0); + // Initialize with <size> entries. The <size> parameter is ignore + // by maps for which an initialize size does not make sense. + + virtual ~ACE_Active_Map_Manager_Adapter (void); + // Close down and release dynamically allocated resources. + + virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE, + ACE_Allocator *alloc = 0); + // Initialize a <Map> with size <length>. + + virtual int close (void); + // Close down a <Map> and release dynamically allocated resources. + + virtual int bind (const KEY &key, + const VALUE &value); + // Add <key>/<value> pair to the map. If <key> is already in the + // map then no changes are made and 1 is returned. Returns 0 on a + // successful addition. This function fails for maps that do not + // allow user specified keys. <key> is an "in" parameter. + + virtual int bind_modify_key (const VALUE &value, + KEY &key); + // Add <key>/<value> pair to the map. <key> is an "inout" parameter + // and maybe modified/extended by the map to add additional + // information. To recover original key, call the <recover_key> + // method. + + virtual int bind_create_key (const VALUE &value, + KEY &key); + // Add <value> to the map, and the corresponding key produced by the + // Map is returned through <key> which is an "out" parameter. For + // maps that do not naturally produce keys, the map adapters will + // use the <KEY_GENERATOR> class to produce a key. However, the + // users are responsible for not jeopardizing this key production + // scheme by using user specified keys with keys produced by the key + // generator. + + virtual int bind_create_key (const VALUE &value); + // Add <value> to the map. The user does not care about the + // corresponding key produced by the Map. For maps that do not + // naturally produce keys, the map adapters will use the + // <KEY_GENERATOR> class to produce a key. However, the users are + // responsible for not jeopardizing this key production scheme by + // using user specified keys with keys produced by the key + // generator. + + virtual int recover_key (const KEY &modified_key, + KEY &original_key); + // Recovers the original key potentially modified by the map during + // <bind_modify_key>. + + virtual int rebind (const KEY &key, + const VALUE &value); + // Reassociate <key> with <value>. The function fails if <key> is + // not in the map for maps that do not allow user specified keys. + // However, for maps that allow user specified keys, if the key is + // not in the map, a new <key>/<value> association is created. + + virtual int rebind (const KEY &key, + const VALUE &value, + VALUE &old_value); + // Reassociate <key> with <value>, storing the old value into the + // "out" parameter <old_value>. The function fails if <key> is not + // in the map for maps that do not allow user specified keys. + // However, for maps that allow user specified keys, if the key is + // not in the map, a new <key>/<value> association is created. + + virtual int rebind (const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value); + // Reassociate <key> with <value>, storing the old key and value + // into the "out" parameters <old_key> and <old_value>. The + // function fails if <key> is not in the map for maps that do not + // allow user specified keys. However, for maps that allow user + // specified keys, if the key is not in the map, a new <key>/<value> + // association is created. + + virtual int trybind (const KEY &key, + VALUE &value); + // Associate <key> with <value> if and only if <key> is not in the + // map. If <key> is already in the map, then the <value> parameter + // is overwritten with the existing value in the map. Returns 0 if a + // new <key>/<value> association is created. Returns 1 if an + // attempt is made to bind an existing entry. This function fails + // for maps that do not allow user specified keys. + + virtual int find (const KEY &key, + VALUE &value); + // Locate <value> associated with <key>. + + virtual int find (const KEY &key); + // Is <key> in the map? + + virtual int unbind (const KEY &key); + // Remove <key> from the map. + + virtual int unbind (const KEY &key, + VALUE &value); + // Remove <key> from the map, and return the <value> associated with + // <key>. + + virtual size_t current_size (void); + // Return the current size of the map. + + virtual size_t total_size (void); + // Return the total size of the map. + + virtual void dump (void) const; + // Dump the state of an object. + + implementation &impl (void); + // Accessor to implementation object. + + KEY_ADAPTER &key_adapter (void); + // Accessor to key adapter. + +protected: + + virtual int find (const KEY &key, + expanded_value *&internal_value); + // Find helper. + + virtual int unbind (const KEY &key, + expanded_value *&internal_value); + // Unbind helper. + + implementation implementation_; + // All implementation details are forwarded to this class. + + KEY_ADAPTER key_adapter_; + // Adapts between the user key and the Active_Map_Manager_Key. + + // = STL styled iterator factory functions. + + virtual iterator_implementation *begin_impl (void); + virtual iterator_implementation *end_impl (void); + // Return forward iterator. + + virtual reverse_iterator_implementation *rbegin_impl (void); + virtual reverse_iterator_implementation *rend_impl (void); + // Return reverse iterator. + +private: + + // = Disallow these operations. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER> &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Active_Map_Manager_Adapter (const ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER> &)) +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> +class ACE_Hash_Map_Manager_Ex_Iterator_Adapter : public ACE_Iterator_Impl<T> +{ + // = TITLE + // Defines a iterator implementation for the Hash_Map_Manager_Adapter. + // + // = DESCRIPTION + // Implementation to be provided by ACE_Hash_Map_Manager_Ex::iterator. +public: + + // = Traits. + typedef ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>::iterator implementation; + + ACE_Hash_Map_Manager_Ex_Iterator_Adapter (const implementation &impl); + // Constructor. + + virtual ~ACE_Hash_Map_Manager_Ex_Iterator_Adapter (void); + // Destructor. + + virtual ACE_Iterator_Impl<T> *clone (void) const; + // Clone. + + virtual int compare (const ACE_Iterator_Impl<T> &rhs) const; + // Comparison. + + virtual T dereference () const; + // Dereference. + + virtual void plus_plus (void); + // Advance. + + virtual void minus_minus (void); + // Reverse. + + implementation &impl (void); + // Accessor to implementation object. + +protected: + + implementation implementation_; + // All implementation details are forwarded to this class. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> +class ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T> +{ + // = TITLE + // Defines a reverse iterator implementation for the Hash_Map_Manager_Adapter. + // + // = DESCRIPTION + // Implementation to be provided by ACE_Hash_Map_Manager_Ex::reverse_iterator. +public: + + // = Traits. + typedef ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>::reverse_iterator implementation; + + ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter (const implementation &impl); + // Constructor. + + virtual ~ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter (void); + // Destructor. + + virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const; + // Clone. + + virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const; + // Comparison. + + virtual T dereference () const; + // Dereference. + + virtual void plus_plus (void); + // Advance. + + virtual void minus_minus (void); + // Reverse. + + implementation &impl (void); + // Accessor to implementation object. + +protected: + + implementation implementation_; + // All implementation details are forwarded to this class. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> +class ACE_Hash_Map_Manager_Ex_Adapter : public ACE_Map<KEY, VALUE> +{ + // = TITLE + // Defines a map implementation. + // + // = DESCRIPTION + // Implementation to be provided by <ACE_Hash_Map_Manager_Ex>. +public: + + // = Traits. + typedef ACE_Hash_Map_Manager_Ex_Iterator_Adapter<value_type, KEY, VALUE, HASH_KEY, COMPARE_KEYS> iterator_impl; + typedef ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<value_type, KEY, VALUE, HASH_KEY, COMPARE_KEYS> reverse_iterator_impl; + typedef ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> implementation; + + // = Initialization and termination methods. + ACE_Hash_Map_Manager_Ex_Adapter (ACE_Allocator *alloc = 0); + // Initialize with the <ACE_DEFAULT_MAP_SIZE>. + + ACE_Hash_Map_Manager_Ex_Adapter (size_t size, + ACE_Allocator *alloc = 0); + // Initialize with <size> entries. The <size> parameter is ignore + // by maps for which an initialize size does not make sense. + + virtual ~ACE_Hash_Map_Manager_Ex_Adapter (void); + // Close down and release dynamically allocated resources. + + virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE, + ACE_Allocator *alloc = 0); + // Initialize a <Map> with size <length>. + + virtual int close (void); + // Close down a <Map> and release dynamically allocated resources. + + virtual int bind (const KEY &key, + const VALUE &value); + // Add <key>/<value> pair to the map. If <key> is already in the + // map then no changes are made and 1 is returned. Returns 0 on a + // successful addition. This function fails for maps that do not + // allow user specified keys. <key> is an "in" parameter. + + virtual int bind_modify_key (const VALUE &value, + KEY &key); + // Add <key>/<value> pair to the map. <key> is an "inout" parameter + // and maybe modified/extended by the map to add additional + // information. To recover original key, call the <recover_key> + // method. + + virtual int bind_create_key (const VALUE &value, + KEY &key); + // Add <value> to the map, and the corresponding key produced by the + // Map is returned through <key> which is an "out" parameter. For + // maps that do not naturally produce keys, the map adapters will + // use the <KEY_GENERATOR> class to produce a key. However, the + // users are responsible for not jeopardizing this key production + // scheme by using user specified keys with keys produced by the key + // generator. + + virtual int bind_create_key (const VALUE &value); + // Add <value> to the map. The user does not care about the + // corresponding key produced by the Map. For maps that do not + // naturally produce keys, the map adapters will use the + // <KEY_GENERATOR> class to produce a key. However, the users are + // responsible for not jeopardizing this key production scheme by + // using user specified keys with keys produced by the key + // generator. + + virtual int recover_key (const KEY &modified_key, + KEY &original_key); + // Recovers the original key potentially modified by the map during + // <bind_modify_key>. + + virtual int rebind (const KEY &key, + const VALUE &value); + // Reassociate <key> with <value>. The function fails if <key> is + // not in the map for maps that do not allow user specified keys. + // However, for maps that allow user specified keys, if the key is + // not in the map, a new <key>/<value> association is created. + + virtual int rebind (const KEY &key, + const VALUE &value, + VALUE &old_value); + // Reassociate <key> with <value>, storing the old value into the + // "out" parameter <old_value>. The function fails if <key> is not + // in the map for maps that do not allow user specified keys. + // However, for maps that allow user specified keys, if the key is + // not in the map, a new <key>/<value> association is created. + + virtual int rebind (const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value); + // Reassociate <key> with <value>, storing the old key and value + // into the "out" parameters <old_key> and <old_value>. The + // function fails if <key> is not in the map for maps that do not + // allow user specified keys. However, for maps that allow user + // specified keys, if the key is not in the map, a new <key>/<value> + // association is created. + + virtual int trybind (const KEY &key, + VALUE &value); + // Associate <key> with <value> if and only if <key> is not in the + // map. If <key> is already in the map, then the <value> parameter + // is overwritten with the existing value in the map. Returns 0 if a + // new <key>/<value> association is created. Returns 1 if an + // attempt is made to bind an existing entry. This function fails + // for maps that do not allow user specified keys. + + virtual int find (const KEY &key, + VALUE &value); + // Locate <value> associated with <key>. + + virtual int find (const KEY &key); + // Is <key> in the map? + + virtual int unbind (const KEY &key); + // Remove <key> from the map. + + virtual int unbind (const KEY &key, + VALUE &value); + // Remove <key> from the map, and return the <value> associated with + // <key>. + + virtual size_t current_size (void); + // Return the current size of the map. + + virtual size_t total_size (void); + // Return the total size of the map. + + virtual void dump (void) const; + // Dump the state of an object. + + implementation &impl (void); + // Accessor to implementation object. + + KEY_GENERATOR &key_generator (void); + // Accessor to key generator. + +protected: + + implementation implementation_; + // All implementation details are forwarded to this class. + + KEY_GENERATOR key_generator_; + // Functor class used for generating key. + + // = STL styled iterator factory functions. + + virtual iterator_implementation *begin_impl (void); + virtual iterator_implementation *end_impl (void); + // Return forward iterator. + + virtual reverse_iterator_implementation *rbegin_impl (void); + virtual reverse_iterator_implementation *rend_impl (void); + // Return reverse iterator. + +private: + + // = Disallow these operations. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR> &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Hash_Map_Manager_Ex_Adapter (const ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR> &)) +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class KEY, class VALUE> +class ACE_Map_Manager_Iterator_Adapter : public ACE_Iterator_Impl<T> +{ + // = TITLE + // Defines a iterator implementation for the Map_Manager_Adapter. + // + // = DESCRIPTION + // Implementation to be provided by ACE_Map_Manager::iterator. +public: + + // = Traits. + typedef ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex>::iterator implementation; + + ACE_Map_Manager_Iterator_Adapter (const implementation &impl); + // Constructor. + + virtual ~ACE_Map_Manager_Iterator_Adapter (void); + // Destructor. + + virtual ACE_Iterator_Impl<T> *clone (void) const; + // Clone. + + virtual int compare (const ACE_Iterator_Impl<T> &rhs) const; + // Comparison. + + virtual T dereference () const; + // Dereference. + + virtual void plus_plus (void); + // Advance. + + virtual void minus_minus (void); + // Reverse. + + implementation &impl (void); + // Accessor to implementation object. + +protected: + + implementation implementation_; + // All implementation details are forwarded to this class. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class KEY, class VALUE> +class ACE_Map_Manager_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T> +{ + // = TITLE + // Defines a reverse iterator implementation for the Map Manager. + // + // = DESCRIPTION + // Implementation to be provided by ACE_Map_Manager::reverse_iterator. +public: + + // = Traits. + typedef ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex>::reverse_iterator implementation; + + ACE_Map_Manager_Reverse_Iterator_Adapter (const implementation &impl); + // Constructor. + + virtual ~ACE_Map_Manager_Reverse_Iterator_Adapter (void); + // Destructor. + + virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const; + // Clone. + + virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const; + // Comparison. + + virtual T dereference () const; + // Dereference. + + virtual void plus_plus (void); + // Advance. + + virtual void minus_minus (void); + // Reverse. + + implementation &impl (void); + // Accessor to implementation object. + +protected: + + implementation implementation_; + // All implementation details are forwarded to this class. +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class KEY, class VALUE, class KEY_GENERATOR> +class ACE_Map_Manager_Adapter : public ACE_Map<KEY, VALUE> +{ + // = TITLE + // Defines a map implementation. + // + // = DESCRIPTION + // Implementation to be provided by <ACE_Map_Manager>. +public: + + // = Traits. + typedef ACE_Map_Manager_Iterator_Adapter<value_type, KEY, VALUE> iterator_impl; + typedef ACE_Map_Manager_Reverse_Iterator_Adapter<value_type, KEY, VALUE> reverse_iterator_impl; + typedef ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> implementation; + + // = Initialization and termination methods. + ACE_Map_Manager_Adapter (ACE_Allocator *alloc = 0); + // Initialize with the <ACE_DEFAULT_MAP_SIZE>. + + ACE_Map_Manager_Adapter (size_t size, + ACE_Allocator *alloc = 0); + // Initialize with <size> entries. The <size> parameter is ignore + // by maps for which an initialize size does not make sense. + + virtual ~ACE_Map_Manager_Adapter (void); + // Close down and release dynamically allocated resources. + + virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE, + ACE_Allocator *alloc = 0); + // Initialize a <Map> with size <length>. + + virtual int close (void); + // Close down a <Map> and release dynamically allocated resources. + + virtual int bind (const KEY &key, + const VALUE &value); + // Add <key>/<value> pair to the map. If <key> is already in the + // map then no changes are made and 1 is returned. Returns 0 on a + // successful addition. This function fails for maps that do not + // allow user specified keys. <key> is an "in" parameter. + + virtual int bind_modify_key (const VALUE &value, + KEY &key); + // Add <key>/<value> pair to the map. <key> is an "inout" parameter + // and maybe modified/extended by the map to add additional + // information. To recover original key, call the <recover_key> + // method. + + virtual int bind_create_key (const VALUE &value, + KEY &key); + // Add <value> to the map, and the corresponding key produced by the + // Map is returned through <key> which is an "out" parameter. For + // maps that do not naturally produce keys, the map adapters will + // use the <KEY_GENERATOR> class to produce a key. However, the + // users are responsible for not jeopardizing this key production + // scheme by using user specified keys with keys produced by the key + // generator. + + virtual int bind_create_key (const VALUE &value); + // Add <value> to the map. The user does not care about the + // corresponding key produced by the Map. For maps that do not + // naturally produce keys, the map adapters will use the + // <KEY_GENERATOR> class to produce a key. However, the users are + // responsible for not jeopardizing this key production scheme by + // using user specified keys with keys produced by the key + // generator. + + virtual int recover_key (const KEY &modified_key, + KEY &original_key); + // Recovers the original key potentially modified by the map during + // <bind_modify_key>. + + virtual int rebind (const KEY &key, + const VALUE &value); + // Reassociate <key> with <value>. The function fails if <key> is + // not in the map for maps that do not allow user specified keys. + // However, for maps that allow user specified keys, if the key is + // not in the map, a new <key>/<value> association is created. + + virtual int rebind (const KEY &key, + const VALUE &value, + VALUE &old_value); + // Reassociate <key> with <value>, storing the old value into the + // "out" parameter <old_value>. The function fails if <key> is not + // in the map for maps that do not allow user specified keys. + // However, for maps that allow user specified keys, if the key is + // not in the map, a new <key>/<value> association is created. + + virtual int rebind (const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value); + // Reassociate <key> with <value>, storing the old key and value + // into the "out" parameters <old_key> and <old_value>. The + // function fails if <key> is not in the map for maps that do not + // allow user specified keys. However, for maps that allow user + // specified keys, if the key is not in the map, a new <key>/<value> + // association is created. + + virtual int trybind (const KEY &key, + VALUE &value); + // Associate <key> with <value> if and only if <key> is not in the + // map. If <key> is already in the map, then the <value> parameter + // is overwritten with the existing value in the map. Returns 0 if a + // new <key>/<value> association is created. Returns 1 if an + // attempt is made to bind an existing entry. This function fails + // for maps that do not allow user specified keys. + + virtual int find (const KEY &key, + VALUE &value); + // Locate <value> associated with <key>. + + virtual int find (const KEY &key); + // Is <key> in the map? + + virtual int unbind (const KEY &key); + // Remove <key> from the map. + + virtual int unbind (const KEY &key, + VALUE &value); + // Remove <key> from the map, and return the <value> associated with + // <key>. + + virtual size_t current_size (void); + // Return the current size of the map. + + virtual size_t total_size (void); + // Return the total size of the map. + + virtual void dump (void) const; + // Dump the state of an object. + + implementation &impl (void); + // Accessor to implementation object. + + KEY_GENERATOR &key_generator (void); + // Accessor to key generator. + +protected: + + implementation implementation_; + // All implementation details are forwarded to this class. + + KEY_GENERATOR key_generator_; + // Functor class used for generating key. + + // = STL styled iterator factory functions. + + virtual iterator_implementation *begin_impl (void); + virtual iterator_implementation *end_impl (void); + // Return forward iterator. + + virtual reverse_iterator_implementation *rbegin_impl (void); + virtual reverse_iterator_implementation *rend_impl (void); + // Return reverse iterator. + +private: + + // = Disallow these operations. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR> &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Map_Manager_Adapter (const ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR> &)) +}; + +//////////////////////////////////////////////////////////////////////////////// + +#if defined (__ACE_INLINE__) +#include "ace/Map_T.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Map_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation "Map_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* ACE_MAP_T_H */ diff --git a/ace/Map_T.i b/ace/Map_T.i new file mode 100644 index 00000000000..f2e2ce51527 --- /dev/null +++ b/ace/Map_T.i @@ -0,0 +1,1625 @@ +// $Id$ + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> ACE_INLINE +ACE_Incremental_Key_Generator<T>::ACE_Incremental_Key_Generator (void) + : t_ (0) +{ +} + +template <class T> ACE_INLINE int +ACE_Incremental_Key_Generator<T>::operator() (T &t) +{ + t = ++this->t_; + return 0; +} + +template <class T> ACE_INLINE T & +ACE_Incremental_Key_Generator<T>::current_value (void) +{ + return this->t_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> ACE_INLINE +ACE_Iterator_Impl<T>::~ACE_Iterator_Impl (void) +{ +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> ACE_INLINE +ACE_Reverse_Iterator_Impl<T>::~ACE_Reverse_Iterator_Impl (void) +{ +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> ACE_INLINE +ACE_Iterator<T>::ACE_Iterator (ACE_Iterator<T>::implementation *impl) + : implementation_ (impl) +{ +} + +template <class T> ACE_INLINE +ACE_Iterator<T>::ACE_Iterator (const ACE_Iterator<T> &rhs) + : implementation_ (rhs.implementation_->clone ()) +{ +} + +template <class T> ACE_INLINE +ACE_Iterator<T>::~ACE_Iterator (void) +{ + delete this->implementation_; +} + +template <class T> ACE_INLINE ACE_Iterator<T> & +ACE_Iterator<T>::operator= (const ACE_Iterator<T> &rhs) +{ + this->~ACE_Iterator<T> (); + this->implementation_ = rhs.implementation_->clone (); +} + +template <class T> ACE_INLINE int +ACE_Iterator<T>::operator== (const ACE_Iterator<T> &rhs) const +{ + return this->implementation_->compare (*rhs.implementation_); +} + +template <class T> ACE_INLINE int +ACE_Iterator<T>::operator!= (const ACE_Iterator<T> &rhs) const +{ + return !this->operator== (rhs); +} + +template <class T> ACE_INLINE T +ACE_Iterator<T>::operator* (void) const +{ + return this->implementation_->dereference (); +} + +template <class T> ACE_INLINE ACE_Iterator<T> & +ACE_Iterator<T>::operator++ (void) +{ + this->implementation_->plus_plus (); + return *this; +} + +template <class T> ACE_INLINE ACE_Iterator<T> +ACE_Iterator<T>::operator++ (int) +{ + ACE_Iterator<T> tmp = *this; + this->implementation_->plus_plus (); + return tmp; +} + +template <class T> ACE_INLINE ACE_Iterator<T> & +ACE_Iterator<T>::operator-- (void) +{ + this->implementation_->minus_minus (); + return *this; +} + +template <class T> ACE_INLINE ACE_Iterator<T> +ACE_Iterator<T>::operator-- (int) +{ + ACE_Iterator<T> tmp = *this; + this->implementation_->minus_minus (); + return tmp; +} + +template <class T> ACE_INLINE ACE_Iterator<T>::implementation & +ACE_Iterator<T>::impl (void) +{ + return *this->implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T> ACE_INLINE +ACE_Reverse_Iterator<T>::ACE_Reverse_Iterator (ACE_Reverse_Iterator<T>::implementation *impl) + : implementation_ (impl) +{ +} + +template <class T> ACE_INLINE +ACE_Reverse_Iterator<T>::ACE_Reverse_Iterator (const ACE_Reverse_Iterator<T> &rhs) + : implementation_ (rhs.implementation_->clone ()) +{ +} + +template <class T> ACE_INLINE +ACE_Reverse_Iterator<T>::~ACE_Reverse_Iterator (void) +{ + delete this->implementation_; +} + +template <class T> ACE_INLINE ACE_Reverse_Iterator<T> & +ACE_Reverse_Iterator<T>::operator= (const ACE_Reverse_Iterator<T> &rhs) +{ + this->~ACE_Reverse_Iterator<T> (); + this->implementation_ = rhs.implementation_->clone (); +} + +template <class T> ACE_INLINE int +ACE_Reverse_Iterator<T>::operator== (const ACE_Reverse_Iterator<T> &rhs) const +{ + return this->implementation_->compare (*rhs.implementation_); +} + +template <class T> ACE_INLINE int +ACE_Reverse_Iterator<T>::operator!= (const ACE_Reverse_Iterator<T> &rhs) const +{ + return !this->operator== (rhs); +} + +template <class T> ACE_INLINE T +ACE_Reverse_Iterator<T>::operator* (void) const +{ + return this->implementation_->dereference (); +} + +template <class T> ACE_INLINE ACE_Reverse_Iterator<T> & +ACE_Reverse_Iterator<T>::operator++ (void) +{ + this->implementation_->plus_plus (); + return *this; +} + +template <class T> ACE_INLINE ACE_Reverse_Iterator<T> +ACE_Reverse_Iterator<T>::operator++ (int) +{ + ACE_Reverse_Iterator<T> tmp = *this; + this->implementation_->plus_plus (); + return tmp; +} + +template <class T> ACE_INLINE ACE_Reverse_Iterator<T> & +ACE_Reverse_Iterator<T>::operator-- (void) +{ + this->implementation_->minus_minus (); + return *this; +} + +template <class T> ACE_INLINE ACE_Reverse_Iterator<T> +ACE_Reverse_Iterator<T>::operator-- (int) +{ + ACE_Reverse_Iterator<T> tmp = *this; + this->implementation_->minus_minus (); + return tmp; +} + +template <class T> ACE_INLINE ACE_Reverse_Iterator<T>::implementation & +ACE_Reverse_Iterator<T>::impl (void) +{ + return *this->implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class KEY, class VALUE> ACE_INLINE +ACE_Map<KEY, VALUE>::ACE_Map (void) +{ +} + +template <class KEY, class VALUE> ACE_INLINE +ACE_Map<KEY, VALUE>::~ACE_Map (void) +{ +} + +template <class KEY, class VALUE> ACE_INLINE ACE_Map<KEY, VALUE>::iterator +ACE_Map<KEY, VALUE>::begin (void) +{ + return iterator (this->begin_impl ()); +} + +template <class KEY, class VALUE> ACE_INLINE ACE_Map<KEY, VALUE>::iterator +ACE_Map<KEY, VALUE>::end (void) +{ + return iterator (this->end_impl ()); +} + +template <class KEY, class VALUE> ACE_INLINE ACE_Map<KEY, VALUE>::reverse_iterator +ACE_Map<KEY, VALUE>::rbegin (void) +{ + return reverse_iterator (this->rbegin_impl ()); +} + +template <class KEY, class VALUE> ACE_INLINE ACE_Map<KEY, VALUE>::reverse_iterator +ACE_Map<KEY, VALUE>::rend (void) +{ + return reverse_iterator (this->rend_impl ()); +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE +ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::ACE_Map_Impl_Iterator_Adapter (const ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::implementation &impl) + : implementation_ (impl) +{ +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE +ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::~ACE_Map_Impl_Iterator_Adapter (void) +{ +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE ACE_Iterator_Impl<T> * +ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::clone (void) const +{ + return new ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY> (*this); +} + + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE int +ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::compare (const ACE_Iterator_Impl<T> &rhs_base) const +{ + ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY> &rhs + = ACE_dynamic_cast_3_ref (ACE_Map_Impl_Iterator_Adapter, T, IMPLEMENTATION, ENTRY, rhs_base); + + return this->implementation_ == rhs.implementation_; +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE T +ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::dereference () const +{ + ENTRY &entry = *this->implementation_; + return T (entry.ext_id_, + entry.int_id_); +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE void +ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::plus_plus (void) +{ + ++this->implementation_; +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE void +ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::minus_minus (void) +{ + --this->implementation_; +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::implementation & +ACE_Map_Impl_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::impl (void) +{ + return this->implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE +ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::ACE_Map_Impl_Reverse_Iterator_Adapter (const ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::implementation &impl) + : implementation_ (impl) +{ +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE +ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::~ACE_Map_Impl_Reverse_Iterator_Adapter (void) +{ +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE ACE_Reverse_Iterator_Impl<T> * +ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::clone (void) const +{ + return new ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY> (*this); +} + + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE int +ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::compare (const ACE_Reverse_Iterator_Impl<T> &rhs_base) const +{ + ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY> &rhs + = ACE_dynamic_cast_3_ref (ACE_Map_Impl_Reverse_Iterator_Adapter, T, IMPLEMENTATION, ENTRY, rhs_base); + + return this->implementation_ == rhs.implementation_; +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE T +ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::dereference () const +{ + ENTRY &entry = *this->implementation_; + return T (entry.ext_id_, + entry.int_id_); +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE void +ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::plus_plus (void) +{ + ++this->implementation_; +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE void +ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::minus_minus (void) +{ + --this->implementation_; +} + +template <class T, class IMPLEMENTATION, class ENTRY> ACE_INLINE ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::implementation & +ACE_Map_Impl_Reverse_Iterator_Adapter<T, IMPLEMENTATION, ENTRY>::impl (void) +{ + return this->implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::ACE_Map_Impl (ACE_Allocator *alloc) + : implementation_ (alloc) +{ +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::ACE_Map_Impl (size_t size, + ACE_Allocator *alloc) + : implementation_ (size, + alloc) +{ +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::~ACE_Map_Impl (void) +{ +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::open (size_t length, + ACE_Allocator *alloc) +{ + return this->implementation_.open (length, + alloc); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::close (void) +{ + return this->implementation_.close (); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::bind (const KEY &key, + const VALUE &value) +{ + return this->implementation_.bind (key, + value); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::bind_modify_key (const VALUE &value, + KEY &key) +{ + return this->implementation_.bind_modify_key (value, + key); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::bind_create_key (const VALUE &value, + KEY &key) +{ + return this->implementation_.bind_create_key (value, + key); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::bind_create_key (const VALUE &value) +{ + return this->implementation_.bind_create_key (value); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::recover_key (const KEY &modified_key, + KEY &original_key) +{ + return this->implementation_.recover_key (modified_key, + original_key); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::rebind (const KEY &key, + const VALUE &value) +{ + return this->implementation_.rebind (key, + value); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::rebind (const KEY &key, + const VALUE &value, + VALUE &old_value) +{ + return this->implementation_.rebind (key, + value, + old_value); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::rebind (const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value) +{ + return this->implementation_.rebind (key, + value, + old_key, + old_value); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::trybind (const KEY &key, + VALUE &value) +{ + return this->implementation_.trybind (key, + value); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::find (const KEY &key, + VALUE &value) +{ + return this->implementation_.find (key, + value); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::find (const KEY &key) +{ + return this->implementation_.find (key); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::unbind (const KEY &key) +{ + return this->implementation_.unbind (key); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE int +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::unbind (const KEY &key, + VALUE &value) +{ + return this->implementation_.unbind (key, + value); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE size_t +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::current_size (void) +{ + return this->implementation_.current_size (); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE size_t +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::total_size (void) +{ + return this->implementation_.total_size (); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE void +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::dump (void) const +{ + this->implementation_.dump (); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE ACE_Map<KEY, VALUE>::iterator_implementation * +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::begin_impl (void) +{ + return new iterator_impl (this->implementation_.begin ()); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE ACE_Map<KEY, VALUE>::iterator_implementation * +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::end_impl (void) +{ + return new iterator_impl (this->implementation_.end ()); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE ACE_Map<KEY, VALUE>::reverse_iterator_implementation * +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::rbegin_impl (void) +{ + return new reverse_iterator_impl (this->implementation_.rbegin ()); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE ACE_Map<KEY, VALUE>::reverse_iterator_implementation * +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::rend_impl (void) +{ + return new reverse_iterator_impl (this->implementation_.rend ()); +} + +template <class KEY, class VALUE, class IMPLEMENTATION> ACE_INLINE ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::implementation & +ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION>::impl (void) +{ + return this->implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class VALUE> ACE_INLINE +ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::ACE_Active_Map_Manager_Iterator_Adapter (const ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::implementation &impl) + : implementation_ (impl) +{ +} + +template <class T, class VALUE> ACE_INLINE +ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::~ACE_Active_Map_Manager_Iterator_Adapter (void) +{ +} + +template <class T, class VALUE> ACE_INLINE ACE_Iterator_Impl<T> * +ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::clone (void) const +{ + return new ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE> (*this); +} + + +template <class T, class VALUE> ACE_INLINE int +ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::compare (const ACE_Iterator_Impl<T> &rhs_base) const +{ + ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE> &rhs + = ACE_dynamic_cast_2_ref (ACE_Active_Map_Manager_Iterator_Adapter, T, VALUE, rhs_base); + + return this->implementation_ == rhs.implementation_; +} + +template <class T, class VALUE> ACE_INLINE T +ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::dereference () const +{ + ACE_Active_Map_Manager<VALUE>::ENTRY &entry = *this->implementation_; + return T (entry.int_id_.first (), + entry.int_id_.second ()); +} + +template <class T, class VALUE> ACE_INLINE void +ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::plus_plus (void) +{ + ++this->implementation_; +} + +template <class T, class VALUE> ACE_INLINE void +ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::minus_minus (void) +{ + --this->implementation_; +} + +template <class T, class VALUE> ACE_INLINE ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::implementation & +ACE_Active_Map_Manager_Iterator_Adapter<T, VALUE>::impl (void) +{ + return this->implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class VALUE> ACE_INLINE +ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::ACE_Active_Map_Manager_Reverse_Iterator_Adapter (const ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::implementation &impl) + : implementation_ (impl) +{ +} + +template <class T, class VALUE> ACE_INLINE +ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::~ACE_Active_Map_Manager_Reverse_Iterator_Adapter (void) +{ +} + +template <class T, class VALUE> ACE_INLINE ACE_Reverse_Iterator_Impl<T> * +ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::clone (void) const +{ + return new ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE> (*this); +} + + +template <class T, class VALUE> ACE_INLINE int +ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::compare (const ACE_Reverse_Iterator_Impl<T> &rhs_base) const +{ + ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE> &rhs + = ACE_dynamic_cast_2_ref (ACE_Active_Map_Manager_Reverse_Iterator_Adapter, T, VALUE, rhs_base); + + return this->implementation_ == rhs.implementation_; +} + +template <class T, class VALUE> ACE_INLINE T +ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::dereference () const +{ + ACE_Active_Map_Manager<VALUE>::ENTRY &entry = *this->implementation_; + return T (entry.int_id_.first (), + entry.int_id_.second ()); +} + +template <class T, class VALUE> ACE_INLINE void +ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::plus_plus (void) +{ + ++this->implementation_; +} + +template <class T, class VALUE> ACE_INLINE void +ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::minus_minus (void) +{ + --this->implementation_; +} + +template <class T, class VALUE> ACE_INLINE ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::implementation & +ACE_Active_Map_Manager_Reverse_Iterator_Adapter<T, VALUE>::impl (void) +{ + return this->implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::ACE_Active_Map_Manager_Adapter (ACE_Allocator *alloc) + : implementation_ (alloc) +{ +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::ACE_Active_Map_Manager_Adapter (size_t size, + ACE_Allocator *alloc) + : implementation_ (size, + alloc) +{ +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::~ACE_Active_Map_Manager_Adapter (void) +{ +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::open (size_t length, + ACE_Allocator *alloc) +{ + return this->implementation_.open (length, + alloc); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::close (void) +{ + return this->implementation_.close (); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::bind (const KEY &key, + const VALUE &value) +{ + ACE_NOTSUP_RETURN (-1); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::bind_modify_key (const VALUE &value, + KEY &key) +{ + // Reserve a slot and create an active key. + expanded_value *internal_value = 0; + ACE_Active_Map_Manager_Key active_key; + int result = this->implementation_.bind (active_key, + internal_value); + if (result == 0) + { + // Encode the active key and the existing user key into key part + // of <expanded_value>. + result = this->key_adapter_.encode (key, + active_key, + internal_value->first ()); + if (result == 0) + { + // Copy user value into <expanded_value>. + internal_value->second (value); + // Copy new, modified key back to the user key. + key = internal_value->first (); + } + else + { + // In case of errors, unbind from map. + this->implementation_.unbind (active_key); + } + } + + return result; +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::bind_create_key (const VALUE &value, + KEY &key) +{ + // Reserve a slot and create an active key. + expanded_value *internal_value = 0; + ACE_Active_Map_Manager_Key active_key; + int result = this->implementation_.bind (active_key, + internal_value); + if (result == 0) + { + // Encode the active key into key part of <expanded_value>. + result = this->key_adapter_.encode (internal_value->first (), + active_key, + internal_value->first ()); + if (result == 0) + { + // Copy user value into <expanded_value>. + internal_value->second (value); + // Copy new, modified key to the user key. + key = internal_value->first (); + } + else + { + // In case of errors, unbind from map. + this->implementation_.unbind (active_key); + } + } + + return result; +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::bind_create_key (const VALUE &value) +{ + // Reserve a slot and create an active key. + expanded_value *internal_value = 0; + ACE_Active_Map_Manager_Key active_key; + int result = this->implementation_.bind (active_key, + internal_value); + if (result == 0) + { + // Encode the active key into key part of <expanded_value>. + result = this->key_adapter_.encode (internal_value->first (), + active_key, + internal_value->first ()); + if (result == 0) + { + // Copy user value into <expanded_value>. + internal_value->second (value); + } + else + { + // In case of errors, unbind from map. + this->implementation_.unbind (active_key); + } + } + + return result; +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::recover_key (const KEY &modified_key, + KEY &original_key) +{ + // Ask the <key_adapter_> to help out with recovering the original + // user key, since it was the one that encode it in the first place. + return this->key_adapter_.decode (modified_key, + original_key); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::find (const KEY &key, + ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::expanded_value *&internal_value) +{ + // Ask the <key_adapter_> to recover the active key. + ACE_Active_Map_Manager_Key active_key; + int result = this->key_adapter_.decode (key, + active_key); + if (result == 0) + { + // Find recovered active key in map. + result = this->implementation_.find (active_key, + internal_value); + } + + return result; +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::find (const KEY &key, + VALUE &value) +{ + expanded_value *internal_value = 0; + int result = this->find (key, + internal_value); + + if (result == 0) + { + // Copy value. + value = internal_value->second (); + } + + return result; +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::find (const KEY &key) +{ + expanded_value *internal_value = 0; + return this->find (key, + internal_value); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::rebind (const KEY &key, + const VALUE &value) +{ + expanded_value *internal_value = 0; + int result = this->find (key, + internal_value); + + if (result == 0) + { + // Reset value. + internal_value->second (value); + } + + return result; +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::rebind (const KEY &key, + const VALUE &value, + VALUE &old_value) +{ + expanded_value *internal_value = 0; + int result = this->find (key, + internal_value); + + if (result == 0) + { + // Copy old value. + old_value = internal_value->second (); + + // Reset to new value. + internal_value->second (value); + } + + return result; +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::rebind (const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value) +{ + expanded_value *internal_value = 0; + int result = this->find (key, + internal_value); + + if (result == 0) + { + // Copy old key and value. + old_key = internal_value->first (); + old_value = internal_value->second (); + + // Reset to new value. + internal_value->second (value); + } + + return result; +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::trybind (const KEY &key, + VALUE &value) +{ + ACE_NOTSUP_RETURN (-1); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::unbind (const KEY &key, + ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::expanded_value *&internal_value) +{ + // Ask the <key_adapter_> to recover the active key. + ACE_Active_Map_Manager_Key active_key; + int result = this->key_adapter_.decode (key, + active_key); + if (result == 0) + { + // Unbind recovered active key from map. + result = this->implementation_.unbind (active_key, + internal_value); + } + + return result; +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::unbind (const KEY &key) +{ + expanded_value *internal_value = 0; + return this->unbind (key, + internal_value); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE int +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::unbind (const KEY &key, + VALUE &value) +{ + expanded_value *internal_value = 0; + int result = this->unbind (key, + internal_value); + + if (result == 0) + { + // Copy value. + value = internal_value->second (); + } + + return result; +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE size_t +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::current_size (void) +{ + return this->implementation_.current_size (); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE size_t +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::total_size (void) +{ + return this->implementation_.total_size (); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE void +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::dump (void) const +{ + this->implementation_.dump (); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE ACE_Map<KEY, VALUE>::iterator_implementation * +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::begin_impl (void) +{ + return new iterator_impl (this->implementation_.begin ()); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE ACE_Map<KEY, VALUE>::iterator_implementation * +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::end_impl (void) +{ + return new iterator_impl (this->implementation_.end ()); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE ACE_Map<KEY, VALUE>::reverse_iterator_implementation * +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::rbegin_impl (void) +{ + return new reverse_iterator_impl (this->implementation_.rbegin ()); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE ACE_Map<KEY, VALUE>::reverse_iterator_implementation * +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::rend_impl (void) +{ + return new reverse_iterator_impl (this->implementation_.rend ()); +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::implementation & +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::impl (void) +{ + return this->implementation_; +} + +template <class KEY, class VALUE, class KEY_ADAPTER> ACE_INLINE KEY_ADAPTER & +ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER>::key_adapter (void) +{ + return this->key_adapter_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE +ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::ACE_Hash_Map_Manager_Ex_Iterator_Adapter (const ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::implementation &impl) + : implementation_ (impl) +{ +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE +ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::~ACE_Hash_Map_Manager_Ex_Iterator_Adapter (void) +{ +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE ACE_Iterator_Impl<T> * +ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::clone (void) const +{ + return new ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS> (*this); +} + + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::compare (const ACE_Iterator_Impl<T> &rhs_base) const +{ + ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS> &rhs + = ACE_dynamic_cast_5_ref (ACE_Hash_Map_Manager_Ex_Iterator_Adapter, T, KEY, VALUE, HASH_KEY, COMPARE_KEYS, rhs_base); + + return this->implementation_ == rhs.implementation_; +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE T +ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::dereference () const +{ + ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>::ENTRY &entry = *this->implementation_; + return T (entry.ext_id_, + entry.int_id_); +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE void +ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::plus_plus (void) +{ + ++this->implementation_; +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE void +ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::minus_minus (void) +{ + --this->implementation_; +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::implementation & +ACE_Hash_Map_Manager_Ex_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::impl (void) +{ + return this->implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE +ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter (const ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::implementation &impl) + : implementation_ (impl) +{ +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE +ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::~ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter (void) +{ +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE ACE_Reverse_Iterator_Impl<T> * +ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::clone (void) const +{ + return new ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS> (*this); +} + + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::compare (const ACE_Reverse_Iterator_Impl<T> &rhs_base) const +{ + ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS> &rhs + = ACE_dynamic_cast_5_ref (ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter, T, KEY, VALUE, HASH_KEY, COMPARE_KEYS, rhs_base); + + return this->implementation_ == rhs.implementation_; +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE T +ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::dereference () const +{ + ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>::ENTRY &entry = *this->implementation_; + return T (entry.ext_id_, + entry.int_id_); +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE void +ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::plus_plus (void) +{ + ++this->implementation_; +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE void +ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::minus_minus (void) +{ + --this->implementation_; +} + +template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS> ACE_INLINE ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::implementation & +ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<T, KEY, VALUE, HASH_KEY, COMPARE_KEYS>::impl (void) +{ + return this->implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::ACE_Hash_Map_Manager_Ex_Adapter (ACE_Allocator *alloc) + : implementation_ (alloc) +{ +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::ACE_Hash_Map_Manager_Ex_Adapter (size_t size, + ACE_Allocator *alloc) + : implementation_ (size, + alloc) +{ +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::~ACE_Hash_Map_Manager_Ex_Adapter (void) +{ +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::open (size_t length, + ACE_Allocator *alloc) +{ + return this->implementation_.open (length, + alloc); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::close (void) +{ + return this->implementation_.close (); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::bind (const KEY &key, + const VALUE &value) +{ + return this->implementation_.bind (key, + value); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::bind_modify_key (const VALUE &value, + KEY &key) +{ + return this->implementation_.bind (key, + value); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::bind_create_key (const VALUE &value, + KEY &key) +{ + // Invoke the user specified key generation functor. + int result = this->key_generator_ (key); + + if (result == 0) + { + // Try to add. + result = this->implementation_.bind (key, + value); + } + + return result; +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::bind_create_key (const VALUE &value) +{ + KEY key; + return this->bind_create_key (value, + key); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::recover_key (const KEY &modified_key, + KEY &original_key) +{ + original_key = modified_key; + return 0; +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::rebind (const KEY &key, + const VALUE &value) +{ + return this->implementation_.rebind (key, + value); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::rebind (const KEY &key, + const VALUE &value, + VALUE &old_value) +{ + return this->implementation_.rebind (key, + value, + old_value); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::rebind (const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value) +{ + return this->implementation_.rebind (key, + value, + old_key, + old_value); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::trybind (const KEY &key, + VALUE &value) +{ + return this->implementation_.trybind (key, + value); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::find (const KEY &key, + VALUE &value) +{ + return this->implementation_.find (key, + value); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::find (const KEY &key) +{ + return this->implementation_.find (key); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::unbind (const KEY &key) +{ + return this->implementation_.unbind (key); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE int +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::unbind (const KEY &key, + VALUE &value) +{ + return this->implementation_.unbind (key, + value); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE size_t +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::current_size (void) +{ + return this->implementation_.current_size (); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE size_t +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::total_size (void) +{ + return this->implementation_.total_size (); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE void +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::dump (void) const +{ + this->implementation_.dump (); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE ACE_Map<KEY, VALUE>::iterator_implementation * +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::begin_impl (void) +{ + return new iterator_impl (this->implementation_.begin ()); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE ACE_Map<KEY, VALUE>::iterator_implementation * +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::end_impl (void) +{ + return new iterator_impl (this->implementation_.end ()); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE ACE_Map<KEY, VALUE>::reverse_iterator_implementation * +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::rbegin_impl (void) +{ + return new reverse_iterator_impl (this->implementation_.rbegin ()); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE ACE_Map<KEY, VALUE>::reverse_iterator_implementation * +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::rend_impl (void) +{ + return new reverse_iterator_impl (this->implementation_.rend ()); +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::implementation & +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::impl (void) +{ + return this->implementation_; +} + +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR> ACE_INLINE KEY_GENERATOR & +ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR>::key_generator (void) +{ + return this->key_generator_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class KEY, class VALUE> ACE_INLINE +ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::ACE_Map_Manager_Iterator_Adapter (const ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::implementation &impl) + : implementation_ (impl) +{ +} + +template <class T, class KEY, class VALUE> ACE_INLINE +ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::~ACE_Map_Manager_Iterator_Adapter (void) +{ +} + +template <class T, class KEY, class VALUE> ACE_INLINE ACE_Iterator_Impl<T> * +ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::clone (void) const +{ + return new ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE> (*this); +} + + +template <class T, class KEY, class VALUE> ACE_INLINE int +ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::compare (const ACE_Iterator_Impl<T> &rhs_base) const +{ + ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE> &rhs + = ACE_dynamic_cast_3_ref (ACE_Map_Manager_Iterator_Adapter, T, KEY, VALUE, rhs_base); + + return this->implementation_ == rhs.implementation_; +} + +template <class T, class KEY, class VALUE> ACE_INLINE T +ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::dereference () const +{ + ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex>::ENTRY &entry = *this->implementation_; + return T (entry.ext_id_, + entry.int_id_); +} + +template <class T, class KEY, class VALUE> ACE_INLINE void +ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::plus_plus (void) +{ + ++this->implementation_; +} + +template <class T, class KEY, class VALUE> ACE_INLINE void +ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::minus_minus (void) +{ + --this->implementation_; +} + +template <class T, class KEY, class VALUE> ACE_INLINE ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::implementation & +ACE_Map_Manager_Iterator_Adapter<T, KEY, VALUE>::impl (void) +{ + return this->implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T, class KEY, class VALUE> ACE_INLINE +ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::ACE_Map_Manager_Reverse_Iterator_Adapter (const ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::implementation &impl) + : implementation_ (impl) +{ +} + +template <class T, class KEY, class VALUE> ACE_INLINE +ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::~ACE_Map_Manager_Reverse_Iterator_Adapter (void) +{ +} + +template <class T, class KEY, class VALUE> ACE_INLINE ACE_Reverse_Iterator_Impl<T> * +ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::clone (void) const +{ + return new ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE> (*this); +} + + +template <class T, class KEY, class VALUE> ACE_INLINE int +ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::compare (const ACE_Reverse_Iterator_Impl<T> &rhs_base) const +{ + ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE> &rhs + = ACE_dynamic_cast_3_ref (ACE_Map_Manager_Reverse_Iterator_Adapter, T, KEY, VALUE, rhs_base); + + return this->implementation_ == rhs.implementation_; +} + +template <class T, class KEY, class VALUE> ACE_INLINE T +ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::dereference () const +{ + ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex>::ENTRY &entry = *this->implementation_; + return T (entry.ext_id_, + entry.int_id_); +} + +template <class T, class KEY, class VALUE> ACE_INLINE void +ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::plus_plus (void) +{ + ++this->implementation_; +} + +template <class T, class KEY, class VALUE> ACE_INLINE void +ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::minus_minus (void) +{ + --this->implementation_; +} + +template <class T, class KEY, class VALUE> ACE_INLINE ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::implementation & +ACE_Map_Manager_Reverse_Iterator_Adapter<T, KEY, VALUE>::impl (void) +{ + return this->implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::ACE_Map_Manager_Adapter (ACE_Allocator *alloc) + : implementation_ (alloc) +{ +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::ACE_Map_Manager_Adapter (size_t size, + ACE_Allocator *alloc) + : implementation_ (size, + alloc) +{ +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::~ACE_Map_Manager_Adapter (void) +{ +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::open (size_t length, + ACE_Allocator *alloc) +{ + return this->implementation_.open (length, + alloc); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::close (void) +{ + return this->implementation_.close (); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::bind (const KEY &key, + const VALUE &value) +{ + return this->implementation_.bind (key, + value); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::bind_modify_key (const VALUE &value, + KEY &key) +{ + return this->implementation_.bind (key, + value); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::bind_create_key (const VALUE &value, + KEY &key) +{ + // Invoke the user specified key generation functor. + int result = this->key_generator_ (key); + + if (result == 0) + { + // Try to add. + result = this->implementation_.bind (key, + value); + } + + return result; +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::bind_create_key (const VALUE &value) +{ + KEY key; + return this->bind_create_key (value, + key); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::recover_key (const KEY &modified_key, + KEY &original_key) +{ + original_key = modified_key; + return 0; +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::rebind (const KEY &key, + const VALUE &value) +{ + return this->implementation_.rebind (key, + value); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::rebind (const KEY &key, + const VALUE &value, + VALUE &old_value) +{ + return this->implementation_.rebind (key, + value, + old_value); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::rebind (const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value) +{ + return this->implementation_.rebind (key, + value, + old_key, + old_value); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::trybind (const KEY &key, + VALUE &value) +{ + return this->implementation_.trybind (key, + value); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::find (const KEY &key, + VALUE &value) +{ + return this->implementation_.find (key, + value); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::find (const KEY &key) +{ + return this->implementation_.find (key); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::unbind (const KEY &key) +{ + return this->implementation_.unbind (key); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE int +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::unbind (const KEY &key, + VALUE &value) +{ + return this->implementation_.unbind (key, + value); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE size_t +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::current_size (void) +{ + return this->implementation_.current_size (); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE size_t +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::total_size (void) +{ + return this->implementation_.total_size (); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE void +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::dump (void) const +{ + this->implementation_.dump (); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE ACE_Map<KEY, VALUE>::iterator_implementation * +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::begin_impl (void) +{ + return new iterator_impl (this->implementation_.begin ()); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE ACE_Map<KEY, VALUE>::iterator_implementation * +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::end_impl (void) +{ + return new iterator_impl (this->implementation_.end ()); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE ACE_Map<KEY, VALUE>::reverse_iterator_implementation * +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::rbegin_impl (void) +{ + return new reverse_iterator_impl (this->implementation_.rbegin ()); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE ACE_Map<KEY, VALUE>::reverse_iterator_implementation * +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::rend_impl (void) +{ + return new reverse_iterator_impl (this->implementation_.rend ()); +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::implementation & +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::impl (void) +{ + return this->implementation_; +} + +template <class KEY, class VALUE, class KEY_GENERATOR> ACE_INLINE KEY_GENERATOR & +ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::key_generator (void) +{ + return this->key_generator_; +} + +//////////////////////////////////////////////////////////////////////////////// @@ -46,21 +46,51 @@ # endif /* defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE) */ # if defined (ACE_HAS_ANSI_CASTS) -# define ACE_static_cast(TYPE, EXPR) static_cast<TYPE> (EXPR) -# define ACE_const_cast(TYPE, EXPR) const_cast<TYPE> (EXPR) -# define ACE_reinterpret_cast(TYPE, EXPR) reinterpret_cast<TYPE> (EXPR) +# define ACE_sap_any_cast(TYPE) reinterpret_cast<TYPE> (const_cast<ACE_Addr &> (ACE_Addr::sap_any)) +# define ACE_static_cast(TYPE, EXPR) static_cast<TYPE> (EXPR) +# define ACE_const_cast(TYPE, EXPR) const_cast<TYPE> (EXPR) +# define ACE_reinterpret_cast(TYPE, EXPR) reinterpret_cast<TYPE> (EXPR) # if defined (ACE_LACKS_RTTI) -# define ACE_dynamic_cast(TYPE, EXPR) static_cast<TYPE> (EXPR) +# define ACE_dynamic_cast(TYPE, EXPR) static_cast< TYPE > (EXPR) +# define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) static_cast< TYPE<T1> *> (EXPR) +# define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) static_cast< TYPE<T1, T2> *> (EXPR) +# define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) static_cast< TYPE<T1, T2, T3> *> (EXPR) +# define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) static_cast< TYPE<T1, T2, T3, T4> *> (EXPR) +# define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast< TYPE<T1, T2, T3, T4, T5> *> (EXPR) +# define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) static_cast< TYPE<T1> &> (EXPR) +# define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) static_cast< TYPE<T1, T2> &> (EXPR) +# define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) static_cast< TYPE<T1, T2, T3> &> (EXPR) +# define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) static_cast< TYPE<T1, T2, T3, T4> &> (EXPR) +# define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast< TYPE<T1, T2, T3, T4, T5> &> (EXPR) # else /* ! ACE_LACKS_RTTI */ -# define ACE_dynamic_cast(TYPE, EXPR) dynamic_cast<TYPE> (EXPR) +# define ACE_dynamic_cast(TYPE, EXPR) dynamic_cast< TYPE > (EXPR) +# define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) dynamic_cast< TYPE<T1> *> (EXPR) +# define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) dynamic_cast< TYPE<T1, T2> *> (EXPR) +# define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) dynamic_cast< TYPE<T1, T2, T3> *> (EXPR) +# define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast< TYPE<T1, T2, T3, T4> *> (EXPR) +# define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast< TYPE<T1, T2, T3, T4, T5> *> (EXPR) +# define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) dynamic_cast< TYPE<T1> &> (EXPR) +# define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) dynamic_cast< TYPE<T1, T2> &> (EXPR) +# define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) dynamic_cast< TYPE<T1, T2, T3> &> (EXPR) +# define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast< TYPE<T1, T2, T3, T4> &> (EXPR) +# define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast< TYPE<T1, T2, T3, T4, T5> &> (EXPR) # endif /* ! ACE_LACKS_RTTI */ -# define ACE_sap_any_cast(TYPE) reinterpret_cast<TYPE> (const_cast<ACE_Addr &> (ACE_Addr::sap_any)) # else -# define ACE_static_cast(TYPE, EXPR) ((TYPE) (EXPR)) -# define ACE_const_cast(TYPE, EXPR) ((TYPE) (EXPR)) -# define ACE_reinterpret_cast(TYPE, EXPR) ((TYPE) (EXPR)) -# define ACE_dynamic_cast(TYPE, EXPR) ((TYPE) (EXPR)) -# define ACE_sap_any_cast(TYPE) ((TYPE) (ACE_Addr::sap_any)) +# define ACE_sap_any_cast(TYPE) ((TYPE) (ACE_Addr::sap_any)) +# define ACE_static_cast(TYPE, EXPR) ((TYPE) (EXPR)) +# define ACE_const_cast(TYPE, EXPR) ((TYPE) (EXPR)) +# define ACE_reinterpret_cast(TYPE, EXPR) ((TYPE) (EXPR)) +# define ACE_dynamic_cast(TYPE, EXPR) ((TYPE) (EXPR)) +# define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) ((TYPE<T1> *) (EXPR)) +# define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) ((TYPE<T1, T2> *) (EXPR)) +# define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) ((TYPE<T1, T2, T3> *) (EXPR)) +# define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) ((TYPE<T1, T2, T3, T4> *) (EXPR)) +# define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) ((TYPE<T1, T2, T3, T4, T5> *) (EXPR)) +# define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) ((TYPE<T1> &) (EXPR)) +# define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) ((TYPE<T1, T2> &) (EXPR)) +# define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) ((TYPE<T1, T2, T3> &) (EXPR)) +# define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) ((TYPE<T1, T2, T3, T4> &) (EXPR)) +# define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) ((TYPE<T1, T2, T3, T4, T5> &) (EXPR)) # endif /* ACE_HAS_ANSI_CASTS */ # if !defined (ACE_CAST_CONST) diff --git a/ace/Pair.cpp b/ace/Pair.cpp new file mode 100644 index 00000000000..340a58a581b --- /dev/null +++ b/ace/Pair.cpp @@ -0,0 +1,25 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Pair.cpp +// +// = AUTHOR +// Irfan Pyarali +// +// ============================================================================ + +#define ACE_BUILD_DLL + +#include "ace/Pair.h" + +ACE_RCSID(ace, Pair, "$Id$") + +#if !defined (__ACE_INLINE__) +#include "ace/Pair.i" +#endif /* __ACE_INLINE__ */ + diff --git a/ace/Pair.h b/ace/Pair.h new file mode 100644 index 00000000000..f21097240f5 --- /dev/null +++ b/ace/Pair.h @@ -0,0 +1,33 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Pair.h +// +// = AUTHOR +// Irfan Pyarali +// +// ============================================================================ + +#ifndef ACE_PAIR_H +#define ACE_PAIR_H + +#include "ace/OS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (__ACE_INLINE__) +#include "ace/Pair.i" +#endif /* __ACE_INLINE__ */ + +// Include the templates here. +#include "ace/Pair_T.h" + +#endif /* ACE_PAIR_H */ diff --git a/ace/Pair.i b/ace/Pair.i new file mode 100644 index 00000000000..74e88caa0c5 --- /dev/null +++ b/ace/Pair.i @@ -0,0 +1,2 @@ +// $Id$ + diff --git a/ace/Pair_T.cpp b/ace/Pair_T.cpp new file mode 100644 index 00000000000..27e7f6d34df --- /dev/null +++ b/ace/Pair_T.cpp @@ -0,0 +1,18 @@ +// $Id$ + +#ifndef ACE_PAIR_T_C +#define ACE_PAIR_T_C + +#include "ace/Pair_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Pair_T.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Pair_T, "$Id$") + +#endif /* ACE_PAIR_T_C */ diff --git a/ace/Pair_T.h b/ace/Pair_T.h new file mode 100644 index 00000000000..1e9ffd80fe3 --- /dev/null +++ b/ace/Pair_T.h @@ -0,0 +1,112 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Pair_T.h +// +// = AUTHOR +// Irfan Pyarali +// +// ============================================================================ + +#ifndef ACE_PAIR_T_H +#define ACE_PAIR_T_H + +#include "ace/Pair.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +//////////////////////////////////////////////////////////////////////////////// + +template <class T1, class T2> +class ACE_Pair +{ + // = TITLE + // Defines a pair. + // + // = DESCRIPTION + // Similar to the STL pair. +public: + + // = Traits. + typedef T1 first_type; + typedef T2 second_type; + + // = Initialization and termination methods. + ACE_Pair (const T1 &t1, + const T2 &t2); + // Constructor. + + ACE_Pair (void); + // Default constructor. + + T1 &first (void); + void first (const T1 &t1); + // Get/Set first. + + T2 &second (void); + void second (const T2 &t2); + // Access second. + +protected: + + T1 first_; + T2 second_; +}; + +//////////////////////////////////////////////////////////////////////////////// + +template <class T1, class T2> +class ACE_Reference_Pair +{ + // = TITLE + // Defines a pair that only hold references. + // + // = DESCRIPTION + // Similar to the STL pair (but restricted to holding references + // and not copies). +public: + + // = Traits. + typedef T1 first_type; + typedef T2 second_type; + + // = Initialization and termination methods. + ACE_Reference_Pair (T1 &t1, + T2 &t2); + // Constructor. + + T1 &first (void); + // Access first. + + T2 &second (void); + // Access second. + +protected: + + T1 &first_; + T2 &second_; +}; + +//////////////////////////////////////////////////////////////////////////////// + +#if defined (__ACE_INLINE__) +#include "ace/Pair_T.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Pair_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation "Pair_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* ACE_PAIR_T_H */ diff --git a/ace/Pair_T.i b/ace/Pair_T.i new file mode 100644 index 00000000000..4769f20e4b5 --- /dev/null +++ b/ace/Pair_T.i @@ -0,0 +1,66 @@ +// $Id$ + +//////////////////////////////////////////////////////////////////////////////// + +template <class T1, class T2> ACE_INLINE +ACE_Pair<T1, T2>::ACE_Pair (const T1 &t1, + const T2 &t2) + : first_ (t1), + second_ (t2) +{ +} + +template <class T1, class T2> ACE_INLINE +ACE_Pair<T1, T2>::ACE_Pair (void) + : first_ (), + second_ () +{ +} + +template <class T1, class T2> ACE_INLINE T1 & +ACE_Pair<T1, T2>::first (void) +{ + return this->first_; +} + +template <class T1, class T2> ACE_INLINE void +ACE_Pair<T1, T2>::first (const T1 &t1) +{ + this->first_ = t1; +} + +template <class T1, class T2> ACE_INLINE T2 & +ACE_Pair<T1, T2>::second (void) +{ + return this->second_; +} + +template <class T1, class T2> ACE_INLINE void +ACE_Pair<T1, T2>::second (const T2 &t2) +{ + this->second_ = t2; +} + +//////////////////////////////////////////////////////////////////////////////// + +template <class T1, class T2> ACE_INLINE +ACE_Reference_Pair<T1, T2>::ACE_Reference_Pair (T1 &t1, + T2 &t2) + : first_ (t1), + second_ (t2) +{ +} + +template <class T1, class T2> ACE_INLINE T1 & +ACE_Reference_Pair<T1, T2>::first (void) +{ + return this->first_; +} + +template <class T1, class T2> ACE_INLINE T2 & +ACE_Reference_Pair<T1, T2>::second (void) +{ + return this->second_; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/ace/ace_dll.dsp b/ace/ace_dll.dsp index 2ff7670872a..80b1e5d44cf 100644 --- a/ace/ace_dll.dsp +++ b/ace/ace_dll.dsp @@ -172,9 +172,9 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
-# ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /FD /MTd /c
+# ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D " WIN32" /D "_DEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /FD /MTd /c
# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /FD /MDd /c
+# ADD CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D " WIN32" /D "_DEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /FD /MDd /c
# SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /o /win32 "NUL"
@@ -206,9 +206,9 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
-# ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /O2 /Ob2 /I "..\\ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /FD /c
+# ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /O2 /Ob2 /I "..\\ /D " WIN32" /D "NDEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /Gt0 /W3 /GX /O2 /Ob2 /I "..\\ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /FD /c
+# ADD CPP /nologo /MD /Gt0 /W3 /GX /O2 /Ob2 /I "..\\ /D " WIN32" /D "NDEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /FD /c
# SUBTRACT CPP /YX
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /o /win32 "NUL"
@@ -240,9 +240,9 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
-# ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /D "UNICODE" /FD /MTd /c
+# ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D " WIN32" /D "_DEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /D "UNICODE" /FD /MTd /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /D "UNICODE" /FD /MTd /c
+# ADD CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D " WIN32" /D "_DEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /D "UNICODE" /FD /MTd /c
# SUBTRACT CPP /YX
MTL=midl.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /o /win32 "NUL"
@@ -274,9 +274,9 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
-# ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /O2 /Ob2 /I "..\\ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /D "UNICODE" /FD /c
+# ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /O2 /Ob2 /I "..\\ /D " WIN32" /D "NDEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /D "UNICODE" /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MT /Gt0 /W3 /GX /O2 /Ob2 /I "..\\ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /D "UNICODE" /FD /c
+# ADD CPP /nologo /MT /Gt0 /W3 /GX /O2 /Ob2 /I "..\\ /D " WIN32" /D "NDEBUG" /D "_WINDOWS" /D ACE_HAS_DLL=1 /D "UNICODE" /FD /c
# SUBTRACT CPP /YX
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /o /win32 "NUL"
@@ -7557,6 +7557,29 @@ DEP_CPP_MALLO=\ # End Source File
# Begin Source File
+SOURCE=.\Map.cpp
+
+!IF "$(CFG)" == "ACE dynamic library - Win32 Debug"
+
+!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
+
SOURCE=.\Mem_Map.cpp
!IF "$(CFG)" == "ACE dynamic library - Win32 Debug"
@@ -10730,6 +10753,29 @@ DEP_CPP_OS_CP=\ # End Source File
# Begin Source File
+SOURCE=.\Pair.cpp
+
+!IF "$(CFG)" == "ACE dynamic library - Win32 Debug"
+
+!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
+
SOURCE=.\Parse_Node.cpp
!IF "$(CFG)" == "ACE dynamic library - Win32 Debug"
@@ -25772,10 +25818,18 @@ SOURCE=.\Managed_Object.h # End Source File
# Begin Source File
+SOURCE=.\Map.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Map_Manager.h
# End Source File
# Begin Source File
+SOURCE=.\Map_T.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Mem_Map.h
# End Source File
# Begin Source File
@@ -25844,6 +25898,14 @@ SOURCE=.\OS.h # End Source File
# Begin Source File
+SOURCE=.\Pair.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Pair_T.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Parse_Node.h
# End Source File
# Begin Source File
@@ -26488,10 +26550,18 @@ SOURCE=.\Managed_Object.i # End Source File
# Begin Source File
+SOURCE=.\Map.i
+# End Source File
+# Begin Source File
+
SOURCE=.\Map_Manager.i
# End Source File
# Begin Source File
+SOURCE=.\Map_T.i
+# End Source File
+# Begin Source File
+
SOURCE=.\Mem_Map.i
# End Source File
# Begin Source File
@@ -26540,6 +26610,14 @@ SOURCE=.\OS.i # End Source File
# Begin Source File
+SOURCE=.\Pair.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\Pair_T.i
+# End Source File
+# Begin Source File
+
SOURCE=.\Parse_Node.i
# End Source File
# Begin Source File
@@ -27079,6 +27157,29 @@ SOURCE=.\Map_Manager.cpp # End Source File
# Begin Source File
+SOURCE=.\Map_T.cpp
+
+!IF "$(CFG)" == "ACE dynamic library - Win32 Debug"
+
+!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
+
SOURCE=.\Message_Queue_T.cpp
!IF "$(CFG)" == "ACE dynamic library - Win32 Debug"
@@ -27128,6 +27229,29 @@ SOURCE=.\Module.cpp # End Source File
# Begin Source File
+SOURCE=.\Pair_T.cpp
+
+!IF "$(CFG)" == "ACE dynamic library - Win32 Debug"
+
+!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
+
SOURCE=.\Select_Reactor_T.cpp
!IF "$(CFG)" == "ACE dynamic library - Win32 Debug"
diff --git a/ace/ace_lib.dsp b/ace/ace_lib.dsp index e3d8617abda..856303ca911 100644 --- a/ace/ace_lib.dsp +++ b/ace/ace_lib.dsp @@ -14,30 +14,22 @@ CFG=ACE static library - Win32 Alpha Unicode Debug !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "ace_lib.mak"\
- CFG="ACE static library - Win32 Alpha Unicode Debug"
+!MESSAGE NMAKE /f "ace_lib.mak" CFG="ACE static library - Win32 Alpha Unicode Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
-!MESSAGE "ACE static library - Win32 Debug" (based on\
- "Win32 (x86) Static Library")
-!MESSAGE "ACE static library - Win32 Release" (based on\
- "Win32 (x86) Static Library")
-!MESSAGE "ACE static library - Win32 Unicode Debug" (based on\
- "Win32 (x86) Static Library")
-!MESSAGE "ACE static library - Win32 Unicode Release" (based on\
- "Win32 (x86) Static Library")
-!MESSAGE "ACE static library - Win32 Alpha Debug" (based on\
- "Win32 (ALPHA) Static Library")
-!MESSAGE "ACE static library - Win32 Alpha Release" (based on\
- "Win32 (ALPHA) Static Library")
-!MESSAGE "ACE static library - Win32 Alpha Unicode Debug" (based on\
- "Win32 (ALPHA) Static Library")
-!MESSAGE "ACE static library - Win32 Alpha Unicode Release" (based on\
- "Win32 (ALPHA) Static Library")
+!MESSAGE "ACE static library - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE "ACE static library - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "ACE static library - Win32 Unicode Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE "ACE static library - Win32 Unicode Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "ACE static library - Win32 Alpha Debug" (based on "Win32 (ALPHA) Static Library")
+!MESSAGE "ACE static library - Win32 Alpha Release" (based on "Win32 (ALPHA) Static Library")
+!MESSAGE "ACE static library - Win32 Alpha Unicode Debug" (based on "Win32 (ALPHA) Static Library")
+!MESSAGE "ACE static library - Win32 Alpha Unicode Release" (based on "Win32 (ALPHA) Static Library")
!MESSAGE
# Begin Project
+# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
@@ -53,11 +45,13 @@ CFG=ACE static library - Win32 Alpha Unicode Debug # PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Debug"
# PROP Target_Dir ""
-RSC=rc.exe
CPP=cl.exe
# ADD BASE CPP /nologo /G5 /MTd /W3 /Gm /GX /Zi /Od /Gy /I "..\STL" /I "..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D __ACE_INLINE__=0 /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /Gy /I "..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /FD /c
# SUBTRACT CPP /YX
+RSC=rc.exe
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo /o"ace.bsc"
# ADD BSC32 /nologo /o".\ace.bsc"
@@ -77,11 +71,13 @@ LIB32=link.exe -lib # PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Release"
# PROP Target_Dir ""
-RSC=rc.exe
CPP=cl.exe
# ADD BASE CPP /nologo /G5 /MT /W3 /GX /O1 /I "..\STL" /I "..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D __ACE_INLINE__=0 /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /I "..\\" /D ACE_HAS_DLL=0 /D __ACE_INLINE__=0 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
+RSC=rc.exe
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo /o"ace.bsc"
# ADD BSC32 /nologo /o".\ace.bsc"
@@ -101,11 +97,13 @@ LIB32=link.exe -lib # PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Unicode_Debug"
# PROP Target_Dir ""
-RSC=rc.exe
CPP=cl.exe
# ADD BASE CPP /nologo /G5 /MTd /W3 /Gm /GX /Zi /Od /Gy /I "..\STL" /I "..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D __ACE_INLINE__=0 /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /Gy /I "..\\" /D ACE_HAS_DLL=0 /D __ACE_INLINE__=0 /D "_DEBUG" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
+RSC=rc.exe
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo /o"ace.bsc"
# ADD BSC32 /nologo /o".\ace.bsc"
@@ -125,11 +123,13 @@ LIB32=link.exe -lib # PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Unicode_Release"
# PROP Target_Dir ""
-RSC=rc.exe
CPP=cl.exe
# ADD BASE CPP /nologo /G5 /MT /W3 /GX /O1 /I "..\STL" /I "..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D __ACE_INLINE__=0 /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /I "..\\" /D ACE_HAS_DLL=0 /D __ACE_INLINE__=0 /D "NDEBUG" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
+RSC=rc.exe
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo /o"ace.bsc"
# ADD BSC32 /nologo /o".\ace.bsc"
@@ -150,9 +150,9 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Lib\Debug"
# PROP Target_Dir ""
CPP=cl.exe
-# ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
+# ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /MTd /c
+# ADD CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /MTd /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo /o".\ace.bsc"
@@ -174,9 +174,9 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Lib\Release"
# PROP Target_Dir ""
CPP=cl.exe
-# ADD BASE CPP /nologo /Gt0 /W3 /GX /O1 /I "..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD BASE CPP /nologo /Gt0 /W3 /GX /O1 /I "..\\ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MT /Gt0 /W3 /GX /O1 /I "..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
+# ADD CPP /nologo /MT /Gt0 /W3 /GX /O1 /I "..\\ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo /o".\ace.bsc"
@@ -198,9 +198,9 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "LIB\Unicode_Debug"
# PROP Target_Dir ""
CPP=cl.exe
-# ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "UNICODE" /FD /c
+# ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "UNICODE" /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "UNICODE" /FD /MTd /c
+# ADD CPP /nologo /Gt0 /W3 /GX /Zi /Od /Gy /I "..\\ /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "UNICODE" /FD /MTd /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo /o".\ace.bsc"
@@ -222,9 +222,9 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "LIB\Unicode_Release"
# PROP Target_Dir ""
CPP=cl.exe
-# ADD BASE CPP /nologo /Gt0 /W3 /GX /O1 /I "..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "UNICODE" /FD /c
+# ADD BASE CPP /nologo /Gt0 /W3 /GX /O1 /I "..\\ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "UNICODE" /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MT /Gt0 /W3 /GX /O1 /I "..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "UNICODE" /FD /c
+# ADD CPP /nologo /MT /Gt0 /W3 /GX /O1 /I "..\\ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "UNICODE" /FD /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo /o".\ace.bsc"
@@ -4518,6 +4518,29 @@ DEP_CPP_MALLO=\ # End Source File
# Begin Source File
+SOURCE=.\Map.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
+
SOURCE=.\Mem_Map.cpp
!IF "$(CFG)" == "ACE static library - Win32 Debug"
@@ -6137,6 +6160,29 @@ DEP_CPP_OS_CP=\ # End Source File
# Begin Source File
+SOURCE=.\Pair.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
+
SOURCE=.\Parse_Node.cpp
!IF "$(CFG)" == "ACE static library - Win32 Debug"
@@ -14709,10 +14755,18 @@ SOURCE=.\Malloc_T.h # End Source File
# Begin Source File
+SOURCE=.\Map.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Map_Manager.h
# End Source File
# Begin Source File
+SOURCE=.\Map_T.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Mem_Map.h
# End Source File
# Begin Source File
@@ -14773,6 +14827,14 @@ SOURCE=.\OS.h # End Source File
# Begin Source File
+SOURCE=.\Pair.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Pair_T.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Parse_Node.h
# End Source File
# Begin Source File
@@ -15365,10 +15427,18 @@ SOURCE=.\Malloc_T.i # End Source File
# Begin Source File
+SOURCE=.\Map.i
+# End Source File
+# Begin Source File
+
SOURCE=.\Map_Manager.i
# End Source File
# Begin Source File
+SOURCE=.\Map_T.i
+# End Source File
+# Begin Source File
+
SOURCE=.\Mem_Map.i
# End Source File
# Begin Source File
@@ -15405,6 +15475,14 @@ SOURCE=.\OS.i # End Source File
# Begin Source File
+SOURCE=.\Pair.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\Pair_T.i
+# End Source File
+# Begin Source File
+
SOURCE=.\Parse_Node.i
# End Source File
# Begin Source File
@@ -15879,6 +15957,29 @@ SOURCE=.\Map_Manager.cpp # End Source File
# Begin Source File
+SOURCE=.\Map_T.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
+
SOURCE=.\Message_Queue_T.cpp
!IF "$(CFG)" == "ACE static library - Win32 Debug"
@@ -15928,6 +16029,29 @@ SOURCE=.\Module.cpp # End Source File
# Begin Source File
+SOURCE=.\Pair_T.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
+
SOURCE=.\Select_Reactor_T.cpp
!IF "$(CFG)" == "ACE static library - Win32 Debug"
diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h index 0aa37d9c1a4..549ed1a0206 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -7,6 +7,11 @@ #ifndef ACE_WIN32_COMMON_H #define ACE_WIN32_COMMON_H +// Define WIN32 if not already defined. +#ifndef WIN32 +#define WIN32 +#endif /* WIN32 */ + // ---------------- platform features or lack of them ------------- #if !defined (ACE_HAS_WINCE) diff --git a/tests/Makefile b/tests/Makefile index ccb68088803..11dd094cb28 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -27,6 +27,7 @@ BIN = Aio_Platform_Test \ OrdMultiSet_Test \ Hash_Map_Manager_Test \ IOStream_Test \ + Map_Test \ Map_Manager_Test \ Mem_Map_Test \ MM_Shared_Memory_Test \ diff --git a/tests/Map_Test.cpp b/tests/Map_Test.cpp new file mode 100644 index 00000000000..59df1a41d07 --- /dev/null +++ b/tests/Map_Test.cpp @@ -0,0 +1,492 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// Map_Test.cpp +// +// = DESCRIPTION +// This is a simple test of the <ACE_Map> and illustrates how to +// use the forward and reverse iterators. +// +// = AUTHOR +// Irfan Pyarali +// +// ============================================================================ + +#include "test_config.h" +#include "ace/Map_T.h" +#include "ace/Profile_Timer.h" +#include "ace/Synch.h" + +ACE_RCSID(tests, Map_Test, "$Id$") + +#if defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 +USELIB("..\ace\aced.lib"); +//--------------------------------------------------------------------------- +#endif /* defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 */ + +// Key type. +typedef ACE_Array<char> KEY; + +//////////////////////////////////////////////////////////////////////////////// + +class Key_Generator +{ + // = TITLE + // Defines a key generator. + // + // = DESCRIPTION + // This class is used in adapters of maps that do not produce keys. +public: + + Key_Generator (void) + : counter_ (0) + { + } + + int operator() (KEY &key) + { + // Keep original information in the key intact. + size_t original_size = key.size (); + + // Size of this counter key. + size_t counter_key_size = sizeof this->counter_; + + // Resize to accommodate both the original data and the new key. + key.size (counter_key_size + original_size); + + // Add new key data. + ACE_OS::memcpy (&key[original_size], + &++this->counter_, + sizeof this->counter_); + + // Success. + return 0; + } + +private: + u_long counter_; +}; + +//////////////////////////////////////////////////////////////////////////////// + +class Hash_Key +{ +public: + u_long operator () (const KEY &key) const + { + // Recover system generated part of key. + u_long value; + size_t counter_key_size = sizeof (u_long); + + // Copy system key from user key. + ACE_OS::memcpy (&value, + &key[key.size () - counter_key_size], + sizeof value); + + // Return the system key value as the hash value. + return value; + } +}; + +//////////////////////////////////////////////////////////////////////////////// + +class Key_Adapter +{ +public: + + int encode (const KEY &original_key, + const ACE_Active_Map_Manager_Key &active_key, + KEY &modified_key) + { + // Keep original information in the key intact. + modified_key = original_key; + size_t original_size = modified_key.size (); + + // Size of active key. + size_t active_key_size = active_key.size (); + + // Resize to accommodate both the original data and the new active key. + modified_key.size (active_key_size + original_size); + + // Copy active key data into user key. + active_key.encode (&modified_key[original_size]); + + // Success. + return 0; + } + + int decode (const KEY &modified_key, + ACE_Active_Map_Manager_Key &active_key) + { + // Read the active key data from the back of the key. + size_t active_key_size = active_key.size (); + size_t original_size = modified_key.size () - active_key_size; + + // Read off value of index and generation. + active_key.decode (&modified_key[original_size]); + + // Success. + return 0; + } + + int decode (const KEY &modified_key, + KEY &original_key) + { + // Read the original user key data from the front of the + // modified key. + size_t active_key_size = ACE_Active_Map_Manager_Key::size (); + + // Copy all the data. + original_key = modified_key; + + // Resize to ignore active key data. + original_key.size (original_key.size () - active_key_size); + + // Success. + return 0; + } +}; + +//////////////////////////////////////////////////////////////////////////////// + +// Value type. +typedef size_t VALUE; + +// Generic map type. +typedef ACE_Map<KEY, VALUE> MAP; + +// Manager Manager adapter. +typedef ACE_Map_Manager_Adapter<KEY, VALUE, Key_Generator> MAP_MANAGER_ADAPTER; + +// Hash Manager Manager adapter. +typedef ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, Hash_Key, ACE_Equal_To<KEY>, Key_Generator> HASH_MAP_MANAGER_ADAPTER; + +// Active Manager Manager adapter. +typedef ACE_Active_Map_Manager_Adapter<KEY, VALUE, Key_Adapter> ACTIVE_MAP_MANAGER_ADAPTER; + +static void +functionality_test (MAP &map, + size_t iterations) +{ + size_t counter; + VALUE i; + KEY *original_keys = new KEY[iterations]; + KEY *modified_keys = new KEY[iterations]; + + // Setup the keys to have some initial data. + for (i = 0; + i < iterations; + ++i) + { + original_keys[i].size (sizeof i / sizeof KEY::TYPE); + ACE_OS::memcpy (&original_keys[i][0], + &i, + sizeof i); + } + + // Make a copy of the keys so that we can compare with the original + // keys later. + for (i = 0; i < iterations; ++i) + { + modified_keys[i] = original_keys[i]; + } + + // Add to the map, allowing keys to be modified. + counter = 0; + for (i = 0; i < iterations; ++i) + { + ACE_ASSERT (map.bind_modify_key (i, modified_keys[i]) == 0); + ++counter; + ACE_ASSERT (map.current_size () == counter); + } + + // Forward iteration... + { + counter = 0; + MAP::iterator end = map.end (); + + for (MAP::iterator iter = map.begin (); + iter != end; + ++iter, ++counter) + { + MAP::value_type entry = *iter; + + // Recover original key. + KEY original_key; + ACE_ASSERT (map.recover_key (entry.first (), + original_key) == 0); + + // Make sure recovering keys work. + ACE_ASSERT (original_keys[entry.second ()] == original_key); + + // Obtain value from key. + VALUE original_value; + ACE_OS::memcpy (&original_value, + &original_key[0], + sizeof original_value); + + // Debugging info. + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("(%d|%d|%d)"), + counter, + original_value, + entry.second ())); + } + + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("\n"))); + ACE_ASSERT (counter == iterations); + } + + // Reverse iteration... + { + counter = iterations; + MAP::reverse_iterator end = map.rend (); + + for (MAP::reverse_iterator iter = map.rbegin (); + iter != end; + ++iter) + { + --counter; + MAP::value_type entry = *iter; + + // Recover original key. + KEY original_key; + ACE_ASSERT (map.recover_key (entry.first (), + original_key) == 0); + + // Make sure recovering keys work. + ACE_ASSERT (original_keys[entry.second ()] == original_key); + + // Obtain value from key. + VALUE original_value; + ACE_OS::memcpy (&original_value, + &original_key[0], + sizeof original_value); + + // Debugging info. + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("(%d|%d|%d)"), + counter, + original_value, + entry.second ())); + } + + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("\n"))); + ACE_ASSERT (counter == 0); + } + + // Search using the modified keys. + for (i = 0; i < iterations; ++i) + { + VALUE j; + ACE_ASSERT (map.find (modified_keys[i], j) != -1); + ACE_ASSERT (i == j); + } + + // Rmoved keys from map. + counter = iterations; + for (i = 0; i < iterations; ++i) + { + ACE_ASSERT (map.unbind (modified_keys[i]) != -1); + --counter; + ACE_ASSERT (map.current_size () == counter); + } + + // Cleanup. + delete[] modified_keys; + delete[] original_keys; +} + +static void +insert_test (MAP &map, + size_t iterations, + KEY *keys) +{ + // Add to the map, allowing keys to be created by the map. + size_t counter = 0; + for (VALUE i = 0; i < iterations; ++i) + { + ACE_ASSERT (map.bind_create_key (i, keys[i]) == 0); + ++counter; + ACE_ASSERT (map.current_size () == counter); + } +} + +static void +find_test (MAP &map, + size_t iterations, + KEY *keys) +{ + // Find system generated keys. + for (VALUE i = 0; i < iterations; ++i) + { + VALUE j; + ACE_ASSERT (map.find (keys[i], j) != -1); + ACE_ASSERT (i == j); + } +} + +static void +unbind_test (MAP &map, + size_t iterations, + KEY *keys) +{ + // Remove system generated keys. + size_t counter = iterations; + for (VALUE i = 0; i < iterations; ++i) + { + ACE_ASSERT (map.unbind (keys[i]) != -1); + --counter; + ACE_ASSERT (map.current_size () == counter); + } +} + +static void +performance_test (void (*ptf) (MAP &, size_t, KEY *), + MAP &map, + size_t iterations, + KEY *keys, + size_t table_size, + const ASYS_TCHAR *test_name) +{ + ACE_Profile_Timer timer; + timer.start (); + + (*ptf) (map, iterations, keys); + + timer.stop (); + + ACE_Profile_Timer::ACE_Elapsed_Time et; + + timer.elapsed_time (et); + + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("time to run %s of size %d for %d iterations\n"), + test_name, + table_size, + iterations)); + + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("real time = %f secs, user time = %f secs, system time = %f secs\n"), + et.real_time, + et.user_time, + et.system_time)); + + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("time per call = %f usecs\n"), + (et.real_time / ACE_timer_t (iterations)) * 1000000)); +} + +int +main (int argc, ASYS_TCHAR *argv[]) +{ + ACE_START_TEST (ASYS_TEXT ("Map_Test")); + ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE_LITE); + + size_t table_size = ACE_MAX_ITERATIONS / 2; + size_t iterations = ACE_MAX_ITERATIONS; + size_t functionality_tests = 1; + + if (argc > 1) + functionality_tests = ACE_OS::atoi (argv[1]); + + if (argc > 2) + table_size = ACE_OS::atoi (argv[2]); + + if (argc > 3) + iterations = ACE_OS::atoi (argv[3]); + + MAP_MANAGER_ADAPTER map1 (table_size); + HASH_MAP_MANAGER_ADAPTER map2 (table_size); + ACTIVE_MAP_MANAGER_ADAPTER map3 (table_size); + + if (functionality_tests) + { + // Functionality test of the maps. + ACE_DEBUG ((LM_DEBUG, "\nMap Manager functionality test\n")); + functionality_test (map1, iterations); + + ACE_DEBUG ((LM_DEBUG, "\nHash Map Manager functionality test\n")); + functionality_test (map2, iterations); + + ACE_DEBUG ((LM_DEBUG, "\nActive Map Manager functionality test\n")); + functionality_test (map3, iterations); + + ACE_DEBUG ((LM_DEBUG, "\n")); + } + + // Performance test of the maps. + KEY *keys = new KEY[iterations]; + + // Map Manager + performance_test (&insert_test, map1, iterations, keys, table_size, "Map Manager (insert test)"); + performance_test (&find_test, map1, iterations, keys, table_size, "Map Manager (find test)"); + performance_test (&unbind_test, map1, iterations, keys, table_size, "Map Manager (unbind test)"); + + ACE_DEBUG ((LM_DEBUG, "\n")); + + // Hash Map Manager + performance_test (&insert_test, map2, iterations, keys, table_size, "Hash Map Manager (insert test)"); + performance_test (&find_test, map2, iterations, keys, table_size, "Hash Map Manager (find test)"); + performance_test (&unbind_test, map2, iterations, keys, table_size, "Hash Map Manager (unbind test)"); + + ACE_DEBUG ((LM_DEBUG, "\n")); + + // Active Map Manager + performance_test (&insert_test, map3, iterations, keys, table_size, "Active Map Manager (insert test)"); + performance_test (&find_test, map3, iterations, keys, table_size, "Active Map Manager (find test)"); + performance_test (&unbind_test, map3, iterations, keys, table_size, "Active Map Manager (unbind test)"); + + delete[] keys; + + ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE); + ACE_END_TEST; + + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +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>; +template class ACE_Active_Map_Manager<TYPE>; +template class ACE_Map_Manager<ACE_Active_Map_Manager_Key, TYPE, MUTEX>; +template class ACE_Map_Iterator_Base<ACE_Active_Map_Manager_Key, TYPE, MUTEX>; +template class ACE_Map_Iterator<ACE_Active_Map_Manager_Key, TYPE, MUTEX>; +template class ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, TYPE, MUTEX>; +template class ACE_Map_Entry<ACE_Active_Map_Manager_Key, TYPE>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#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> +#pragma instantiate ACE_Map_Reverse_Iterator<TYPE, TYPE, MUTEX> +#pragma instantiate ACE_Map_Entry<TYPE, TYPE> +#pragma instantiate ACE_Active_Map_Manager<TYPE> +#pragma instantiate ACE_Map_Manager<ACE_Active_Map_Manager_Key, TYPE, MUTEX> +#pragma instantiate ACE_Map_Iterator_Base<ACE_Active_Map_Manager_Key, TYPE, MUTEX> +#pragma instantiate ACE_Map_Iterator<ACE_Active_Map_Manager_Key, TYPE, MUTEX> +#pragma instantiate ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, TYPE, MUTEX> +#pragma instantiate ACE_Map_Entry<ACE_Active_Map_Manager_Key, TYPE> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/tests/Map_Test.dsp b/tests/Map_Test.dsp new file mode 100644 index 00000000000..e2d8e7fe05d --- /dev/null +++ b/tests/Map_Test.dsp @@ -0,0 +1,206 @@ +# Microsoft Developer Studio Project File - Name="Map_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+# TARGTYPE "Win32 (ALPHA) Console Application" 0x0603
+
+CFG=Map_Test - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Map_Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Map_Test.mak" CFG="Map_Test - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Map_Test - Win32 Debug" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "Map_Test - Win32 Alpha Debug" (based on\
+ "Win32 (ALPHA) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "Map_Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ".\Map_Test\Debug"
+# PROP BASE Intermediate_Dir ".\Map_Test\Debug"
+# PROP BASE Target_Dir ".\Map_Test"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir ".\DLL\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ".\Map_Test"
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+RSC=rc.exe
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Map_Test - Win32 Alpha Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Map_Test\Alpha Debug"
+# PROP BASE Intermediate_Dir "Map_Test\Alpha Debug"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir "Map_Test"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir "Map_Test"
+CPP=cl.exe
+# ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /I "..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /MTd /c
+# ADD CPP /nologo /Gt0 /W3 /GX /Zi /Od /I "..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /MDd /c
+# SUBTRACT CPP /YX
+RSC=rc.exe
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 aced.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:ALPHA /libpath:"..\ace"
+# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:ALPHA /libpath:"..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Map_Test - Win32 Debug"
+# Name "Map_Test - Win32 Alpha Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\Map_Test.cpp
+
+!IF "$(CFG)" == "Map_Test - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "Map_Test - Win32 Alpha Debug"
+
+DEP_CPP_MAP_M=\
+ "..\ace\ACE.h"\
+ "..\ace\ACE.i"\
+ "..\ace\Atomic_Op.i"\
+ "..\ace\Auto_Ptr.cpp"\
+ "..\ace\Auto_Ptr.h"\
+ "..\ace\Auto_Ptr.i"\
+ "..\ace\config-win32-common.h"\
+ "..\ace\config-win32.h"\
+ "..\ace\config.h"\
+ "..\ace\Containers.cpp"\
+ "..\ace\Containers.h"\
+ "..\ace\Containers.i"\
+ "..\ace\Event_Handler.h"\
+ "..\ace\Event_Handler.i"\
+ "..\ace\Free_List.cpp"\
+ "..\ace\Free_List.h"\
+ "..\ace\Free_List.i"\
+ "..\ace\Handle_Set.h"\
+ "..\ace\Handle_Set.i"\
+ "..\ace\Hash_Map.cpp"\
+ "..\ace\Hash_Map.h"\
+ "..\ace\High_Res_Timer.h"\
+ "..\ace\High_Res_Timer.i"\
+ "..\ace\Log_Msg.h"\
+ "..\ace\Log_Priority.h"\
+ "..\ace\Log_Record.h"\
+ "..\ace\Log_Record.i"\
+ "..\ace\Malloc.h"\
+ "..\ace\Malloc.i"\
+ "..\ace\Malloc_T.cpp"\
+ "..\ace\Malloc_T.h"\
+ "..\ace\Malloc_T.i"\
+ "..\ace\Managed_Object.cpp"\
+ "..\ace\Managed_Object.h"\
+ "..\ace\Managed_Object.i"\
+ "..\ace\Map.cpp"\
+ "..\ace\Map.h"\
+ "..\ace\Map.i"\
+ "..\ace\Mem_Map.h"\
+ "..\ace\Mem_Map.i"\
+ "..\ace\Memory_Pool.h"\
+ "..\ace\Memory_Pool.i"\
+ "..\ace\Object_Manager.h"\
+ "..\ace\Object_Manager.i"\
+ "..\ace\OS.h"\
+ "..\ace\OS.i"\
+ "..\ace\Profile_Timer.h"\
+ "..\ace\Profile_Timer.i"\
+ "..\ace\Reactor.h"\
+ "..\ace\Reactor.i"\
+ "..\ace\Reactor_Impl.h"\
+ "..\ace\Service_Config.h"\
+ "..\ace\Service_Config.i"\
+ "..\ace\Service_Object.h"\
+ "..\ace\Service_Object.i"\
+ "..\ace\Shared_Object.h"\
+ "..\ace\Shared_Object.i"\
+ "..\ace\Signal.h"\
+ "..\ace\Signal.i"\
+ "..\ace\SString.h"\
+ "..\ace\SString.i"\
+ "..\ace\stdcpp.h"\
+ "..\ace\SV_Semaphore_Complex.h"\
+ "..\ace\SV_Semaphore_Complex.i"\
+ "..\ace\SV_Semaphore_Simple.h"\
+ "..\ace\SV_Semaphore_Simple.i"\
+ "..\ace\Svc_Conf_Tokens.h"\
+ "..\ace\Synch.h"\
+ "..\ace\Synch.i"\
+ "..\ace\Synch_T.cpp"\
+ "..\ace\Synch_T.h"\
+ "..\ace\Synch_T.i"\
+ "..\ace\Thread.h"\
+ "..\ace\Thread.i"\
+ "..\ace\Time_Value.h"\
+ "..\ace\Timer_Queue.h"\
+ "..\ace\Timer_Queue_T.cpp"\
+ "..\ace\Timer_Queue_T.h"\
+ "..\ace\Timer_Queue_T.i"\
+ "..\ace\Trace.h"\
+ "..\ace\Version.h"\
+ "..\ace\ws2tcpip.h"\
+ ".\test_config.h"\
+
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\test_config.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/tests/SString_Test.cpp b/tests/SString_Test.cpp index e5811c6283c..31051af0b75 100644 --- a/tests/SString_Test.cpp +++ b/tests/SString_Test.cpp @@ -34,6 +34,7 @@ main (int, ASYS_TCHAR *[]) ACE_START_TEST (ASYS_TEXT ("SString_Test")); { + ACE_CString s0 ("hello"); ACE_CString s1 ("hello"); ACE_CString s2 ("world"); ACE_CString s3 ("ll"); @@ -46,24 +47,41 @@ main (int, ASYS_TCHAR *[]) ACE_CString empty_string; ACE_CString zero_size_string (s1.c_str (), 0, 0, 1); + // Not equal comparisons. ACE_ASSERT (s1 != s2); ACE_ASSERT (s1 != s5); + + // Equal comparisons. + ACE_ASSERT (s1 == s1); + ACE_ASSERT (s1 == s0); + + // Substring match. ACE_ASSERT (s1.strstr (s2) == -1); ACE_ASSERT (s1.strstr (s3) == 2); ACE_ASSERT (s3.strstr (s1) == -1); ACE_ASSERT (s1.strstr (s4) == 1); + // Substring creation. + ACE_ASSERT (s1.substring (0) == s1); + ACE_ASSERT (s1.substring (1) == s4); + ACE_ASSERT (s1.substring (2, 2) == s3); + ACE_ASSERT (s1.substring (0, 0) == empty_string); + + // Forward search. ACE_ASSERT (s1.find (s3) == 2); ACE_ASSERT (s3.find (s1) == ACE_CString::npos); ACE_ASSERT (s1.find (s3, 2) == 0); ACE_ASSERT (s3.find (s1, 1) == ACE_CString::npos); ACE_ASSERT (s1.find (s2) == ACE_CString::npos); ACE_ASSERT (s1.find ('o') == 4); + + // Reverse search. ACE_ASSERT (s1.rfind ('l') == 3); ACE_ASSERT (s1.rfind ('l', 3) == 2); } { + ACE_CString s0 ("hello", 0, 0); ACE_CString s1 ("hello", 0, 0); ACE_CString s2 ("world", 0, 0); ACE_CString s3 ("ll", 0, 0); @@ -76,24 +94,41 @@ main (int, ASYS_TCHAR *[]) ACE_CString empty_string (0, 0, 0); ACE_CString zero_size_string (s1.c_str (), 0, 0, 0); + // Not equal comparisons. ACE_ASSERT (s1 != s2); ACE_ASSERT (s1 != s5); + + // Equal comparisons. + ACE_ASSERT (s1 == s1); + ACE_ASSERT (s1 == s0); + + // Substring match. ACE_ASSERT (s1.strstr (s2) == -1); ACE_ASSERT (s1.strstr (s3) == 2); ACE_ASSERT (s3.strstr (s1) == -1); ACE_ASSERT (s1.strstr (s4) == 1); + // Substring creation. + ACE_ASSERT (s1.substring (0) == s1); + ACE_ASSERT (s1.substring (1) == s4); + ACE_ASSERT (s1.substring (2, 2) == s3); + ACE_ASSERT (s1.substring (0, 0) == empty_string); + + // Forward search. ACE_ASSERT (s1.find (s3) == 2); ACE_ASSERT (s3.find (s1) == ACE_CString::npos); ACE_ASSERT (s1.find (s3, 2) == 0); ACE_ASSERT (s3.find (s1, 1) == ACE_CString::npos); ACE_ASSERT (s1.find (s2) == ACE_CString::npos); ACE_ASSERT (s1.find ('o') == 4); + + // Reverse search. ACE_ASSERT (s1.rfind ('l') == 3); ACE_ASSERT (s1.rfind ('l', 3) == 2); } { + ACE_WString s0 ("hello"); ACE_WString s1 ("hello"); ACE_WString s2 ("world"); ACE_WString s3 ("ll"); @@ -106,19 +141,35 @@ main (int, ASYS_TCHAR *[]) ACE_WString empty_string; ACE_WString zero_size_string (s1.c_str (), 0, 0); + // Not equal comparisons. ACE_ASSERT (s1 != s2); ACE_ASSERT (s1 != s5); + + // Equal comparisons. + ACE_ASSERT (s1 == s1); + ACE_ASSERT (s1 == s0); + + // Substring match. ACE_ASSERT (s1.strstr (s2) == -1); ACE_ASSERT (s1.strstr (s3) == 2); ACE_ASSERT (s3.strstr (s1) == -1); ACE_ASSERT (s1.strstr (s4) == 1); + // Substring creation. + ACE_ASSERT (s1.substring (0) == s1); + ACE_ASSERT (s1.substring (1) == s4); + ACE_ASSERT (s1.substring (2, 2) == s3); + ACE_ASSERT (s1.substring (0, 0) == empty_string); + + // Forward search. ACE_ASSERT (s1.find (s3) == 2); ACE_ASSERT (s3.find (s1) == ACE_WString::npos); ACE_ASSERT (s1.find (s3, 2) == 0); ACE_ASSERT (s3.find (s1, 1) == ACE_WString::npos); ACE_ASSERT (s1.find (s2) == ACE_WString::npos); ACE_ASSERT (s1.find ('o') == 4); + + // Reverse search. ACE_ASSERT (s1.rfind ('l') == 3); ACE_ASSERT (s1.rfind ('l', 3) == 2); } diff --git a/tests/run_tests.bat b/tests/run_tests.bat index eb912e2288b..869e3aad294 100644 --- a/tests/run_tests.bat +++ b/tests/run_tests.bat @@ -39,6 +39,7 @@ call %0 %dopure% Hash_Map_Manager_Test call %0 %dopure% High_Res_Timer_Test call %0 %dopure% IOStream_Test call %0 %dopure% Map_Manager_Test +call %0 %dopure% Map_Test call %0 %dopure% Mem_Map_Test call %0 %dopure% Message_Block_Test call %0 %dopure% Message_Queue_Notifications_Test diff --git a/tests/run_tests.psosim b/tests/run_tests.psosim index d4f579f8360..808e8f6380a 100755 --- a/tests/run_tests.psosim +++ b/tests/run_tests.psosim @@ -131,6 +131,8 @@ run Recursive_Mutex_Test # uses Service_Config, Recursive_Thread_ run Map_Manager_Test # uses Map Manager and Hash Map Manager + Forward and Reverse Map Iterators. +run Map_Test # uses Map + Forward and Reverse Map Iterators. + #Message_Queue_Notifications_Test.cpp: threads not supported on this platform #run Message_Queue_Notifications_Test.cpp # uses Message_Queue + Reactor. diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 617e9af7379..d6aed202fb4 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -173,6 +173,7 @@ fi test $chorus || test $LynxOS || test $Unicos || run Tokens_Test # tests ACE_Token run Map_Manager_Test # tests ACE_Map Manager and ACE_Hash_Map_Manager + Forward and Reverse Map Iterators. +run Map_Test # tests ACE_Map + Forward and Reverse Map Iterators. run Message_Queue_Notifications_Test # tests ACE_Message_Queue + ACE_Reactor test $chorus || run Message_Queue_Test # tests ACE_Message_Queue + Forward and Reverse Message Queue Iterators. test $chorus || run Simple_Message_Block_Test # tests ACE_Message_Block diff --git a/tests/run_tests.vxworks b/tests/run_tests.vxworks index 4f49cced6ae..ca4676f708d 100644 --- a/tests/run_tests.vxworks +++ b/tests/run_tests.vxworks @@ -180,6 +180,10 @@ ld < Map_Manager_Test write 2, "Map_Manager_Test ", 17 ace_main; unld "Map_Manager_Test" +ld < Map_Test +write 2, "Map_Test ", 9 +ace_main; unld "Map_Test" + ld < Message_Queue_Notifications_Test write 2, "Message_Queue_Notifications_Test ", 33 ace_main; unld "Message_Queue_Notifications_Test" diff --git a/tests/test_config.h b/tests/test_config.h index 6b750e661f1..0c12e5efcca 100644 --- a/tests/test_config.h +++ b/tests/test_config.h @@ -41,30 +41,6 @@ // The second #undef protects against being reset in a config.h file. #undef ACE_NDEBUG -#if !defined (ACE_HAS_TEMPLATE_SPECIALIZATION) -class KEY -{ - // = TITLE - // Define a key for use with the Map_Manager_Test. - // - // = DESCRIPTION - // This class is put into the test_config.h header file to work - // around AIX C++ compiler "features" related to template - // instantiation... It is only used by Map_Manager_Test.cpp -public: - KEY (size_t v = 0): value_ (v) - { } - - size_t hash (void) const { return this->value_; } - operator size_t () const { return this->value_; } - -private: - size_t value_; -}; -#else -typedef size_t KEY; -#endif /* ACE_HAS_TEMPLATE_SPECIALIZATION */ - #if defined (ACE_HAS_WINCE) #define ACE_DEFAULT_TEST_FILE_W L"\\temp\\ace_test_file" diff --git a/tests/tests.dsw b/tests/tests.dsw index 62b7864848c..14b9aa7c3fb 100644 --- a/tests/tests.dsw +++ b/tests/tests.dsw @@ -255,6 +255,18 @@ Package=<4> ###############################################################################
+Project: "Map_Test"=.\Map_Test.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "Mem_Map_Test"=.\Mem_Map_Test.dsp - Package Owner=<4>
Package=<5>
|