Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Hash_Map_Manager_Ex Class Template Reference

Define a map abstraction that efficiently associates <EXT_ID>s with <INT_ID>s. More...

#include <Hash_Map_Manager_T.h>

Inheritance diagram for ACE_Hash_Map_Manager_Ex

Inheritance graph
[legend]
Collaboration diagram for ACE_Hash_Map_Manager_Ex:

Collaboration graph
[legend]
List of all members.

Public Types

typedef EXT_ID KEY
typedef INT_ID VALUE
typedef ACE_Hash_Map_Entry<
EXT_ID, INT_ID> 
ENTRY
typedef ACE_Hash_Map_Iterator_Ex<
EXT_ID, INT_ID, HASH_KEY,
COMPARE_KEYS, ACE_LOCK> 
ITERATOR
typedef ACE_Hash_Map_Const_Iterator_Ex<
EXT_ID, INT_ID, HASH_KEY,
COMPARE_KEYS, ACE_LOCK> 
CONST_ITERATOR
typedef ACE_Hash_Map_Reverse_Iterator_Ex<
EXT_ID, INT_ID, HASH_KEY,
COMPARE_KEYS, ACE_LOCK> 
REVERSE_ITERATOR
typedef ACE_Hash_Map_Iterator_Ex<
EXT_ID, INT_ID, HASH_KEY,
COMPARE_KEYS, ACE_LOCK> 
iterator
typedef ACE_Hash_Map_Const_Iterator_Ex<
EXT_ID, INT_ID, HASH_KEY,
COMPARE_KEYS, ACE_LOCK> 
const_iterator
typedef ACE_Hash_Map_Reverse_Iterator_Ex<
EXT_ID, INT_ID, HASH_KEY,
COMPARE_KEYS, ACE_LOCK> 
reverse_iterator

Public Methods

 ACE_Hash_Map_Manager_Ex (ACE_Allocator *alloc = 0)
 Initialize a <Hash_Map_Manager_Ex> with default size.

 ACE_Hash_Map_Manager_Ex (size_t size, ACE_Allocator *alloc = 0)
 Initialize a <Hash_Map_Manager_Ex> with size <length>.

int open (size_t size = ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc = 0)
 Initialize a <Hash_Map_Manager_Ex> with <size> elements.

int close (void)
 Close down a <Hash_Map_Manager_Ex> and release dynamically allocated resources.

int unbind_all (void)
 Removes all the entries in <Map_Manager_Ex>.

 ~ACE_Hash_Map_Manager_Ex (void)
 Cleanup the <Hash_Map_Manager_Ex>.

int bind (const EXT_ID &item, const INT_ID &int_id)
int bind (const EXT_ID &ext_id, const INT_ID &int_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
int trybind (const EXT_ID &ext_id, INT_ID &int_id)
int trybind (const EXT_ID &ext_id, INT_ID &int_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
int rebind (const EXT_ID &ext_id, const INT_ID &int_id)
int rebind (const EXT_ID &ext_id, const INT_ID &int_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
int rebind (const EXT_ID &ext_id, const INT_ID &int_id, INT_ID &old_int_id)
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)
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, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
int find (const EXT_ID &ext_id, INT_ID &int_id) const
 Locate <ext_id> and pass out parameter via <int_id>. Return 0 if found, returns -1 if not found.

int find (const EXT_ID &ext_id) const
 Returns 0 if the <ext_id> is in the mapping, otherwise -1.

int find (const EXT_ID &ext_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) const
 Locate <ext_id> and pass out parameter via <entry>. If found, return 0, returns -1 if not found.

int unbind (const EXT_ID &ext_id)
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. Return 0 if the unbind was successfully, and returns -1 if failures occur.

int unbind (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry)
 Remove entry from map. Return 0 if the unbind was successfully, and returns -1 if failures occur.

size_t current_size (void) const
 Return the current size of the map.

size_t total_size (void) const
 Return the total size of the map.

ACE_LOCK& mutex (void)
void dump (void) const
 Dump the state of an object.

ACE_Hash_Map_Iterator_Ex<EXT_ID,
INT_ID, HASH_KEY, COMPARE_KEYS,
ACE_LOCK> 
begin (void)
 Return forward iterator.

ACE_Hash_Map_Iterator_Ex<EXT_ID,
INT_ID, HASH_KEY, COMPARE_KEYS,
ACE_LOCK> 
end (void)
ACE_Hash_Map_Reverse_Iterator_Ex<
EXT_ID, INT_ID, HASH_KEY,
COMPARE_KEYS, ACE_LOCK> 
rbegin (void)
 Return reverse iterator.

ACE_Hash_Map_Reverse_Iterator_Ex<
EXT_ID, INT_ID, HASH_KEY,
COMPARE_KEYS, ACE_LOCK> 
rend (void)

Protected Methods

int equal (const EXT_ID &id1, const EXT_ID &id2)
 Returns 1 if <id1> == <id2>, else 0. This is defined as a separate method to facilitate template specialization.

u_long hash (const EXT_ID &ext_id)
 Compute the hash value of the <ext_id>. This is defined as a separate method to facilitate template specialization.

int bind_i (const EXT_ID &ext_id, const INT_ID &int_id)
 Performs bind. Must be called with locks held.

int bind_i (const EXT_ID &ext_id, const INT_ID &int_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
 Performs bind. Must be called with locks held.

int trybind_i (const EXT_ID &ext_id, INT_ID &int_id)
 Performs trybind. Must be called with locks held.

int trybind_i (const EXT_ID &ext_id, INT_ID &int_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
 Performs trybind. Must be called with locks held.

int rebind_i (const EXT_ID &ext_id, const INT_ID &int_id)
 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)
 Performs rebind. Must be called with locks held.

int rebind_i (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
 Performs rebind. Must be called with locks held.

int find_i (const EXT_ID &ext_id, INT_ID &int_id)
 Performs a find of <int_id> using <ext_id> as the key. Must be called with locks held.

int find_i (const EXT_ID &ext_id)
 Performs a find using <ext_id> as the key. Must be called with locks held.

int find_i (const EXT_ID &ext_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry)
 Performs a find using <ext_id> as the key. Must be called with locks held.

int unbind_i (const EXT_ID &ext_id, INT_ID &int_id)
 Performs unbind. Must be called with locks held.

int unbind_i (const EXT_ID &ext_id)
 Performs unbind. Must be called with locks held.

int unbind_i (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry)
 Performs unbind. Must be called with locks held.

int create_buckets (size_t size)
int close_i (void)
 Close down a <Map_Manager_Ex>. Must be called with locks held.

int unbind_all_i (void)
 Removes all the entries in <Map_Manager_Ex>. Must be called with locks held.


Protected Attributes

ACE_Allocatorallocator_
 Pointer to a memory allocator.

ACE_LOCK lock_
 Synchronization variable for the MT_SAFE .

HASH_KEY hash_key_
 Function object used for hashing keys.

COMPARE_KEYS compare_keys_
 Function object used for comparing keys.


Private Methods

int shared_find (const EXT_ID &ext_id, ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry, u_long &loc)
 Returns the that corresponds to <ext_id>.


Private Attributes

ACE_Hash_Map_Entry<EXT_ID,
INT_ID>* 
table_
size_t total_size_
 Total size of the hash table.

size_t cur_size_
 Current number of entries in the table (note that this can be larger than <total_size_> due to the bucket chaining).


Friends

class  ACE_Hash_Map_Iterator_Base_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >
class  ACE_Hash_Map_Iterator_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >
class  ACE_Hash_Map_Const_Iterator_Base_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >
class  ACE_Hash_Map_Const_Iterator_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >
class  ACE_Hash_Map_Reverse_Iterator_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >
class  ACE_Hash_Map_Bucket_Iterator< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >

Detailed Description

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> template class ACE_Hash_Map_Manager_Ex

Define a map abstraction that efficiently associates <EXT_ID>s with <INT_ID>s.

This implementation of a map uses a hash table. Key hashing is achieved through the HASH_KEY object and key comparison is achieved through the COMPARE_KEYS object. This class uses an to allocate memory. The user can make this a persistent class by providing an with a persistable memory pool.


Member Typedef Documentation

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
typedef ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::CONST_ITERATOR
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID> ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ENTRY
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
typedef ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ITERATOR
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
typedef EXT_ID ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::KEY
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
typedef ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::REVERSE_ITERATOR
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
typedef INT_ID ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::VALUE
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
typedef ACE_Hash_Map_Const_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::const_iterator
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
typedef ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::iterator
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
typedef ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_iterator
 


Constructor & Destructor Documentation

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ( ACE_Allocator * alloc = 0 )
 

Initialize a <Hash_Map_Manager_Ex> with default size.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ( size_t size,
ACE_Allocator * alloc = 0 )
 

Initialize a <Hash_Map_Manager_Ex> with size <length>.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::~ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> ( void )
 

Cleanup the <Hash_Map_Manager_Ex>.


Member Function Documentation

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE ACE_Hash_Map_Iterator_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK > ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::begin ( void )
 

Return forward iterator.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::bind ( const EXT_ID & ext_id,
const INT_ID & int_id,
ACE_Hash_Map_Entry< EXT_ID,INT_ID >*& entry )
 

Same as a normal bind, except the map entry is also passed back to the caller. The entry in this case will either be the newly created entry, or the existing one.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::bind ( const EXT_ID & ext_id,
const INT_ID & int_id )
 

Associate <ext_id> with <int_id>. If <ext_id> is already in the map then the 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.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
int ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind_i ( const EXT_ID & ext_id,
const INT_ID & int_id,
ACE_Hash_Map_Entry< EXT_ID,INT_ID >*& entry ) [protected]
 

Performs bind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::bind_i ( const EXT_ID & ext_id,
const INT_ID & int_id ) [protected]
 

Performs bind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::close ( void )
 

Close down a <Hash_Map_Manager_Ex> and release dynamically allocated resources.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
int ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::close_i ( void ) [protected]
 

Close down a <Map_Manager_Ex>. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
int ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::create_buckets ( size_t size ) [protected]
 

Resize the map. Must be called with locks held. Note, that this method should never be called more than once or else all the hashing will get screwed up as the size will change.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE size_t ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::current_size ( void ) const
 

Return the current size of the map.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
void ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump ( void ) const
 

Dump the state of an object.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE ACE_Hash_Map_Iterator_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK > ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::end ( void )
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::equal ( const EXT_ID & id1,
const EXT_ID & id2 ) [protected]
 

Returns 1 if <id1> == <id2>, else 0. This is defined as a separate method to facilitate template specialization.

Reimplemented in ACE_Hash_Map_Manager.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::find ( const EXT_ID & ext_id,
ACE_Hash_Map_Entry< EXT_ID,INT_ID >*& entry ) const
 

Locate <ext_id> and pass out parameter via <entry>. If found, return 0, returns -1 if not found.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::find ( const EXT_ID & ext_id ) const
 

Returns 0 if the <ext_id> is in the mapping, otherwise -1.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::find ( const EXT_ID & ext_id,
INT_ID & int_id ) const
 

Locate <ext_id> and pass out parameter via <int_id>. Return 0 if found, returns -1 if not found.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::find_i ( const EXT_ID & ext_id,
ACE_Hash_Map_Entry< EXT_ID,INT_ID >*& entry ) [protected]
 

Performs a find using <ext_id> as the key. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::find_i ( const EXT_ID & ext_id ) [protected]
 

Performs a find using <ext_id> as the key. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::find_i ( const EXT_ID & ext_id,
INT_ID & int_id ) [protected]
 

Performs a find of <int_id> using <ext_id> as the key. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE u_long ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::hash ( const EXT_ID & ext_id ) [protected]
 

Compute the hash value of the <ext_id>. This is defined as a separate method to facilitate template specialization.

Reimplemented in ACE_Hash_Map_Manager.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE ACE_LOCK & ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::mutex ( void )
 

Returns a reference to the underlying . This makes it possible to acquire the lock explicitly, which can be useful in some cases if you instantiate the with an or , or if you need to guard the state of an iterator. NOTE: the right name would be <lock>, but HP/C++ will choke on that!

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
int ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::open ( size_t size = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator * alloc = 0 )
 

Initialize a <Hash_Map_Manager_Ex> with <size> elements.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE ACE_Hash_Map_Reverse_Iterator_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK > ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::rbegin ( void )
 

Return reverse iterator.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::rebind ( const EXT_ID & ext_id,
const INT_ID & int_id,
EXT_ID & old_ext_id,
INT_ID & old_int_id,
ACE_Hash_Map_Entry< EXT_ID,INT_ID >*& entry )
 

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.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_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 )
 

Associate <ext_id> with <int_id>. If <ext_id> is not in the map then behaves just like <bind>. Otherwise, store the old values of <ext_id> and <int_id> into the "out" parameters and rebind the new parameters. This is very useful if you need to have an atomic way of updating 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.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_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 )
 

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.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_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 )
 

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.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_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 )
 

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.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_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 )
 

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.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_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 ) [protected]
 

