ACE  6.3.3
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Private Member Functions | List of all members
ACE_Active_Map_Manager< T > Class Template Reference

Define a map abstraction that associates system generated keys with user specified values. More...

#include <Active_Map_Manager_T.h>

Inheritance diagram for ACE_Active_Map_Manager< T >:
Inheritance graph
[legend]
Collaboration diagram for ACE_Active_Map_Manager< T >:
Collaboration graph
[legend]

Public Types

typedef ACE_Active_Map_Manager_Key key_type
 
typedef T mapped_type
 
typedef ACE_Map_Entry< ACE_Active_Map_Manager_Key, T > ENTRY
 
typedef ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_MutexITERATOR
 
typedef ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_MutexREVERSE_ITERATOR
 
typedef ENTRY entry
 
typedef ITERATOR iterator
 
typedef REVERSE_ITERATOR reverse_iterator
 
- Public Types inherited from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >
typedef ACE_Active_Map_Manager_Key KEY
 
typedef T VALUE
 
typedef ACE_Null_Mutex lock_type
 
typedef ACE_Map_Entry< ACE_Active_Map_Manager_Key, T > ENTRY
 
typedef ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_MutexITERATOR
 
typedef ACE_Map_Const_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_MutexCONST_ITERATOR
 
typedef ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_MutexREVERSE_ITERATOR
 
typedef ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutexiterator
 
typedef ACE_Map_Const_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutexconst_iterator
 
typedef ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutexreverse_iterator
 

Public Member Functions

 ACE_Active_Map_Manager (ACE_Allocator *alloc=0)
 Initialize a Active_Map_Manager with the ACE_DEFAULT_MAP_SIZE. More...
 
 ACE_Active_Map_Manager (size_t size, ACE_Allocator *alloc=0)
 Initialize a Active_Map_Manager with size entries. More...
 
 ~ACE_Active_Map_Manager (void)
 
int open (size_t length=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc=0)
 Initialize a Active_Map_Manager with size length. More...
 
int close (void)
 
int bind (const T &value, ACE_Active_Map_Manager_Key &key)
 
int bind (const T &value)
 
int bind (ACE_Active_Map_Manager_Key &key, T *&internal_value)
 
int rebind (const ACE_Active_Map_Manager_Key &key, const T &value)
 
int rebind (const ACE_Active_Map_Manager_Key &key, const T &value, T &old_value)
 
int rebind (const ACE_Active_Map_Manager_Key &key, const T &value, ACE_Active_Map_Manager_Key &old_key, T &old_value)
 
int find (const ACE_Active_Map_Manager_Key &key, T &value) const
 Locate value associated with key. More...
 
int find (const ACE_Active_Map_Manager_Key &key) const
 Is key in the map? More...
 
int find (const ACE_Active_Map_Manager_Key &key, T *&internal_value) const
 
int unbind (const ACE_Active_Map_Manager_Key &key)
 Remove key from the map. More...
 
int unbind (const ACE_Active_Map_Manager_Key &key, T &value)
 
int unbind (const ACE_Active_Map_Manager_Key &key, T *&internal_value)
 
size_t current_size (void) const
 Return the current size of the map. More...
 
size_t total_size (void) const
 Return the total size of the map. More...
 
void dump (void) const
 Dump the state of an object. More...
 
ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutexbegin (void)
 Return forward iterator. More...
 
ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutexend (void)
 
ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutexrbegin (void)
 Return reverse iterator. More...
 
ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutexrend (void)
 
- Public Member Functions inherited from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >
 ACE_Map_Manager (ACE_Allocator *alloc=0)
 Initialize a ACE_Map_Manager with the ACE_DEFAULT_MAP_SIZE. More...
 
 ACE_Map_Manager (size_t size, ACE_Allocator *alloc=0)
 Initialize a ACE_Map_Manager with size entries. More...
 
int open (size_t length=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc=0)
 Initialize a ACE_Map_Manager with size length. More...
 
int close (void)
 
 ~ACE_Map_Manager (void)
 
int bind (const ACE_Active_Map_Manager_Key &ext_id, const T &int_id)
 
int rebind (const ACE_Active_Map_Manager_Key &ext_id, const T &int_id, ACE_Active_Map_Manager_Key &old_ext_id, T &old_int_id)
 
int rebind (const ACE_Active_Map_Manager_Key &ext_id, const T &int_id, T &old_int_id)
 
int rebind (const ACE_Active_Map_Manager_Key &ext_id, const T &int_id)
 
int trybind (const ACE_Active_Map_Manager_Key &ext_id, T &int_id)
 
int find (const ACE_Active_Map_Manager_Key &ext_id, T &int_id) const
 
int find (const ACE_Active_Map_Manager_Key &ext_id) const
 Returns 0 if the ext_id is in the mapping, otherwise -1. More...
 
int unbind (const ACE_Active_Map_Manager_Key &ext_id)
 
int unbind (const ACE_Active_Map_Manager_Key &ext_id, T &int_id)
 
void unbind_all (void)
 
size_t current_size (void) const
 Return the current size of the map. More...
 
size_t total_size (void) const
 Return the total size of the map. More...
 
