ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR > Class Template Reference

Defines a map implementation. More...

#include <Map_T.h>

Inheritance diagram for ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >:

Inheritance graph
[legend]
Collaboration diagram for ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Map_Manager_Iterator_Adapter<
ACE_Reference_Pair< const
KEY, VALUE >, KEY, VALUE > 
iterator_impl
typedef ACE_Map_Manager_Reverse_Iterator_Adapter<
ACE_Reference_Pair< const
KEY, VALUE >, KEY, VALUE > 
reverse_iterator_impl
typedef ACE_Map_Manager< KEY,
VALUE, ACE_Null_Mutex
implementation

Public Member Functions

 ACE_Map_Manager_Adapter (ACE_Allocator *alloc=0)
 Initialize with the .

 ACE_Map_Manager_Adapter (size_t size, ACE_Allocator *alloc=0)
virtual ~ACE_Map_Manager_Adapter (void)
 Close down and release dynamically allocated resources.

virtual int open (size_t length=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc=0)
 Initialize a with size .

virtual int close (void)
 Close down a and release dynamically allocated resources.

virtual int bind (const KEY &key, const VALUE &value)
virtual int bind_modify_key (const VALUE &value, KEY &key)
virtual int create_key (KEY &key)
virtual int bind_create_key (const VALUE &value, KEY &key)
virtual int bind_create_key (const VALUE &value)
virtual int recover_key (const KEY &modified_key, KEY &original_key)
virtual int rebind (const KEY &key, const VALUE &value)
virtual int rebind (const KEY &key, const VALUE &value, VALUE &old_value)
virtual int rebind (const KEY &key, const VALUE &value, KEY &old_key, VALUE &old_value)
virtual int trybind (const KEY &key, VALUE &value)
virtual int find (const KEY &key, VALUE &value)
 Locate associated with .

virtual int find (const KEY &key)
 Is in the map?

virtual int unbind (const KEY &key)
 Remove from the map.

virtual int unbind (const KEY &key, VALUE &value)
virtual size_t current_size (void) const
 Return the current size of the map.

virtual size_t total_size (void) const
 Return the total size of the map.

virtual void dump (void) const
 Dump the state of an object.

ACE_Map_Manager< KEY, VALUE,
ACE_Null_Mutex > & 
impl (void)
 Accessor to implementation object.

KEY_GENERATOR & key_generator (void)
 Accessor to key generator.


Protected Member Functions

virtual ACE_Iterator_Impl<
ACE_Reference_Pair< const
KEY, VALUE > > * 
begin_impl (void)
 Return forward iterator.

virtual ACE_Iterator_Impl<
ACE_Reference_Pair< const
KEY, VALUE > > * 
end_impl (void)
virtual ACE_Reverse_Iterator_Impl<
ACE_Reference_Pair< const
KEY, VALUE > > * 
rbegin_impl (void)
 Return reverse iterator.

virtual ACE_Reverse_Iterator_Impl<
ACE_Reference_Pair< const
KEY, VALUE > > * 
rend_impl (void)

Protected Attributes

ACE_Map_Manager< KEY, VALUE,
ACE_Null_Mutex
implementation_
 All implementation details are forwarded to this class.

KEY_GENERATOR key_generator_
 Functor class used for generating key.


Private Member Functions

void operator= (const ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR > &)
 ACE_Map_Manager_Adapter (const ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR > &)

Detailed Description

template<class KEY, class VALUE, class KEY_GENERATOR>
class ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >

Defines a map implementation.

Implementation to be provided by .

Definition at line 1410 of file Map_T.h.


Member Typedef Documentation

template<class KEY, class VALUE, class KEY_GENERATOR>
typedef ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::implementation
 

Definition at line 1420 of file Map_T.h.

template<class KEY, class VALUE, class KEY_GENERATOR>
typedef ACE_Map_Manager_Iterator_Adapter<ACE_Reference_Pair<const KEY, VALUE>, KEY, VALUE> ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::iterator_impl
 

Definition at line 1416 of file Map_T.h.

template<class KEY, class VALUE, class KEY_GENERATOR>
typedef ACE_Map_Manager_Reverse_Iterator_Adapter<ACE_Reference_Pair<const KEY, VALUE>, KEY, VALUE> ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::reverse_iterator_impl
 

Definition at line 1418 of file Map_T.h.


Constructor & Destructor Documentation

template<class KEY, class VALUE, class KEY_GENERATOR>
ACE_INLINE ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::ACE_Map_Manager_Adapter ACE_Allocator alloc = 0  ) 
 

Initialize with the .

Definition at line 390 of file Map_T.inl.

00391   : implementation_ (alloc)
00392 {
00393 }

template<class KEY, class VALUE, class KEY_GENERATOR>
ACE_INLINE ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::ACE_Map_Manager_Adapter size_t  size,
ACE_Allocator alloc = 0
 

Initialize with entries. The parameter is ignored by maps for which an initialize size does not make sense.

Definition at line 396 of file Map_T.inl.

00398   : implementation_ (size,
00399                      alloc)
00400 {
00401 }

template<class KEY, class VALUE, class KEY_GENERATOR>
ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::~ACE_Map_Manager_Adapter void   )  [virtual]
 

Close down and release dynamically allocated resources.

Definition at line 1141 of file Map_T.cpp.

01142 {
01143 }

template<class KEY, class VALUE, class KEY_GENERATOR>
ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::ACE_Map_Manager_Adapter const ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR > &   )  [private]
 


Member Function Documentation

template<class KEY, class VALUE, class KEY_GENERATOR>
ACE_Iterator_Impl< ACE_Reference_Pair< const KEY, VALUE > > * ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::begin_impl void   )  [protected, virtual]
 

Return forward iterator.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1302 of file Map_T.cpp.

References ACE_NEW_RETURN.

01303 {
01304   ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0;
01305   ACE_NEW_RETURN (temp,
01306                   iterator_impl (this->implementation_.begin ()),
01307                   0);
01308   return temp;
01309 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::bind const KEY &  key,
const VALUE &  value
[virtual]
 

Add / pair to the map. If is already in the map then no changes are made and 1 is returned. Returns 0 on a successful addition. This function fails for maps that do not allow user specified keys. is an "in" parameter.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1160 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::bind().

01162 {
01163   return this->implementation_.bind (key,
01164                                      value);
01165 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::bind_create_key const VALUE &  value  )  [virtual]
 

Add to the map. The user does not care about the corresponding key produced by the Map. For maps that do not naturally produce keys, the map adapters will use the class to produce a key. However, the users are responsible for not jeopardizing this key production scheme by using user specified keys with keys produced by the key generator.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1200 of file Map_T.cpp.

References ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::bind_create_key().

01201 {
01202   KEY key;
01203   return this->bind_create_key (value,
01204                                 key);
01205 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::bind_create_key const VALUE &  value,
KEY &  key
[virtual]
 

Add to the map, and the corresponding key produced by the Map is returned through which is an "out" parameter. For maps that do not naturally produce keys, the map adapters will use the class to produce a key. However, the users are responsible for not jeopardizing this key production scheme by using user specified keys with keys produced by the key generator.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1183 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::bind(), and ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::key_generator_.

Referenced by ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::bind_create_key().

01185 {
01186   // Invoke the user specified key generation functor.
01187   int result = this->key_generator_ (key);
01188 
01189   if (result == 0)
01190     {
01191       // Try to add.
01192       result = this->implementation_.bind (key,
01193                                            value);
01194     }
01195 
01196   return result;
01197 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::bind_modify_key const VALUE &  value,
KEY &  key
[virtual]
 

Add / pair to the map. is an "inout" parameter and maybe modified/extended by the map to add additional information. To recover original key, call the method.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1168 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::bind().

01170 {
01171   return this->implementation_.bind (key,
01172                                      value);
01173 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::close void   )  [virtual]
 

Close down a and release dynamically allocated resources.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1154 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::close().

01155 {
01156   return this->implementation_.close ();
01157 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::create_key KEY &  key  )  [virtual]
 

Produce a key and return it through which is an "out" parameter. For maps that do not naturally produce keys, the map adapters will use the class to produce a key. However, the users are responsible for not jeopardizing this key production scheme by using user specified keys with keys produced by the key generator.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1176 of file Map_T.cpp.

References ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::key_generator_.

01177 {
01178   // Invoke the user specified key generation functor.
01179   return this->key_generator_ (key);
01180 }

template<class KEY, class VALUE, class KEY_GENERATOR>
size_t ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::current_size void   )  const [virtual]
 

Return the current size of the map.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1282 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::current_size().

01283 {
01284   return this->implementation_.current_size ();
01285 }

template<class KEY, class VALUE, class KEY_GENERATOR>
void ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::dump void   )  const [virtual]
 

Dump the state of an object.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1294 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::dump().

01295 {
01296 #if defined (ACE_HAS_DUMP)
01297   this->implementation_.dump ();
01298 #endif /* ACE_HAS_DUMP */
01299 }

template<class KEY, class VALUE, class KEY_GENERATOR>
ACE_Iterator_Impl< ACE_Reference_Pair< const KEY, VALUE > > * ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::end_impl void   )  [protected, virtual]
 

