#include <Map_Manager.h>
Inheritance diagram for ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK >:
Public Types | |
typedef EXT_ID | KEY |
typedef INT_ID | VALUE |
typedef ACE_Map_Entry< EXT_ID, INT_ID > | ENTRY |
typedef ACE_Map_Iterator< EXT_ID, INT_ID, ACE_LOCK > | ITERATOR |
typedef ACE_Map_Const_Iterator< EXT_ID, INT_ID, ACE_LOCK > | CONST_ITERATOR |
typedef ACE_Map_Reverse_Iterator< EXT_ID, INT_ID, ACE_LOCK > | REVERSE_ITERATOR |
typedef ACE_Map_Iterator< EXT_ID, INT_ID, ACE_LOCK > | iterator |
typedef ACE_Map_Const_Iterator< EXT_ID, INT_ID, ACE_LOCK > | const_iterator |
typedef ACE_Map_Reverse_Iterator< EXT_ID, INT_ID, ACE_LOCK > | reverse_iterator |
Public Methods | |
ACE_Map_Manager (ACE_Allocator *alloc=0) | |
Initialize a ACE_Map_Manager with the ACE_DEFAULT_MAP_SIZE. | |
ACE_Map_Manager (size_t size, ACE_Allocator *alloc=0) | |
Initialize a ACE_Map_Manager with size entries. | |
int | open (size_t length=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc=0) |
Initialize a ACE_Map_Manager with size length. | |
int | close (void) |
~ACE_Map_Manager (void) | |
int | bind (const EXT_ID &ext_id, const INT_ID &int_id) |
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, INT_ID &old_int_id) |
int | rebind (const EXT_ID &ext_id, const INT_ID &int_id) |
int | trybind (const EXT_ID &ext_id, INT_ID &int_id) |
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 | unbind (const EXT_ID &ext_id) |
int | unbind (const EXT_ID &ext_id, INT_ID &int_id) |
void | unbind_all (void) |
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_Map_Iterator< EXT_ID, INT_ID, ACE_LOCK > | begin (void) |
Return forward iterator. | |
ACE_Map_Iterator< EXT_ID, INT_ID, ACE_LOCK > | end (void) |
ACE_Map_Reverse_Iterator< EXT_ID, INT_ID, ACE_LOCK > | rbegin (void) |
Return reverse iterator. | |
ACE_Map_Reverse_Iterator< EXT_ID, INT_ID, ACE_LOCK > | rend (void) |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Types | |
enum | { MAX_EXPONENTIAL = 64 * 1024, LINEAR_INCREASE = 32 * 1024 } |
Protected Methods | |
int | bind_i (const EXT_ID &ext_id, const INT_ID &int_id) |
int | shared_bind (const EXT_ID &ext_id, const INT_ID &int_id) |
int | rebind_i (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id) |
int | rebind_i (const EXT_ID &ext_id, const INT_ID &int_id, INT_ID &old_int_id) |
int | rebind_i (const EXT_ID &ext_id, const INT_ID &int_id) |
int | trybind_i (const EXT_ID &ext_id, INT_ID &int_id) |
int | find_i (const EXT_ID &ext_id, INT_ID &int_id) |
int | find_and_return_index (const EXT_ID &ext_id, ACE_UINT32 &slot) |
int | unbind_i (const EXT_ID &ext_id, INT_ID &int_id) |
int | unbind_i (const EXT_ID &ext_id) |
int | unbind_and_return_index (const EXT_ID &ext_id, ACE_UINT32 &slot) |
void | unbind_slot (ACE_UINT32 slot) |
Unbind <slot>. | |
int | resize_i (ACE_UINT32 size) |
Resize the map. Must be called with locks held. | |
int | close_i (void) |
Close down a <Map_Manager>. Must be called with locks held. | |
int | equal (const EXT_ID &id1, const EXT_ID &id2) |
ACE_UINT32 | new_size (void) |
void | free_search_structure (void) |
ACE_UINT32 | free_list_id (void) const |
Id of the free list sentinel. | |
ACE_UINT32 | occupied_list_id (void) const |
Id of the occupied list sentinel. | |
int | next_free (ACE_UINT32 &slot) |
Finds the next free slot. | |
void | move_from_free_list_to_occupied_list (ACE_UINT32 slot) |
Move from free list to occupied list. | |
void | move_from_occupied_list_to_free_list (ACE_UINT32 slot) |
Move from occupied list to free list. | |
void | shared_move (ACE_UINT32 slot, ACE_Map_Entry< EXT_ID, INT_ID > ¤t_list, ACE_UINT32 current_list_id, ACE_Map_Entry< EXT_ID, INT_ID > &new_list, ACE_UINT32 new_list_id) |
Move helper. | |
Protected Attributes | |
ACE_Allocator * | allocator_ |
Pointer to a memory allocator. | |
ACE_LOCK | lock_ |
Synchronization variable for the MT_SAFE <ACE_Map_Manager>. | |
ACE_Map_Entry< EXT_ID, INT_ID > * | search_structure_ |
Implement the Map as a resizeable array of <ACE_Map_Entry>. | |
ACE_UINT32 | total_size_ |
Total number of elements in this->search_structure_. | |
ACE_UINT32 | cur_size_ |
Current size of the map. | |
ACE_Map_Entry< EXT_ID, INT_ID > | free_list_ |
Free list. | |
ACE_Map_Entry< EXT_ID, INT_ID > | occupied_list_ |
Occupied list. | |
Private Methods | |
void | operator= (const ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK > &) |
ACE_Map_Manager (const ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK > &) | |
Friends | |
class | ACE_Map_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK > |
class | ACE_Map_Const_Iterator_Base< EXT_ID, INT_ID, ACE_LOCK > |
class | ACE_Map_Iterator< EXT_ID, INT_ID, ACE_LOCK > |
class | ACE_Map_Const_Iterator< EXT_ID, INT_ID, ACE_LOCK > |
class | ACE_Map_Reverse_Iterator< EXT_ID, INT_ID, ACE_LOCK > |
The <EXT_ID> must support <operator==>. This constraint can be alleviated via template specialization, as shown in the $ACE_ROOT/tests/Conn_Test.cpp test. This class uses an <ACE_Allocator> to allocate memory. The user can make this a persistant class by providing an <ACE_Allocator> with a persistable memory pool. This implementation of a map uses an array, which is searched linearly. For more efficient searching you should use the <ACE_Hash_Map_Manager>.
|
|
|
|
|
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
|
|
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
|
|
|
|
Initialize a ACE_Map_Manager with the ACE_DEFAULT_MAP_SIZE.
|
|
Initialize a ACE_Map_Manager with size entries.
|
|
Close down a ACE_Map_Manager and release dynamically allocated resources. |
|
|
|
Return forward iterator.
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Associate ext_id with int_id. If ext_id is already in the map then the ACE_Map_Entry is not changed.
|
|
Performs the binding of <ext_id> to <int_id>. Must be called with locks held. |
|
Close down a ACE_Map_Manager and release dynamically allocated resources. Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Close down a <Map_Manager>. Must be called with locks held.
|
|
Return the current size of the map.
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Dump the state of an object.
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Returns 1 if <id1> == <id2>, else 0. This is defined as a separate method to facilitate template specialization. |
|
Returns 0 if the <ext_id> is in the mapping, otherwise -1.
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Locate <ext_id> and pass out parameter via <int_id>.
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Performs a find using <ext_id> as the key. Must be called with locks held. |
|
Performs a find of <int_id> using <ext_id> as the key. Must be called with locks held. |
|
Id of the free list sentinel.
|
|
Explicitly call the destructors and free up the <search_structure_>. |
|
Move from free list to occupied list.
|
|
Move from occupied list to free list.
|
|
Returns a reference to the underlying <ACE_LOCK>. 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 <lock>, but HP/C++ will choke on that! |
|
This function returns the new size of the Map Manager. This function is called when we run out of room and need to resize. |
|
Finds the next free slot.
|
|
Id of the occupied list sentinel.
|
|
Initialize a ACE_Map_Manager with size length.
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
|
|
Return reverse iterator.
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Reassociate ext_id with int_id. Old values in the map are ignored. Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Reassociate ext_id with int_id. If <ext_id> is not in the map then behaves just like <bind>. Otherwise, store the old values of <int_id> into the "out" parameter and rebind the new parameters.
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Reassociate 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 <Map_Entries> and you also need full control over memory allocation.
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Performs a rebinding of <ext_it> to <int_id>. Must be called with locks held. |
|
Performs a rebinding of <ext_it> to <int_id>. Also, recovers old values. Must be called with locks held. |
|
Performs a rebinding of <ext_it> to <int_id>. Also, recovers old values. Must be called with locks held. |
|
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Resize the map. Must be called with locks held.
|
|
Bind an entry (without finding first). Must be called with locks held. |
|
Move helper.
|
|
Return the total size of the map.
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Associate <ext_id> with <int_id> if and only if <ext_id> is not in the map. If <ext_id> is already in the map then the <int_id> parameter is overwritten with the existing value in the map
|
|
Performs a conditional bind of <int_id> using <ext_id> as the key. Must be called with locks held. |
|
Break any association of <ext_id>. Returns the value of <int_id> in case the caller needs to deallocate memory. Returns 0 if successful, else -1. Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
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...) Returns 0 if successful, else -1. Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Unbind all entires. |
|
Performs an unbind using <ext_id> as the key. Must be called with locks held. |
|
Performs an unbind using <ext_id> as the key. Must be called with locks held. |
|
Performs an unbind of <int_id> using <ext_id> as the key. Must be called with locks held. |
|
Unbind <slot>.
|
|
|
|
|
|
|
|
|
|
|
|
Declare the dynamic allocation hooks.
Reimplemented in ACE_Active_Map_Manager< T >, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >. |
|
Pointer to a memory allocator.
|
|
Current size of the map.
|
|
Free list.
|
|
Synchronization variable for the MT_SAFE <ACE_Map_Manager>.
|
|
Occupied list.
|
|
Implement the Map as a resizeable array of <ACE_Map_Entry>.
|
|
Total number of elements in this->search_structure_.
|