ACE_Null_Mutexmutex (void)
 
void dump (void) const
 Dump the state of an object. More...
 
ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutexbegin (void)
 Return forward iterator. More...
 
ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutexend (void)
 
ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutexrbegin (void)
 Return reverse iterator. More...
 
ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutexrend (void)
 

Static Public Member Functions

static const ACE_Active_Map_Manager_Key npos (void)
 Returns a key that cannot be found in the map. More...
 

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...
 
- Public Attributes inherited from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >
 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...
 

Protected Types

typedef ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_MutexACE_AMM_BASE
 Private base class. More...
 
- Protected Types inherited from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >
enum  
 

Private Member Functions

void operator= (const ACE_Active_Map_Manager< T > &)
 
 ACE_Active_Map_Manager (const ACE_Active_Map_Manager< T > &)
 

Additional Inherited Members

- Protected Member Functions inherited from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >
int bind_i (const ACE_Active_Map_Manager_Key &ext_id, const T &int_id)
 
int shared_bind (const ACE_Active_Map_Manager_Key &ext_id, const T &int_id)
 
int rebind_i (const ACE_Active_Map_Manager_Key &ext_id, const T &int_id, ACE_Active_Map_Manager_Key &old_ext_id, T &old_int_id)
 
int rebind_i (const ACE_Active_Map_Manager_Key &ext_id, const T &int_id, T &old_int_id)
 
int rebind_i (const ACE_Active_Map_Manager_Key &ext_id, const T &int_id)
 
int trybind_i (const ACE_Active_Map_Manager_Key &ext_id, T &int_id)
 
int find_i (const ACE_Active_Map_Manager_Key &ext_id, T &int_id)
 
int find_and_return_index (const ACE_Active_Map_Manager_Key &ext_id, ACE_UINT32 &slot)
 
int unbind_i (const ACE_Active_Map_Manager_Key &ext_id, T &int_id)
 
int unbind_i (const ACE_Active_Map_Manager_Key &ext_id)
 
int unbind_and_return_index (const ACE_Active_Map_Manager_Key &ext_id, ACE_UINT32 &slot)
 
void unbind_slot (ACE_UINT32 slot)
 Unbind slot. More...
 
int resize_i (ACE_UINT32 size)
 Resize the map. Must be called with locks held. More...
 
int close_i (void)
 Close down a <Map_Manager>. Must be called with locks held. More...
 
int equal (const ACE_Active_Map_Manager_Key &id1, const ACE_Active_Map_Manager_Key &id2)
 
ACE_UINT32 new_size (void)
 
void free_search_structure (void)
 
ACE_UINT32 free_list_id (void) const
 Id of the free list sentinel. More...
 
ACE_UINT32 occupied_list_id (void) const
 Id of the occupied list sentinel. More...
 
int next_free (ACE_UINT32 &slot)
 Finds the next free slot. More...
 
void move_from_free_list_to_occupied_list (ACE_UINT32 slot)
 Move from free list to occupied list. More...
 
void move_from_occupied_list_to_free_list (ACE_UINT32 slot)
 Move from occupied list to free list. More...
 
void shared_move (ACE_UINT32 slot, ACE_Map_Entry< ACE_Active_Map_Manager_Key, T > &current_list, ACE_UINT32 current_list_id, ACE_Map_Entry< ACE_Active_Map_Manager_Key, T > &new_list, ACE_UINT32 new_list_id)
 Move helper. More...
 
- Protected Attributes inherited from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >
ACE_Allocatorallocator_
 Pointer to a memory allocator. More...
 
ACE_Null_Mutex lock_
 Synchronization variable for the MT_SAFE ACE_Map_Manager. More...
 
ACE_Map_Entry< ACE_Active_Map_Manager_Key, T > * search_structure_
 Implement the Map as a resizeable array of ACE_Map_Entry. More...
 
ACE_UINT32 total_size_
 Total number of elements in this->search_structure_. More...
 
ACE_UINT32 cur_size_
 Current size of the map. More...
 
ACE_Map_Entry< ACE_Active_Map_Manager_Key, T > free_list_
 Free list. More...
 
ACE_Map_Entry< ACE_Active_Map_Manager_Key, T > occupied_list_
 Occupied list. More...
 

Detailed Description

template<class T>
class ACE_Active_Map_Manager< T >

Define a map abstraction that associates system generated keys with user specified values.

Since the key is system generated, searches are very fast and take a constant amount of time.

Member Typedef Documentation

Private base class.

template<class T>
typedef ENTRY ACE_Active_Map_Manager< T >::entry
template<class T>
typedef ITERATOR ACE_Active_Map_Manager< T >::iterator
template<class T>
typedef T ACE_Active_Map_Manager< T >::mapped_type
template<class T>
typedef REVERSE_ITERATOR ACE_Active_Map_Manager< T >::reverse_iterator

Constructor & Destructor Documentation

template<class T >
ACE_Active_Map_Manager< T >::ACE_Active_Map_Manager ( ACE_Allocator alloc = 0)
inline

Initialize a Active_Map_Manager with the ACE_DEFAULT_MAP_SIZE.