Performs rebind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_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 ) [protected]
 

Performs rebind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_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 ) [protected]
 

Performs rebind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_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 ) [protected]
 

Performs rebind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_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 ) [protected]
 

Performs rebind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_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 ) [protected]
 

Performs rebind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE ACE_Hash_Map_Reverse_Iterator_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK > ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::rend ( void )
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
int ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::shared_find ( const EXT_ID & ext_id,
ACE_Hash_Map_Entry< EXT_ID,INT_ID >*& entry,
u_long & loc ) [private]
 

Returns the that corresponds to <ext_id>.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE size_t ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::total_size ( void ) const
 

Return the total size of the map.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::trybind ( const EXT_ID & ext_id,
INT_ID & int_id,
ACE_Hash_Map_Entry< EXT_ID,INT_ID >*& entry )
 

Same as a normal trybind, except the map entry is also passed back to the caller. The entry in this case will either be the newly created entry, or the existing one.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::trybind ( const EXT_ID & ext_id,
INT_ID & int_id )
 

Associate <ext_id> with <int_id> if and only if <ext_id> is not in the map. If <ext_id> is already in the map then the <int_id> parameter is assigned the existing value in the map. Returns 0 if a new entry is bound successfully, returns 1 if an attempt is made to bind an existing entry, and returns -1 if failures occur.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
int ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::trybind_i ( const EXT_ID & ext_id,
INT_ID & int_id,
ACE_Hash_Map_Entry< EXT_ID,INT_ID >*& entry ) [protected]
 