Implements ACE_Map< KEY, VALUE >.

Definition at line 1312 of file Map_T.cpp.

References ACE_NEW_RETURN.

01313 {
01314   ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0;
01315   ACE_NEW_RETURN (temp,
01316                   iterator_impl (this->implementation_.end ()),
01317                   0);
01318   return temp;
01319 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::find const KEY &  key  )  [virtual]
 

Is in the map?

Implements ACE_Map< KEY, VALUE >.

Definition at line 1262 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::find().

01263 {
01264   return this->implementation_.find (key);
01265 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::find const KEY &  key,
VALUE &  value
[virtual]
 

Locate associated with .

Implements ACE_Map< KEY, VALUE >.

Definition at line 1254 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::find().

01256 {
01257   return this->implementation_.find (key,
01258                                      value);
01259 }

template<class KEY, class VALUE, class KEY_GENERATOR>
ACE_INLINE ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex > & ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::impl void   ) 
 

Accessor to implementation object.

Definition at line 404 of file Map_T.inl.

00405 {
00406   return this->implementation_;
00407 }

template<class KEY, class VALUE, class KEY_GENERATOR>
ACE_INLINE KEY_GENERATOR & ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::key_generator void   ) 
 

Accessor to key generator.

Definition at line 410 of file Map_T.inl.

00411 {
00412   return this->key_generator_;
00413 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::open size_t  length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator alloc = 0
[virtual]
 

Initialize a with size .

Implements ACE_Map< KEY, VALUE >.

Definition at line 1146 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::open().

01148 {
01149   return this->implementation_.open (length,
01150                                      alloc);
01151 }

template<class KEY, class VALUE, class KEY_GENERATOR>
void ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::operator= const ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR > &   )  [private]
 

template<class KEY, class VALUE, class KEY_GENERATOR>
ACE_Reverse_Iterator_Impl< ACE_Reference_Pair< const KEY, VALUE > > * ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::rbegin_impl void   )  [protected, virtual]
 

Return reverse iterator.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1322 of file Map_T.cpp.

References ACE_NEW_RETURN.

