ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > Class Template Reference

Define a map abstraction that efficiently associates EXT_ID type objects with INT_ID type objects. More...

#include <Hash_Map_Manager_T.h>

Collaboration diagram for ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef EXT_ID KEY
typedef INT_ID VALUE
typedef ACE_LOCK lock_type
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
typedef EXT_ID key_type
typedef INT_ID data_type
typedef ACE_Hash_Map_Entry<
EXT_ID, INT_ID > 
value_type
typedef value_typereference
typedef value_type const & const_reference
typedef value_typepointer
typedef value_type const * const_pointer
typedef size_t size_type

Public Member Functions

 ACE_Hash_Map_Manager_Ex (ACE_Allocator *table_alloc=0, ACE_Allocator *entry_alloc=0)
 ACE_Hash_Map_Manager_Ex (size_t size, ACE_Allocator *table_alloc=0, ACE_Allocator *entry_alloc=0)
int open (size_t size=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *table_alloc=0, ACE_Allocator *entry_alloc=0)
int close (void)
int unbind_all (void)
 Removes all the entries in the ACE_Hash_Map_Manager_Ex.

 ~ACE_Hash_Map_Manager_Ex (void)
 Cleanup the ACE_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
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
void find (EXT_ID const &ext_id, iterator &pos) const
int unbind (const EXT_ID &ext_id)
int unbind (const EXT_ID &ext_id, INT_ID &int_id)
int unbind (ACE_Hash_Map_Entry< EXT_ID, INT_ID > *entry)
 Remove entry from map.

int unbind (iterator pos)
 Remove entry from map pointed to by iterator pos.

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

iterator begin (void)
 Return forward iterator.

iterator end (void)
const_iterator begin (void) const
const_iterator end (void) const
reverse_iterator rbegin (void)
 Return reverse iterator.

reverse_iterator rend (void)

Protected Member Functions

int equal (const EXT_ID &id1, const EXT_ID &id2)
u_long hash (const EXT_ID &ext_id)
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)
int find_i (const EXT_ID &ext_id)
int find_i (const EXT_ID &ext_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry)
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)
int unbind_all_i (void)
int shared_find (const EXT_ID &ext_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry, size_t &loc)
 Returns the that corresponds to ext_id.

ACE_Hash_Map_Entry< EXT_ID,
INT_ID > * 
table (void)
 Accessor of the underlying table.

size_t cur_size (void) const
 Accessor of the current size attribute.


Protected Attributes

ACE_Allocatortable_allocator_
ACE_Allocatorentry_allocator_
ACE_LOCK lock_
HASH_KEY hash_key_
 Function object used for hashing keys.

COMPARE_KEYS compare_keys_
 Function object used for comparing keys.


Private Member Functions

void operator= (const ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &)
 ACE_Hash_Map_Manager_Ex (const ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &)

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_

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>
class ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >

Define a map abstraction that efficiently associates EXT_ID type objects with INT_ID type objects.

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

Definition at line 118 of file Hash_Map_Manager_T.h.


Member Typedef Documentation

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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
 

Definition at line 148 of file Hash_Map_Manager_T.h.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end().

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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
 

Definition at line 140 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef value_type const* ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_pointer
 

Definition at line 159 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef value_type const& ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_reference
 

Definition at line 157 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef INT_ID ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::data_type
 

Definition at line 154 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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
 

Definition at line 134 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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
 

Definition at line 146 of file Hash_Map_Manager_T.h.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end().

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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
 

Definition at line 138 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef EXT_ID ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::KEY
 

Definition at line 129 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef EXT_ID ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::key_type
 

Definition at line 153 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef ACE_LOCK ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_type
 

Definition at line 132 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef value_type* ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::pointer
 

Definition at line 158 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef value_type& ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reference
 

Definition at line 156 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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
 