template<class T >
ACE_Active_Map_Manager< T >::ACE_Active_Map_Manager ( size_t  size,
ACE_Allocator alloc = 0 
)
inline

Initialize a Active_Map_Manager with size entries.

template<class T >
ACE_Active_Map_Manager< T >::~ACE_Active_Map_Manager ( void  )
inline

Close down a Active_Map_Manager and release dynamically allocated resources.

template<class T>
ACE_Active_Map_Manager< T >::ACE_Active_Map_Manager ( const ACE_Active_Map_Manager< T > &  )
private

Member Function Documentation

template<class T >
ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex > ACE_Active_Map_Manager< T >::begin ( void  )

Return forward iterator.

template<class T>
int ACE_Active_Map_Manager< T >::bind ( const T &  value,
ACE_Active_Map_Manager_Key key 
)
inline

Add value to the map, and the corresponding key produced by the Active_Map_Manager is returned through key.

template<class T>
int ACE_Active_Map_Manager< T >::bind ( const T &  value)
inline

Add value to the map. The user does not care about the corresponding key produced by the Active_Map_Manager.

template<class T>
int ACE_Active_Map_Manager< T >::bind ( ACE_Active_Map_Manager_Key key,
T *&  internal_value 
)
inline

Reserves a slot in the internal structure and returns the key and a pointer to the value. User should place their value into internal_value. This method is useful in reducing the number of copies required in some cases. Note that internal_value is only a temporary pointer and will change when the map resizes. Therefore, the user should use the pointer immediately and not hold on to it.

template<class T >
int ACE_Active_Map_Manager< T >::close ( void  )
inline

Close down a Active_Map_Manager and release dynamically allocated resources.

template<class T >
size_t ACE_Active_Map_Manager< T >::current_size ( void  ) const
inline

Return the current size of the map.

template<class T >
void ACE_Active_Map_Manager< T >::dump ( void  ) const
inline

Dump the state of an object.

template<class T >
ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex > ACE_Active_Map_Manager< T >::end ( void  )
inline
template<class T>
int ACE_Active_Map_Manager< T >::find ( const ACE_Active_Map_Manager_Key key,
T &  value 
) const
inline

Locate value associated with key.

template<class T>
int ACE_Active_Map_Manager< T >::find ( const ACE_Active_Map_Manager_Key key) const
inline

Is key in the map?

template<class T>
int ACE_Active_Map_Manager< T >::find ( const ACE_Active_Map_Manager_Key key,
T *&  internal_value 
) const
inline

Locate value associated with key. The value is returned via internal_value and hence a copy is saved. Note that internal_value is only a temporary pointer and will change when the map resizes. Therefore, the user should use the pointer immediately and not hold on to it.

template<class T >
const ACE_Active_Map_Manager_Key ACE_Active_Map_Manager< T >::npos ( void  )
inlinestatic

Returns a key that cannot be found in the map.

template<class T >
int ACE_Active_Map_Manager< T >::open ( size_t  length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator alloc = 0 
)
inline

Initialize a Active_Map_Manager with size length.

template<class T>
void ACE_Active_Map_Manager< T >::operator= ( const ACE_Active_Map_Manager< T > &  )
private
template<class T >
ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex > ACE_Active_Map_Manager< T >::rbegin ( void  )
inline

Return reverse iterator.

template<class T>
int ACE_Active_Map_Manager< T >::rebind ( const ACE_Active_Map_Manager_Key key,
const T &  value 
)
inline

Reassociate key with value. The function fails if key is not in the map.

template<class T>
int ACE_Active_Map_Manager< T >::rebind ( const ACE_Active_Map_Manager_Key key,
const T &  value,
T &  old_value 
)
inline

Reassociate key with value, storing the old value into the "out" parameter old_value. The function fails if key is not in the map.

template<class T>
int ACE_Active_Map_Manager< T >::rebind ( const ACE_Active_Map_Manager_Key key,
const T &  value,
ACE_Active_Map_Manager_Key old_key,
T &  old_value 
)
inline

Reassociate key with value, storing the old key and value into the "out" parameter old_key and old_value. The function fails if key is not in the map.

template<class T >
ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex > ACE_Active_Map_Manager< T >::rend ( void  )
inline
template<class T >
size_t ACE_Active_Map_Manager< T >::total_size ( void  ) const
inline

Return the total size of the map.

template<class T >
int ACE_Active_Map_Manager< T >::unbind ( const ACE_Active_Map_Manager_Key key)
inline

Remove key from the map.

template<class T>
int ACE_Active_Map_Manager< T >::unbind ( const ACE_Active_Map_Manager_Key key,
T &  value 
)
inline

Remove key from the map, and return the value associated with key.

template<class T>
int ACE_Active_Map_Manager< T >::unbind ( const ACE_Active_Map_Manager_Key key,
T *&  internal_value 
)
inline

Locate value associated with key. The value is returned via internal_value and hence a copy is saved. Note that internal_value is only a temporary pointer and will change when the map resizes or when this slot is reused. Therefore, the user should use the pointer immediately and not hold on to it.

Member Data Documentation

template<class T>
ACE_Active_Map_Manager< T >::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.


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