01323 {
01324   ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0;
01325   ACE_NEW_RETURN (temp,
01326                   reverse_iterator_impl (this->implementation_.rbegin ()),
01327                   0);
01328   return temp;
01329 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::rebind const KEY &  key,
const VALUE &  value,
KEY &  old_key,
VALUE &  old_value
[virtual]
 

Reassociate with , storing the old key and value into the "out" parameters and . The function fails if is not in the map for maps that do not allow user specified keys. However, for maps that allow user specified keys, if the key is not in the map, a new / association is created.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1234 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::rebind().

01238 {
01239   return this->implementation_.rebind (key,
01240                                        value,
01241                                        old_key,
01242                                        old_value);
01243 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::rebind const KEY &  key,
const VALUE &  value,
VALUE &  old_value
[virtual]
 

Reassociate with , storing the old value into the "out" parameter . The function fails if is not in the map for maps that do not allow user specified keys. However, for maps that allow user specified keys, if the key is not in the map, a new / association is created.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1224 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::rebind().

01227 {
01228   return this->implementation_.rebind (key,
01229                                        value,
01230                                        old_value);
01231 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::rebind const KEY &  key,
const VALUE &  value
[virtual]
 

Reassociate with . The function fails if is not in the map for maps that do not allow user specified keys. However, for maps that allow user specified keys, if the key is not in the map, a new / association is created.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1216 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::rebind().

01218 {
01219   return this->implementation_.rebind (key,
01220                                        value);
01221 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::recover_key const KEY &  modified_key,
KEY &  original_key
[virtual]
 

Recovers the original key potentially modified by the map during .

Implements ACE_Map< KEY, VALUE >.

Definition at line 1208 of file Map_T.cpp.

01210 {
01211   original_key = modified_key;
01212   return 0;
01213 }

template<class KEY, class VALUE, class KEY_GENERATOR>
ACE_Reverse_Iterator_Impl< ACE_Reference_Pair< const KEY, VALUE > > * ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::rend_impl void   )  [protected, virtual]
 

Implements ACE_Map< KEY, VALUE >.

Definition at line 1332 of file Map_T.cpp.

References ACE_NEW_RETURN.

01333 {
01334   ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0;
01335   ACE_NEW_RETURN (temp,
01336                   reverse_iterator_impl (this->implementation_.rend ()),
01337                   0);
01338   return temp;
01339 }

template<class KEY, class VALUE, class KEY_GENERATOR>
size_t ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::total_size void   )  const [virtual]
 

Return the total size of the map.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1288 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::total_size().

01289 {
01290   return this->implementation_.total_size ();
01291 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::trybind const KEY &  key,
VALUE &  value
[virtual]
 

Associate with if and only if is not in the map. If is already in the map, then the parameter is overwritten with the existing value in the map. Returns 0 if a new / association is created. Returns 1 if an attempt is made to bind an existing entry. This function fails for maps that do not allow user specified keys.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1246 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::trybind().

01248 {
01249   return this->implementation_.trybind (key,
01250                                         value);
01251 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::unbind const KEY &  key,
VALUE &  value
[virtual]
 

Remove from the map, and return the associated with .

Implements ACE_Map< KEY, VALUE >.

Definition at line 1274 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::unbind().

01276 {
01277   return this->implementation_.unbind (key,
01278                                        value);
01279 }

template<class KEY, class VALUE, class KEY_GENERATOR>
int ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::unbind const KEY &  key  )  [virtual]
 

Remove from the map.

Implements ACE_Map< KEY, VALUE >.

Definition at line 1268 of file Map_T.cpp.

References ACE_Map_Manager< KEY, VALUE, ACE_Null_Mutex >::unbind().

01269 {
01270   return this->implementation_.unbind (key);
01271 }


Member Data Documentation

template<class KEY, class VALUE, class KEY_GENERATOR>
ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::implementation_ [protected]
 

All implementation details are forwarded to this class.

Definition at line 1574 of file Map_T.h.

template<class KEY, class VALUE, class KEY_GENERATOR>
KEY_GENERATOR ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::key_generator_ [protected]
 

Functor class used for generating key.

Definition at line 1577 of file Map_T.h.

Referenced by ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::bind_create_key(), and ACE_Map_Manager_Adapter< KEY, VALUE, KEY_GENERATOR >::create_key().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:24:31 2006 for ACE by doxygen 1.3.6