Definition at line 150 of file Hash_Map_Manager_T.h.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rbegin(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rend().

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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
 

Definition at line 142 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef size_t ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::size_type
 

Definition at line 161 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef INT_ID ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::VALUE
 

Definition at line 131 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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 >::value_type
 

Definition at line 155 of file Hash_Map_Manager_T.h.


Constructor & Destructor Documentation

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Map_Manager_Ex ACE_Allocator table_alloc = 0,
ACE_Allocator entry_alloc = 0
 

Initialize an ACE_Hash_Map_Manager_Ex with a default number of elements.

Parameters:
table_alloc is a pointer to a memory allocator used for table_, so it should supply size*sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>). If table_alloc is 0 it defaults to ACE_Allocator::instance().
entry_alloc is a pointer to an additional allocator for entries, so it should be able to allocate 'size' / chunks of sizeof(ACE_Hash_Map_Entry<EXT_ID, INT_ID>) bytes each. If entry_alloc is 0 it defaults to the same allocator as table_alloc.

Definition at line 24 of file Hash_Map_Manager_T.inl.

References ACE_DEFAULT_MAP_SIZE, ACE_ERROR, ACE_TEXT, LM_ERROR, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open().

00026   : table_allocator_ (table_alloc),
00027     entry_allocator_ (entry_alloc),
00028     table_ (0),
00029     total_size_ (0),
00030     cur_size_ (0)
00031 {
00032   if (this->open (ACE_DEFAULT_MAP_SIZE, table_alloc, entry_alloc) == -1)
00033     ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
00034                 ACE_TEXT ("ACE_Hash_Map_Manager_Ex open")));
00035 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Map_Manager_Ex size_t  size,
ACE_Allocator table_alloc = 0,
ACE_Allocator entry_alloc = 0
 

Initialize an ACE_Hash_Map_Manager_Ex with size elements.

Parameters:
table_alloc is a pointer to a memory allocator used for table_, so it should supply size*sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>). If table_alloc is 0 it defaults to ACE_Allocator::instance().
entry_alloc is a pointer to an additional allocator for entries, so it should be able to allocate 'size' / chunks of sizeof(ACE_Hash_Map_Entry<EXT_ID, INT_ID>) bytes each. If entry_alloc is 0 it defaults to the same allocator as table_alloc.

Definition at line 10 of file Hash_Map_Manager_T.inl.

References ACE_ERROR, ACE_TEXT, LM_ERROR, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open().

00013   : table_allocator_ (table_alloc),
00014     entry_allocator_ (entry_alloc),
00015     table_ (0),
00016     total_size_ (0),
00017     cur_size_ (0)
00018 {
00019   if (this->open (size, table_alloc, entry_alloc) == -1)
00020     ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Hash_Map_Manager_Ex\n")));
00021 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::~ACE_Hash_Map_Manager_Ex void   ) 
 

Cleanup the ACE_Hash_Map_Manager_Ex.

Definition at line 54 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close().

00055 {
00056   this->close ();
00057 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Map_Manager_Ex const ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &   )  [private]
 


Member Function Documentation

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin void   )  const
 

Definition at line 392 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_iterator.

00393 {
00394   return const_iterator (*this);
00395 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin void   ) 
 

Return forward iterator.

Definition at line 378 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::iterator.

Referenced by ACE_Future_Set< T >::~ACE_Future_Set().

