#include <ace/Map_T.h>
template<class KEY, class VALUE, class KEY_GENERATOR> class ACE_Map_Manager_Adapter : public ACE_Map<KEY, VALUE> {
public:
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;ACE_Map_Manager_Adapter (ACE_Allocator *alloc = 0);
ACE_Map_Manager_Adapter (size_t size, ACE_Allocator *alloc = 0);
virtual ~ACE_Map_Manager_Adapter (void);
virtual int open ( size_t length = ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc = 0 );
virtual int close (void);
virtual int bind (const KEY &key, const VALUE &value);
virtual int bind_modify_key (const VALUE &value, 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);
virtual int find (const KEY &key);
virtual int unbind (const KEY &key);
virtual int unbind (const KEY &key, VALUE &value);
virtual size_t current_size (void) const;
virtual size_t total_size (void) const;
virtual void dump (void) const;
ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> &impl (void);
KEY_GENERATOR &key_generator (void);
protected:
ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> implementation_;
KEY_GENERATOR key_generator_;
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl ( void );
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 );
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl ( void );
private:
inline ACE_UNIMPLEMENTED_FUNC ( void operator= (const ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR> &) );
};
ACE_Map_Manager
.
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;
ACE_Map_Manager_Adapter (ACE_Allocator *alloc = 0);
ACE_DEFAULT_MAP_SIZE
.
ACE_Map_Manager_Adapter (size_t size, ACE_Allocator *alloc = 0);
size
entries. The size
parameter is ignore
by maps for which an initialize size does not make sense.
virtual ~ACE_Map_Manager_Adapter (void);
virtual int open (
size_t length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0
);
Map
with size length
.
virtual int close (void);
Map
and release dynamically allocated resources.
virtual int bind (const KEY &key, const VALUE &value);
key
/value
pair to the map. If key
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. key
is an "in" parameter.
virtual int bind_modify_key (const VALUE &value, KEY &key);
key
/value
pair to the map. key
is an "inout" parameter
and maybe modified/extended by the map to add additional
information. To recover original key, call the recover_key
method.
virtual int bind_create_key (const VALUE &value, KEY &key);
value
to the map, and the corresponding key produced by the
Map is returned through key
which is an "out" parameter. For
maps that do not naturally produce keys, the map adapters will
use the KEY_GENERATOR
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.
virtual int bind_create_key (const VALUE &value);
value
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
KEY_GENERATOR
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.
virtual int recover_key (const KEY &modified_key, KEY &original_key);
bind_modify_key
.
virtual int rebind (const KEY &key, const VALUE &value);
key
with value
. The function fails if key
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 key
/value
association is created.
virtual int rebind (
const KEY &key,
const VALUE &value,
VALUE &old_value
);
key
with value
, storing the old value into the
"out" parameter old_value
. The function fails if key
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 key
/value
association is created.
virtual int rebind (
const KEY &key,
const VALUE &value,
KEY &old_key,
VALUE &old_value
);
key
with value
, storing the old key and value
into the "out" parameters old_key
and old_value
. The
function fails if key
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 key
/value
association is created.
virtual int trybind (const KEY &key, VALUE &value);
key
with value
if and only if key
is not in the
map. If key
is already in the map, then the value
parameter
is overwritten with the existing value in the map. Returns 0 if a
new key
/value
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.
virtual int find (const KEY &key, VALUE &value);
value
associated with key
.
virtual int find (const KEY &key);
key
in the map?
virtual int unbind (const KEY &key);
key
from the map.
virtual int unbind (const KEY &key, VALUE &value);
key
from the map, and return the value
associated with
key
.
virtual size_t current_size (void) const;
virtual size_t total_size (void) const;
virtual void dump (void) const;
ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> &impl (void);
KEY_GENERATOR &key_generator (void);
virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl (
void
);
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
);
virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl (
void
);
inline ACE_UNIMPLEMENTED_FUNC (
void operator= (const ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR> &)
);
irfan@cs.wustl.edu