ACE 8.0.5
Loading...
Searching...
No Matches
ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID > Class Template Reference

This class is a thin wrapper around ACE_Hash_Map_Manager, which comes handy when ACE_Hash_Map_Manager is to be used with a non-nil ACE_Allocator. This wrapper insures that the appropriate allocator is in place for every operation that accesses or updates the hash map. More...

#include <Hash_Map_With_Allocator_T.h>

Inheritance diagram for ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >:
Collaboration diagram for ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >:

Public Member Functions

 ACE_Hash_Map_With_Allocator (ACE_Allocator *alloc)
 Constructor.
 ACE_Hash_Map_With_Allocator (size_t size, ACE_Allocator *alloc)
 Constructor that specifies hash table size.
int bind (const EXT_ID &, const INT_ID &, ACE_Allocator *alloc)
int unbind (const EXT_ID &, INT_ID &, ACE_Allocator *alloc)
int unbind (const EXT_ID &, ACE_Allocator *alloc)
int rebind (const EXT_ID &, const INT_ID &, EXT_ID &, INT_ID &, ACE_Allocator *alloc)
int find (const EXT_ID &, INT_ID &, ACE_Allocator *alloc)
int find (const EXT_ID &ext_id, ACE_Allocator *alloc)
 Returns 0 if the ext_id is in the mapping, otherwise -1.
int close (ACE_Allocator *alloc)
Public Member Functions inherited from ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_Mutex >
 ACE_Hash_Map_Manager_Ex (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 ()
int unbind_all ()
 Removes all the entries in the ACE_Hash_Map_Manager_Ex.
 ~ACE_Hash_Map_Manager_Ex ()
 Cleanup the ACE_Hash_Map_Manager_Ex.
int bind (const EXT_ID &item, const INT_ID &int_id)
int trybind (const EXT_ID &ext_id, INT_ID &int_id)
int rebind (const EXT_ID &ext_id, const INT_ID &int_id)
int find (const EXT_ID &ext_id, INT_ID &int_id) const
int unbind (const EXT_ID &ext_id)
size_t current_size () const
size_t total_size () const
ACE_Null_Mutexmutex ()
void dump () const
 Dump the state of an object.
iterator begin ()
 Return forward iterator.
iterator end ()
reverse_iterator rbegin ()
 Return reverse iterator.
reverse_iterator rend ()

Additional Inherited Members

Public Types inherited from ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_Mutex >
typedef EXT_ID KEY
typedef INT_ID VALUE
typedef ACE_Null_Mutex lock_type
typedef ACE_Hash_Map_Entry< EXT_ID, INT_ID > ENTRY
typedef ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_MutexITERATOR
typedef ACE_Hash_Map_Const_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_MutexCONST_ITERATOR
typedef ACE_Hash_Map_Reverse_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_MutexREVERSE_ITERATOR
typedef ACE_Hash_Map_Const_Reverse_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_MutexCONST_REVERSE_ITERATOR
typedef ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_Mutexiterator
typedef ACE_Hash_Map_Const_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_Mutexconst_iterator
typedef ACE_Hash_Map_Reverse_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_Mutexreverse_iterator
typedef ACE_Hash_Map_Const_Reverse_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_Mutexconst_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 constconst_reference
typedef value_typepointer
typedef value_type constconst_pointer
typedef ptrdiff_t difference_type
typedef size_t size_type
Public Attributes inherited from ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_Mutex >
 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.
Protected Member Functions inherited from ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_Mutex >
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 trybind_i (const EXT_ID &ext_id, INT_ID &int_id)
 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 find_i (const EXT_ID &ext_id, INT_ID &int_id)
int unbind_i (const EXT_ID &ext_id, INT_ID &int_id)
 Performs unbind. Must be called with locks held.
int create_buckets (size_t size)
int close_i ()
int unbind_all_i ()
int shared_find (const EXT_ID &ext_id, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&entry, size_t &loc)
 Returns the ACE_Hash_Map_Entry that corresponds to ext_id.
ACE_Hash_Map_Entry< EXT_ID, INT_ID > * table ()
 Accessor of the underlying table.
Protected Attributes inherited from ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_Null_Mutex >
ACE_Allocatortable_allocator_
ACE_Allocatorentry_allocator_
ACE_Null_Mutex lock_
ACE_Hash< EXT_ID > hash_key_
 Function object used for hashing keys.
ACE_Equal_To< EXT_ID > compare_keys_
 Function object used for comparing keys.

Detailed Description

template<class EXT_ID, class INT_ID>
class ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >

This class is a thin wrapper around ACE_Hash_Map_Manager, which comes handy when ACE_Hash_Map_Manager is to be used with a non-nil ACE_Allocator. This wrapper insures that the appropriate allocator is in place for every operation that accesses or updates the hash map.

If we use ACE_Hash_Map_Manager with a shared memory allocator (or memory-mapped file allocator, for example), the allocator pointer used by ACE_Hash_Map_Manager gets stored with it, in shared memory (or memory-mapped file). Naturally, this will cause horrible problems, since only the first process to set that pointer will be guaranteed the address of the allocator is meaningful! That is why we need this wrapper, which insures that appropriate allocator pointer is in place for each call.

At some point it would be a good idea to update this class to use the new "two allocator" technique provided by ACE_Hash_Map_Manager_Ex.

Constructor & Destructor Documentation

◆ ACE_Hash_Map_With_Allocator() [1/2]

template<class EXT_ID, class INT_ID>
ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::ACE_Hash_Map_With_Allocator ( ACE_Allocator * alloc)

Constructor.

◆ ACE_Hash_Map_With_Allocator() [2/2]

template<class EXT_ID, class INT_ID>
ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::ACE_Hash_Map_With_Allocator ( size_t size,
ACE_Allocator * alloc )

Constructor that specifies hash table size.

Member Function Documentation

◆ bind()

template<class EXT_ID, class INT_ID>
int ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::bind ( const EXT_ID & ext_id,
const INT_ID & int_id,
ACE_Allocator * alloc )
inline

◆ close()

template<class EXT_ID, class INT_ID>
int ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::close ( ACE_Allocator * alloc)
inline

◆ find() [1/2]

template<class EXT_ID, class INT_ID>
int ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::find ( const EXT_ID & ext_id,
INT_ID & int_id,
ACE_Allocator * alloc )
inline

◆ find() [2/2]

template<class EXT_ID, class INT_ID>
int ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::find ( const EXT_ID & ext_id,
ACE_Allocator * alloc )
inline

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

◆ rebind()

template<class EXT_ID, class INT_ID>
int ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::rebind ( const EXT_ID & ext_id,
const INT_ID & int_id,
EXT_ID & old_ext_id,
INT_ID & old_int_id,
ACE_Allocator * alloc )
inline

◆ unbind() [1/2]

template<class EXT_ID, class INT_ID>
int ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::unbind ( const EXT_ID & ext_id,
ACE_Allocator * alloc )
inline

◆ unbind() [2/2]

template<class EXT_ID, class INT_ID>
int ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::unbind ( const EXT_ID & ext_id,
INT_ID & int_id,
ACE_Allocator * alloc )
inline

The documentation for this class was generated from the following files: