diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-01-31 09:49:06 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-01-31 09:49:06 +0000 |
commit | bf7fe084afe760547ecf2f11c5ac11322badb0f1 (patch) | |
tree | 168604b463027e9780892a37df9e6de2c0016f81 /ace/Map_Manager.h | |
parent | 6587130165c734ec8cd32e7766eed2ae76624c07 (diff) | |
download | ATCD-bf7fe084afe760547ecf2f11c5ac11322badb0f1.tar.gz |
foo
Diffstat (limited to 'ace/Map_Manager.h')
-rw-r--r-- | ace/Map_Manager.h | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/ace/Map_Manager.h b/ace/Map_Manager.h index 14b3bf18b98..ef965ff9943 100644 --- a/ace/Map_Manager.h +++ b/ace/Map_Manager.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY @@ -68,11 +67,10 @@ class ACE_Map_Manager friend class ACE_Map_Iterator<EXT_ID, INT_ID, LOCK>; friend class ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, LOCK>; public: - + // = Traits. typedef ACE_Map_Entry<EXT_ID, INT_ID> ENTRY; typedef ACE_Map_Iterator<EXT_ID, INT_ID, LOCK> ITERATOR; typedef ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, LOCK> REVERSE_ITERATOR; - // Traits enum {DEFAULT_SIZE = ACE_DEFAULT_MAP_SIZE}; @@ -80,7 +78,8 @@ public: ACE_Map_Manager (ACE_Allocator *allocator = 0); // Initialize a <Map_Manager> with the <DEFAULT_SIZE>. - ACE_Map_Manager (size_t size, ACE_Allocator *allocator = 0); + ACE_Map_Manager (size_t size, + ACE_Allocator *allocator = 0); // Initialize a <Map_Manager> with <size> entries. int open (size_t length = DEFAULT_SIZE, @@ -95,7 +94,8 @@ public: // Close down a <Map_Manager> and release dynamically allocated // resources. - int trybind (const EXT_ID &ext_id, INT_ID &int_id); + int trybind (const EXT_ID &ext_id, + INT_ID &int_id); // Associate <ext_id> with <int_id> if and only if <ext_id> is not // in the map. If <ext_id> is already in the map then the <int_id> // parameter is overwritten with the existing value in the map @@ -103,14 +103,17 @@ public: // attempt is made to bind an existing entry, and returns -1 if // failures occur. - int bind (const EXT_ID &ext_id, const INT_ID &int_id); + int bind (const EXT_ID &ext_id, + const INT_ID &int_id); // Associate <ext_id> with <int_id>. If <ext_id> is already in the // map then the <Map_Entry> is not changed. Returns 0 if a new // entry is bound successfully, returns 1 if an attempt is made to // bind an existing entry, and returns -1 if failures occur. - int rebind (const EXT_ID &ext_id, const INT_ID &int_id, - EXT_ID &old_ext_id, INT_ID &old_int_id); + int rebind (const EXT_ID &ext_id, + const INT_ID &int_id, + EXT_ID &old_ext_id, + INT_ID &old_int_id); // Associate <ext_id> with <int_id>. If <ext_id> is not in the // map then behaves just like <bind>. Otherwise, store the old // values of <ext_id> and <int_id> into the "out" parameters and @@ -127,19 +130,19 @@ public: int find (const EXT_ID &ext_id); // Returns 0 if the <ext_id> is in the mapping, otherwise -1. + int unbind (const EXT_ID &ext_id); + // Unbind (remove) the <ext_id> from the map. Don't return the + // <int_id> to the caller (this is useful for collections where the + // <int_id>s are *not* dynamically allocated...) + int unbind (const EXT_ID &ext_id, INT_ID &int_id); // Break any association of <ext_id>. Returns the value of <int_id> in // case the caller needs to deallocate memory. - int unbind (const EXT_ID &ext_id); - // Unbind (remove) the <ext_id> from the map. Don't return the <int_id> - // to the caller (this is useful for collections where the <int_id>s - // are *not* dynamically allocated...) - - int current_size (void); + size_t current_size (void); // Return the current size of the map. - int total_size (void); + size_t total_size (void); // Return the total size of the map. void dump (void) const; @@ -154,8 +157,10 @@ protected: // Implementation of the Map (should use hashing instead of // array...). - // = The following methods do the actual work and assume that - // the locks are held by the private methods. + // = The following methods do the actual work. + + // These methods assume that the locks are held by the private + // methods. int bind_i (const EXT_ID &ext_id, const INT_ID &int_id); // Performs the binding of <ext_id> to <int_id>. Must be @@ -197,7 +202,7 @@ protected: // Pointer to a memory allocator. LOCK lock_; - // Synchronization variable for the MT_SAFE ACE_Map_Manager. + // Synchronization variable for the MT_SAFE <ACE_Map_Manager>. private: @@ -216,7 +221,7 @@ private: // the <ext_id> was found so that this->unbind (<ext_id>, <int_id>) // can return it to the caller. Must be called with locks held. - size_t max_size_; + size_t total_size_; // Total number of elements in this->search_structure_. size_t cur_size_; |