00379 {
00380   return iterator (*this);
00381 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind const EXT_ID &  ext_id,
const INT_ID &  int_id,
ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&  entry
 

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.

Definition at line 110 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i().

00113 {
00114   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00115 
00116   return this->bind_i (ext_id, int_id, entry);
00117 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind const EXT_ID &  item,
const INT_ID &  int_id
 

Associate item with int_id. If item is already in the map then the map is not changed.

Return values:
0 if a new entry is bound successfully.
1 if an attempt is made to bind an existing entry.
-1 if a failure occurs; check errno for more information.

Definition at line 101 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i().

Referenced by ACE_Capabilities::fillent(), ACE_Filecache::finish(), ACE_Future_Set< T >::insert(), and ACE_Filecache::insert_i().

00103 {
00104   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00105 
00106   return this->bind_i (ext_id, int_id);
00107 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i const EXT_ID &  ext_id,
const INT_ID &  int_id,
ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&  entry
[protected]
 

Performs bind. Must be called with locks held.

Definition at line 211 of file Hash_Map_Manager_T.cpp.

References ACE_ALLOCATOR_RETURN, ACE_Hash_Map_Entry< EXT_ID, INT_ID >::next_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_.

00214 {
00215   size_t loc;
00216   int result = this->shared_find (ext_id, entry, loc);
00217 
00218   if (result == -1)
00219     {
00220       void *ptr;
00221       // Not found.
00222       ACE_ALLOCATOR_RETURN (ptr,
00223                             this->entry_allocator_->malloc (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)),
00224                             -1);
00225 
00226       entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (ext_id,
00227                                                             int_id,
00228                                                             this->table_[loc].next_,
00229                                                             &this->table_[loc]);
00230       this->table_[loc].next_ = entry;
00231       entry->next_->prev_ = entry;
00232       this->cur_size_++;
00233       return 0;
00234     }
00235   else
00236     return 1;
00237 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i const EXT_ID &  ext_id,
const INT_ID &  int_id
[protected]
 

Performs bind. Must be called with locks held.

Definition at line 92 of file Hash_Map_Manager_T.inl.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().

00094 {
00095   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp;
00096 
00097   return this->bind_i (ext_id, int_id, temp);
00098 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close void   ) 
 

Close down the ACE_Hash_Map_Manager_Ex and release dynamically allocated resources.

Definition at line 38 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i().

Referenced by ACE_Capabilities::resetcaps(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::~ACE_Hash_Map_Manager_Ex().

00039 {
00040   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00041 
00042   return this->close_i ();
00043 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i void   )  [protected]
 

Close down a . Must be called with locks held.

Definition at line 147 of file Hash_Map_Manager_T.cpp.

References ACE_DES_FREE_TEMPLATE2, ACE_NOOP, ACE_Allocator::free(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_allocator_, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all_i().

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open().

00148 {
00149   // Protect against "double-deletion" in case the destructor also
00150   // gets called.
00151   if (this->table_ != 0)
00152     {
00153       // Remove all the entries.
00154       this->unbind_all_i ();
00155 
00156       // Iterate through the buckets cleaning up the sentinels.
00157       for (size_t i = 0; i < this->total_size_; i++)
00158         {
00159           // Destroy the dummy entry.
00160           ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry = &this->table_[i];
00161 
00162           // The second argument results in a no-op instead of
00163           // deallocation.
00164           ACE_DES_FREE_TEMPLATE2 (entry, ACE_NOOP,
00165                                   ACE_Hash_Map_Entry, EXT_ID, INT_ID);
00166         }
00167 
00168       // Reset size.
00169       this->total_size_ = 0;
00170 
00171       // Free table memory.
00172       this->table_allocator_->free (this->table_);
00173 
00174       // Should be done last...
00175       this->table_ = 0;
00176     }
00177 
00178   return 0;
00179 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::create_buckets size_t  size  )  [protected]
 

Resize the map. Must be called with locks held.

Note:
This method should never be called more than once or else all the hashing will get screwed up as the size will change.

Definition at line 93 of file Hash_Map_Manager_T.cpp.

References ACE_ALLOCATOR_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open().

00094 {
00095   size_t bytes = size * sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>);
00096   void *ptr;
00097 
00098   ACE_ALLOCATOR_RETURN (ptr,
00099                         this->table_allocator_->malloc (bytes),
00100                         -1);
00101 
00102   this->table_ = (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *) ptr;
00103 
00104   this->total_size_ = size;
00105 
00106   // Initialize each entry in the hash table to be a circular linked
00107   // list with the dummy node in the front serving as the anchor of
00108   // the list.
00109   for (size_t i = 0; i < size; i++)
00110     new (&this->table_[i]) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (&this->table_[i],
00111                                                                &this->table_[i]);
00112   return 0;
00113 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE size_t ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::cur_size void   )  const [protected]
 

Accessor of the current size attribute.

Definition at line 441 of file Hash_Map_Manager_T.inl.

00442 {
00443   return this->cur_size_;
00444 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE size_t ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::current_size void   )  const
 

Returns the current number of ACE_Hash_Map_Entry objects in the hash table.

Definition at line 60 of file Hash_Map_Manager_T.inl.

00061 {
00062   return this->cur_size_;
00063 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
void ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::dump void   )  const
 

Dump the state of an object.

Definition at line 79 of file Hash_Map_Manager_T.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_Allocator::dump(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::entry_allocator_, LM_DEBUG, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_allocator_.

00080 {
00081 #if defined (ACE_HAS_DUMP)
00082   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00083   ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("total_size_ = %d"), this->total_size_));
00084   ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("\ncur_size_ = %d"), this->cur_size_));
00085   this->table_allocator_->dump ();
00086   this->entry_allocator_->dump ();
00087   this->lock_.dump ();
00088   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00089 #endif /* ACE_HAS_DUMP */
00090 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end void   )  const
 

Definition at line 399 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::const_iterator.

00400 {
00401   return const_iterator (*this, 1);
00402 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end void   ) 
 

Definition at line 385 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::iterator.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), and ACE_Future_Set< T >::~ACE_Future_Set().

00386 {
00387   return iterator (*this, 1);
00388 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::equal const EXT_ID &  id1,
const EXT_ID &  id2
[protected]
 

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

Reimplemented in ACE_Hash_Map_Manager< EXT_ID, INT_ID, ACE_LOCK >.

Definition at line 85 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::compare_keys_.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().

00087 {
00088   return this->compare_keys_ (id1, id2);
00089 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE void ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find EXT_ID const &  ext_id,
iterator pos
const
 

Parameters:
pos pos will be set to end() if not found.

Definition at line 456 of file Hash_Map_Manager_T.inl.

References ACE_READ_GUARD, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().

00463 {
00464   ENTRY * entry = 0;
00465   size_t index = 0;
00466 
00467   ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
00468     const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
00469     (this);
00470 
00471   ACE_READ_GUARD (ACE_LOCK, ace_mon, this->lock_);
00472 
00473   if (nc_this->shared_find (ext_id, entry, index) != -1)
00474     pos = iterator (*nc_this, entry, index);
00475   else
00476     pos = nc_this->end ();
00477 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find const EXT_ID &  ext_id,
ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&  entry
const
 

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

Definition at line 262 of file Hash_Map_Manager_T.inl.

References ACE_READ_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i().

00264 {
00265   ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
00266     const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
00267     (this);
00268 
00269   ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00270 
00271   return nc_this->find_i (ext_id, entry);
00272 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find const EXT_ID &  ext_id  )  const
 

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

Definition at line 242 of file Hash_Map_Manager_T.inl.

References ACE_READ_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i().

00243 {
00244   ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
00245     const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
00246     (this);
00247 
00248   ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00249 
00250   return nc_this->find_i (ext_id);
00251 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find const EXT_ID &  ext_id,
INT_ID &  int_id
const
 

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

Definition at line 229 of file Hash_Map_Manager_T.inl.

References ACE_READ_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i().

Referenced by ACE_Filecache::fetch(), ACE_Filecache::find(), ACE_Capabilities::getval(), ACE_Filecache::insert_i(), ACE_Future_Set< T >::next_readable(), and ACE_Filecache::remove().

00231 {
00232   ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
00233     const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
00234     (this);
00235 
00236   ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00237 
00238   return nc_this->find_i (ext_id, int_id);
00239 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i const EXT_ID &  ext_id,
ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&  entry
[protected]
 

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

Definition at line 254 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().

00256 {
00257   size_t dummy;
00258   return this->shared_find (ext_id, entry, dummy);
00259 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i const EXT_ID &  ext_id  )  [protected]
 

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

Definition at line 220 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().

00221 {
00222   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry;
00223 
00224   size_t dummy;
00225   return this->shared_find (ext_id, entry, dummy);
00226 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i const EXT_ID &  ext_id,
INT_ID &  int_id
[protected]
 

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

Definition at line 204 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Entry< EXT_ID, INT_ID >::int_id_, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find().

00206 {
00207   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry;
00208 
00209   size_t dummy;
00210   if (this->shared_find (ext_id, entry, dummy) == -1)
00211     return -1;
00212   else
00213     {
00214       int_id = entry->int_id_;
00215       return 0;
00216     }
00217 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE u_long ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::hash const EXT_ID &  ext_id  )  [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< EXT_ID, INT_ID, ACE_LOCK >.

Definition at line 79 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::hash_key_.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().

00080 {
00081   return this->hash_key_ (ext_id);
00082 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_LOCK & ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::mutex void   ) 
 

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 ACE_Atomic_Op with an ACE_Recursive_Mutex or ACE_Process_Mutex, or if you need to guard the state of an iterator.

Note:
The right name would be , but HP/C++ will choke on that!

Definition at line 72 of file Hash_Map_Manager_T.inl.

References ACE_TRACE.

00073 {
00074   ACE_TRACE ("ACE_Hash_Map_Manager_Ex::mutex");
00075   return this->lock_;
00076 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open size_t  size = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator table_alloc = 0,
ACE_Allocator entry_alloc = 0
 

Initialize an ACE_Hash_Map_Manager_Ex with size elements.

Parameters:
table_alloc is a pointer to a memory allocator used for table_, so it should supply size*sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>). If table_alloc is 0 it defaults to ACE_Allocator::instance().
entry_alloc is a pointer to an additional allocator for entries, so it should be able to allocate 'size' / chunks of sizeof(ACE_Hash_Map_Entry<EXT_ID, INT_ID>) bytes each. If entry_alloc is 0 then it defaults to the same allocator as table_alloc.
Returns:
-1 on failure, 0 on success

Definition at line 116 of file Hash_Map_Manager_T.cpp.

References ACE_WRITE_GUARD_RETURN, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::create_buckets(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::entry_allocator_, ACE_Allocator::instance(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_allocator_.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Map_Manager_Ex(), and ACE_Capabilities::resetcaps().

00119 {
00120   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00121 
00122   // Calling this->close_i () to ensure we release previous allocated
00123   // memory before allocating new one.
00124   this->close_i ();
00125 
00126   if (table_alloc == 0)
00127     table_alloc = ACE_Allocator::instance ();
00128 
00129   this->table_allocator_ = table_alloc;
00130 
00131   if (entry_alloc == 0)
00132     entry_alloc = table_alloc;
00133 
00134   this->entry_allocator_ = entry_alloc;
00135 
00136   // This assertion is here to help track a situation that shouldn't
00137   // happen, but did with Sun C++ 4.1 (before a change to this class
00138   // was made: it used to have an enum that was supposed to be defined
00139   // to be ACE_DEFAULT_MAP_SIZE, but instead was defined to be 0).
00140   if (size == 0)
00141     return -1;
00142 
00143   return this->create_buckets (size);
00144 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
void ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::operator= const ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &   )  [private]
 

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reverse_iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rbegin void   ) 
 

Return reverse iterator.

Definition at line 406 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reverse_iterator.

00407 {
00408   return reverse_iterator (*this);
00409 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind const EXT_ID &  ext_id,
const INT_ID &  int_id,
EXT_ID &  old_ext_id,
INT_ID &  old_int_id,
ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&  entry
 

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.

Definition at line 365 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().

00370 {
00371   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00372 
00373   return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id, entry);
00374 }

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
 

Associate ext_id with int_id. If ext_id is not in the map then behaves just like . 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.

Definition at line 354 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().

00358 {
00359   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00360 
00361   return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id);
00362 }

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
 

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.

Definition at line 343 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().

00347 {
00348   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00349 
00350   return this->rebind_i (ext_id, int_id, old_int_id, entry);
00351 }

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
 

Associate ext_id with int_id. If ext_id is not in the map then behaves just like . 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.

Definition at line 333 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().

00336 {
00337   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00338 
00339   return this->rebind_i (ext_id, int_id, old_int_id);
00340 }

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
 

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.

Definition at line 323 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().

00326 {
00327   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00328 
00329   return this->rebind_i (ext_id, int_id, entry);
00330 }

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
 

Reassociate ext_id with int_id. If ext_id is not in the map then behaves just like . Returns 0 if a new entry is bound successfully, returns 1 if an existing entry was rebound, and returns -1 if failures occur.

Definition at line 314 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().

00316 {
00317   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00318 
00319   return this->rebind_i (ext_id, int_id);
00320 }

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
[protected]
 

Performs rebind. Must be called with locks held.

Definition at line 361 of file Hash_Map_Manager_T.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i(), ACE_Hash_Map_Entry< EXT_ID, INT_ID >::ext_id_, ACE_Hash_Map_Entry< EXT_ID, INT_ID >::int_id_, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().

00366 {
00367   size_t dummy;
00368   if (this->shared_find (ext_id, entry, dummy) == -1)
00369     return this->bind_i (ext_id, int_id);
00370   else
00371     {
00372       old_ext_id = entry->ext_id_;
00373       old_int_id = entry->int_id_;
00374       entry->ext_id_ = ext_id;
00375       entry->int_id_ = int_id;
00376       return 1;
00377     }
00378 }

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
[protected]
 

Performs rebind. Must be called with locks held.

Definition at line 299 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().

00303 {
00304   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node;
00305 
00306   return this->rebind_i (ext_id,
00307                          int_id,
00308                          old_ext_id,
00309                          old_int_id,
00310                          node);
00311 }

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
[protected]
 

Performs rebind. Must be called with locks held.

Definition at line 343 of file Hash_Map_Manager_T.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i(), ACE_Hash_Map_Entry< EXT_ID, INT_ID >::ext_id_, ACE_Hash_Map_Entry< EXT_ID, INT_ID >::int_id_, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().

00347 {
00348   size_t dummy;
00349   if (this->shared_find (ext_id, entry, dummy) == -1)
00350     return this->bind_i (ext_id, int_id);
00351   else
00352     {
00353       old_int_id = entry->int_id_;
00354       entry->ext_id_ = ext_id;
00355       entry->int_id_ = int_id;
00356       return 1;
00357     }
00358 }

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
[protected]
 

Performs rebind. Must be called with locks held.

Definition at line 286 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().

00289 {
00290   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node;
00291 
00292   return this->rebind_i (ext_id,
00293                          int_id,
00294                          old_int_id,
00295                          node);
00296 }

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
[protected]
 

Performs rebind. Must be called with locks held.

Definition at line 327 of file Hash_Map_Manager_T.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i(), ACE_Hash_Map_Entry< EXT_ID, INT_ID >::ext_id_, ACE_Hash_Map_Entry< EXT_ID, INT_ID >::int_id_, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().

00330 {
00331   size_t dummy;
00332   if (this->shared_find (ext_id, entry, dummy) == -1)
00333     return this->bind_i (ext_id, int_id);
00334   else
00335     {
00336       entry->ext_id_ = ext_id;
00337       entry->int_id_ = int_id;
00338       return 1;
00339     }
00340 }

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
[protected]
 

Performs rebind. Must be called with locks held.

Definition at line 275 of file Hash_Map_Manager_T.inl.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i().

00277 {
00278   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *node;
00279 
00280   return this->rebind_i (ext_id,
00281                          int_id,
00282                          node);
00283 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reverse_iterator ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rend void   ) 
 

Definition at line 413 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reverse_iterator.

00414 {
00415   return reverse_iterator (*this, 1);
00416 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find const EXT_ID &  ext_id,
ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&  entry,
size_t &  loc
[protected]
 

Returns the that corresponds to ext_id.

Definition at line 303 of file Hash_Map_Manager_T.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::equal(), ACE_Hash_Map_Entry< EXT_ID, INT_ID >::ext_id_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::hash(), ACE_Hash_Map_Entry< EXT_ID, INT_ID >::next_, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find_i(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::rebind_i(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().

00306 {
00307   loc = this->hash (ext_id) % this->total_size_;
00308 
00309   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp = this->table_[loc].next_;
00310 
00311   while (temp != &this->table_[loc] && this->equal (temp->ext_id_, ext_id) == 0)
00312     temp = temp->next_;
00313 
00314   if (temp == &this->table_[loc])
00315     {
00316       errno = ENOENT;
00317       return -1;
00318     }
00319   else
00320     {
00321       entry = temp;
00322       return 0;
00323     }
00324 }

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_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table void   )  [protected]
 

Accessor of the underlying table.

Definition at line 434 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_.

00435 {
00436   return this->table_;
00437 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE size_t ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::total_size void   )  const
 

Return the size of the array that's used to point to the linked lists of ACE_Hash_Map_Entry objects in the hash table.

Definition at line 66 of file Hash_Map_Manager_T.inl.

00067 {
00068   return this->total_size_;
00069 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind const EXT_ID &  ext_id,
INT_ID &  int_id,
ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&  entry
 

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.

Definition at line 141 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i().

00144 {
00145   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00146 
00147   return this->trybind_i (ext_id, int_id, entry);
00148 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind const EXT_ID &  ext_id,
INT_ID &  int_id
 

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.

Definition at line 132 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i().

00134 {
00135   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00136 
00137   return this->trybind_i (ext_id, int_id);
00138 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i const EXT_ID &  ext_id,
INT_ID &  int_id,
ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&  entry
[protected]
 

Performs trybind. Must be called with locks held.

Definition at line 240 of file Hash_Map_Manager_T.cpp.

References ACE_ALLOCATOR_RETURN, ACE_Hash_Map_Entry< EXT_ID, INT_ID >::next_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_.

00243 {
00244   size_t loc;
00245   int result = this->shared_find (ext_id, entry, loc);
00246 
00247   if (result == -1)
00248     {
00249       // Not found.
00250       void *ptr;
00251       ACE_ALLOCATOR_RETURN (ptr,
00252                             this->entry_allocator_->malloc (sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>)),
00253                             -1);
00254 
00255       entry = new (ptr) ACE_Hash_Map_Entry<EXT_ID, INT_ID> (ext_id,
00256                                                             int_id,
00257                                                             this->table_[loc].next_,
00258                                                             &this->table_[loc]);
00259       this->table_[loc].next_ = entry;
00260       entry->next_->prev_ = entry;
00261       this->cur_size_++;
00262       return 0;
00263     }
00264   else
00265     return 1;
00266 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i const EXT_ID &  ext_id,
INT_ID &  int_id
[protected]
 

Performs trybind. Must be called with locks held.

Definition at line 120 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Entry< EXT_ID, INT_ID >::int_id_.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind().

00122 {
00123   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp;
00124 
00125   int result = this->trybind_i (ext_id, int_id, temp);
00126   if (result == 1)
00127     int_id = temp->int_id_;
00128   return result;
00129 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind iterator  pos  ) 
 

Remove entry from map pointed to by iterator pos.

This unbind operation is fast relative to those that accept an external ID parameter since no map lookup is performed.

Returns:
0 if the unbind was successful, and -1 if failures occur.

Definition at line 177 of file Hash_Map_Manager_T.inl.

00183 {
00184   return this->unbind (&(*pos));
00185 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind ACE_Hash_Map_Entry< EXT_ID, INT_ID > *  entry  ) 
 

Remove entry from map.

This unbind operation is fast relative to those that accept an external ID parameter since no map lookup is performed.

Returns:
0 if the unbind was successful, and -1 if failures occur.

Definition at line 196 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().

00197 {
00198   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00199 
00200   return this->unbind_i (entry) == -1 ? -1 : 0;
00201 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind const EXT_ID &  ext_id,
INT_ID &  int_id
 

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 successful, and returns -1 if failures occur.

Definition at line 159 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().

00161 {
00162   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00163 
00164   return this->unbind_i (ext_id, int_id);
00165 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind const EXT_ID &  ext_id  ) 
 

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_ids are *not* dynamically allocated...)

Definition at line 188 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().

Referenced by ACE_Future_Set< T >::next_readable(), ACE_Cached_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX >::purge_i(), and ACE_Filecache::remove_i().

00189 {
00190   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00191 
00192   return this->unbind_i (ext_id) == -1 ? -1 : 0;
00193 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all void   ) 
 

Removes all the entries in the ACE_Hash_Map_Manager_Ex.

Definition at line 46 of file Hash_Map_Manager_T.inl.

References ACE_WRITE_GUARD_RETURN, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all_i().

00047 {
00048   ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00049 
00050   return this->unbind_all_i ();
00051 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all_i void   )  [protected]
 

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

Definition at line 182 of file Hash_Map_Manager_T.cpp.

References ACE_DES_FREE_TEMPLATE2, ACE_Hash_Map_Entry< EXT_ID, INT_ID >::next_, ACE_Hash_Map_Entry< EXT_ID, INT_ID >::prev_, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all().

00183 {
00184   // Iterate through the entire map calling the destuctor of each
00185   // <ACE_Hash_Map_Entry>.
00186   for (size_t i = 0; i < this->total_size_; i++)
00187     {
00188       for (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp_ptr = this->table_[i].next_;
00189            temp_ptr != &this->table_[i];
00190            )
00191         {
00192           ACE_Hash_Map_Entry<EXT_ID, INT_ID> *hold_ptr = temp_ptr;
00193           temp_ptr = temp_ptr->next_;
00194 
00195           // Explicitly call the destructor.
00196           ACE_DES_FREE_TEMPLATE2 (hold_ptr, this->entry_allocator_->free,
00197                                   ACE_Hash_Map_Entry, EXT_ID, INT_ID);
00198         }
00199 
00200       // Restore the sentinel.
00201       this->table_[i].next_ = &this->table_[i];
00202       this->table_[i].prev_ = &this->table_[i];
00203     }
00204 
00205   this->cur_size_ = 0;
00206 
00207   return 0;
00208 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i ACE_Hash_Map_Entry< EXT_ID, INT_ID > *  entry  )  [protected]
 

Performs unbind. Must be called with locks held.

Definition at line 289 of file Hash_Map_Manager_T.cpp.

References ACE_DES_FREE_TEMPLATE2, ACE_Hash_Map_Entry< EXT_ID, INT_ID >::next_, and ACE_Hash_Map_Entry< EXT_ID, INT_ID >::prev_.

00290 {
00291   entry->next_->prev_ = entry->prev_;
00292   entry->prev_->next_ = entry->next_;
00293 
00294   // Explicitly call the destructor.
00295   ACE_DES_FREE_TEMPLATE2 (entry, this->entry_allocator_->free,
00296                           ACE_Hash_Map_Entry, EXT_ID, INT_ID);
00297 
00298   this->cur_size_--;
00299   return 0;
00300 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i const EXT_ID &  ext_id  )  [protected]
 

Performs unbind. Must be called with locks held.

Definition at line 151 of file Hash_Map_Manager_T.inl.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().

00152 {
00153   INT_ID int_id;
00154 
00155   return this->unbind_i (ext_id, int_id);
00156 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
int ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i const EXT_ID &  ext_id,
INT_ID &  int_id
[protected]
 

Performs unbind. Must be called with locks held.

Definition at line 269 of file Hash_Map_Manager_T.cpp.

References ACE_Hash_Map_Entry< EXT_ID, INT_ID >::int_id_, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find().

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_i().

00271 {
00272   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *temp;
00273 
00274   size_t loc;
00275   int result = this->shared_find (ext_id, temp, loc);
00276 
00277   if (result == -1)
00278     {
00279       errno = ENOENT;
00280       return -1;
00281     }
00282 
00283   int_id = temp->int_id_;
00284 
00285   return this->unbind_i (temp);
00286 }


Friends And Related Function Documentation

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
friend class ACE_Hash_Map_Bucket_Iterator< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend]
 

Definition at line 126 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
friend class ACE_Hash_Map_Const_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend]
 

Definition at line 123 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
friend class ACE_Hash_Map_Const_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend]
 

Definition at line 124 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
friend class ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend]
 

Definition at line 121 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
friend class ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend]
 

Definition at line 122 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
friend class ACE_Hash_Map_Reverse_Iterator_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > [friend]
 

Definition at line 125 of file Hash_Map_Manager_T.h.


Member Data Documentation

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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.

Definition at line 535 of file Hash_Map_Manager_T.h.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::equal().

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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 due to the bucket chaining).

Definition at line 563 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_Allocator* ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::entry_allocator_ [protected]
 

Addidtional allocator for entries, so it should be able to allocate 'size' / chunks of sizeof(ACE_Hash_Map_Entry<EXT_ID, INT_ID>) bytes each.

Definition at line 525 of file Hash_Map_Manager_T.h.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::dump(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open().

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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.

Definition at line 532 of file Hash_Map_Manager_T.h.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::hash().

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_LOCK ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::lock_ [mutable, protected]
 

Synchronization variable for the MT_SAFE ACE_Hash_Map_Manager_Ex.

Definition at line 529 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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 s that hash to that bucket.

Definition at line 555 of file Hash_Map_Manager_T.h.

Referenced by ACE_Hash_Map_Const_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Map_Const_Iterator_Base_Ex(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind_i(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::create_buckets(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::shared_find(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::trybind_i(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all_i().

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_Allocator* ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::table_allocator_ [protected]
 

Pointer to a memory allocator used for table_, so it should supply size*sizeof (ACE_Hash_Map_Entry<EXT_ID, INT_ID>),

Definition at line 520 of file Hash_Map_Manager_T.h.

Referenced by ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close_i(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::dump(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open().

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_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.

Definition at line 558 of file Hash_Map_Manager_T.h.

Referenced by ACE_Hash_Map_Const_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Map_Const_Iterator_Base_Ex().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 12:54:58 2008 for ACE by doxygen 1.3.6