Performs trybind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::trybind_i ( const EXT_ID & ext_id,
INT_ID & int_id ) [protected]
 

Performs trybind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::unbind ( ACE_Hash_Map_Entry< EXT_ID,INT_ID >* entry )
 

Remove entry from map. Return 0 if the unbind was successfully, and returns -1 if failures occur.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::unbind ( const EXT_ID & ext_id,
INT_ID & int_id )
 

Break any association of <ext_id>. Returns the value of <int_id> in case the caller needs to deallocate memory. Return 0 if the unbind was successfully, and returns -1 if failures occur.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::unbind ( const EXT_ID & ext_id )
 

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...)

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::unbind_all ( void )
 

Removes all the entries in <Map_Manager_Ex>.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
int ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_all_i ( void ) [protected]
 

Removes all the entries in <Map_Manager_Ex>. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
int ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_i ( ACE_Hash_Map_Entry< EXT_ID,INT_ID >* entry ) [protected]
 

Performs unbind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID,INT_ID,HASH_KEY,COMPARE_KEYS,ACE_LOCK >::unbind_i ( const EXT_ID & ext_id ) [protected]
 

Performs unbind. Must be called with locks held.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
int ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind_i ( const EXT_ID & ext_id,
INT_ID & int_id ) [protected]
 

Performs unbind. Must be called with locks held.


Friends And Related Function Documentation

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
class ACE_Hash_Map_Bucket_Iterator [friend]
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
class ACE_Hash_Map_Const_Iterator_Base_Ex [friend]
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
class ACE_Hash_Map_Const_Iterator_Ex [friend]
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
class ACE_Hash_Map_Iterator_Base_Ex [friend]
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
class ACE_Hash_Map_Iterator_Ex [friend]
 

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
class ACE_Hash_Map_Reverse_Iterator_Ex [friend]
 


Member Data Documentation

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_Allocator * ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::allocator_ [protected]
 

Pointer to a memory allocator.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
COMPARE_KEYS ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::compare_keys_ [protected]
 

Function object used for comparing keys.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
size_t ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::cur_size_ [private]
 

Current number of entries in the table (note that this can be larger than <total_size_> due to the bucket chaining).

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
HASH_KEY ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::hash_key_ [protected]
 

Function object used for hashing keys.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_LOCK ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::lock_ [protected]
 

Synchronization variable for the MT_SAFE .

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
ACE_Hash_Map_Entry< EXT_ID,INT_ID >* ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::table_ [private]
 

Array of *s, each of which points to an that serves as the beginning of a linked list of <EXT_ID>s that hash to that bucket.

template<classEXT_ID, classINT_ID, classHASH_KEY, classCOMPARE_KEYS, classACE_LOCK>
size_t ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::total_size_ [private]
 

Total size of the hash table.


The documentation for this class was generated from the following files:
Generated at Fri Oct 5 07:02:20 2001 for ACE by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000