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>
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) |
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
.
Definition at line 51 of file Hash_Map_With_Allocator_T.h.
ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::ACE_Hash_Map_With_Allocator | ( | ACE_Allocator * | alloc | ) |
Constructor.
Definition at line 19 of file Hash_Map_With_Allocator_T.cpp.
: ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_Null_Mutex> (alloc) { ACE_TRACE ("ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::ACE_Hash_Map_With_Allocator"); }
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.
Definition at line 26 of file Hash_Map_With_Allocator_T.cpp.
: ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_Null_Mutex> (size, alloc) { ACE_TRACE ("ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::ACE_Hash_Map_With_Allocator"); }
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] |
Definition at line 17 of file Hash_Map_With_Allocator_T.inl.
{ ACE_TRACE ("ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::bind"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->bind_i (ext_id, int_id); }
int ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::close | ( | ACE_Allocator * | alloc | ) | [inline] |
Definition at line 8 of file Hash_Map_With_Allocator_T.inl.
{ ACE_TRACE ("ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::close"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->close_i (); }
int ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::find | ( | const EXT_ID & | ext_id, | |
INT_ID & | int_id, | |||
ACE_Allocator * | alloc | |||
) | [inline] |
Definition at line 62 of file Hash_Map_With_Allocator_T.inl.
{ ACE_TRACE ("ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::find"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->find_i (ext_id, 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.
Definition at line 73 of file Hash_Map_With_Allocator_T.inl.
{ ACE_TRACE ("ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::find"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->find_i (ext_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] |
Definition at line 49 of file Hash_Map_With_Allocator_T.inl.
{ ACE_TRACE ("ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::rebind"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id); }
int ACE_Hash_Map_With_Allocator< EXT_ID, INT_ID >::unbind | ( | const EXT_ID & | ext_id, | |
ACE_Allocator * | alloc | |||
) | [inline] |
Definition at line 39 of file Hash_Map_With_Allocator_T.inl.
{ ACE_TRACE ("ACE_Hash_Map_With_Allocator<EXT_ID>::unbind"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->unbind_i (ext_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] |
Definition at line 28 of file Hash_Map_With_Allocator_T.inl.
{ ACE_TRACE ("ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::unbind"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->unbind_i (ext_id, int_id); }