#include <Map_T.h>
Inheritance diagram for ACE_Active_Map_Manager_Adapter:


Public Types | |
| typedef ACE_Pair< KEY, VALUE > | expanded_value |
| typedef ACE_Active_Map_Manager_Iterator_Adapter< ACE_Reference_Pair< const KEY, VALUE >, expanded_value > | iterator_impl |
| typedef ACE_Active_Map_Manager_Reverse_Iterator_Adapter< ACE_Reference_Pair< const KEY, VALUE >, expanded_value > | reverse_iterator_impl |
| typedef ACE_Active_Map_Manager< expanded_value > | implementation |
Public Methods | |
| ACE_Active_Map_Manager_Adapter (ACE_Allocator *alloc=0) | |
| Initialize with the <ACE_DEFAULT_MAP_SIZE>. More... | |
| ACE_Active_Map_Manager_Adapter (size_t size, ACE_Allocator *alloc=0) | |
| Initialize with <size> entries. The <size> parameter is ignored by maps for which an initialize size does not make sense. More... | |
| virtual | ~ACE_Active_Map_Manager_Adapter (void) |
| Close down and release dynamically allocated resources. More... | |
| virtual int | open (size_t length=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc=0) |
| Initialize a <Map> with size <length>. More... | |
| virtual int | close (void) |
| Close down a <Map> and release dynamically allocated resources. More... | |
| 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) |
| Recovers the original key potentially modified by the map during <bind_modify_key>. More... | |
| 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 <value> associated with <key>. More... | |
| virtual int | find (const KEY &key) |
| Is <key> in the map? More... | |
| virtual int | unbind (const KEY &key) |
| Remove <key> from the map. More... | |
| virtual int | unbind (const KEY &key, VALUE &value) |
| Remove <key> from the map, and return the <value> associated with <key>. More... | |
| virtual size_t | current_size (void) const |
| Return the current size of the map. More... | |
| virtual size_t | total_size (void) const |
| Return the total size of the map. More... | |
| virtual void | dump (void) const |
| Dump the state of an object. More... | |
| ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > > & | impl (void) |
| Accessor to implementation object. More... | |
| KEY_ADAPTER & | key_adapter (void) |
| Accessor to key adapter. More... | |
Protected Methods | |
| virtual int | find (const KEY &key, expanded_value *&internal_value) |
| Find helper. More... | |
| virtual int | unbind (const KEY &key, expanded_value *&internal_value) |
| Unbind helper. More... | |
| virtual ACE_Iterator_Impl< ACE_Reference_Pair< const KEY, VALUE > > * | begin_impl (void) |
| Return forward iterator. More... | |
| 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. More... | |
| virtual ACE_Reverse_Iterator_Impl< ACE_Reference_Pair< const KEY, VALUE > > * | rend_impl (void) |
Protected Attributes | |
| ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > > | implementation_ |
| All implementation details are forwarded to this class. More... | |
| KEY_ADAPTER | key_adapter_ |
| Adapts between the user key and the Active_Map_Manager_Key. More... | |
Private Methods | |
| void | operator= (const ACE_Active_Map_Manager_Adapter< KEY, VALUE, KEY_ADAPTER > &) |
| ACE_Active_Map_Manager_Adapter (const ACE_Active_Map_Manager_Adapter< KEY, VALUE, KEY_ADAPTER > &) | |
Implementation to be provided by <ACE_Active_Map_Manager>.
Definition at line 820 of file Map_T.h.
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
||||||||||
|
Initialize with the <ACE_DEFAULT_MAP_SIZE>.
Definition at line 670 of file Map_T.i.
00671 : implementation_ (alloc) 00672 { 00673 } |
|
||||||||||||||||
|
Initialize with <size> entries. The <size> parameter is ignored by maps for which an initialize size does not make sense.
Definition at line 676 of file Map_T.i.
00678 : implementation_ (size, 00679 alloc) 00680 { 00681 } |
|
||||||||||
|
Close down and release dynamically allocated resources.
Definition at line 684 of file Map_T.i.
00685 {
00686 }
|
|
||||||||||
|
|
|
||||||||||
|
Return forward iterator.
Implements ACE_Map. Definition at line 992 of file Map_T.i. References ACE_NEW_RETURN.
00993 {
00994 ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0;
00995 ACE_NEW_RETURN (temp,
00996 iterator_impl (this->implementation_.begin ()),
00997 0);
00998 return temp;
00999 }
|
|
||||||||||||||||
|
Add <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. Implements ACE_Map. Definition at line 703 of file Map_T.i.
00705 {
00706 ACE_NOTSUP_RETURN (-1);
00707 }
|
|
||||||||||
|
Add <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. Implements ACE_Map. Definition at line 781 of file Map_T.i. References ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::bind, ACE_Pair< KEY, VALUE >::first, implementation_, key_adapter_, ACE_Pair< KEY, VALUE >::second, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::unbind.
00782 {
00783 // Reserve a slot and create an active key.
00784 expanded_value *internal_value = 0;
00785 ACE_Active_Map_Manager_Key active_key;
00786 int result = this->implementation_.bind (active_key,
00787 internal_value);
00788 if (result == 0)
00789 {
00790 // Encode the active key into key part of <expanded_value>.
00791 result = this->key_adapter_.encode (internal_value->first (),
00792 active_key,
00793 internal_value->first ());
00794 if (result == 0)
00795 {
00796 // Copy user value into <expanded_value>.
00797 internal_value->second (value);
00798 }
00799 else
00800 {
00801 // In case of errors, unbind from map.
00802 this->implementation_.unbind (active_key);
00803 }
00804 }
00805
00806 return result;
00807 }
|
|
||||||||||||||||
|
Add <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. Implements ACE_Map. Definition at line 749 of file Map_T.i. References ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::bind, ACE_Pair< KEY, VALUE >::first, implementation_, key_adapter_, ACE_Pair< KEY, VALUE >::second, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::unbind.
00751 {
00752 // Reserve a slot and create an active key.
00753 expanded_value *internal_value = 0;
00754 ACE_Active_Map_Manager_Key active_key;
00755 int result = this->implementation_.bind (active_key,
00756 internal_value);
00757 if (result == 0)
00758 {
00759 // Encode the active key into key part of <expanded_value>.
00760 result = this->key_adapter_.encode (internal_value->first (),
00761 active_key,
00762 internal_value->first ());
00763 if (result == 0)
00764 {
00765 // Copy user value into <expanded_value>.
00766 internal_value->second (value);
00767 // Copy new, modified key to the user key.
00768 key = internal_value->first ();
00769 }
00770 else
00771 {
00772 // In case of errors, unbind from map.
00773 this->implementation_.unbind (active_key);
00774 }
00775 }
00776
00777 return result;
00778 }
|
|
||||||||||||||||
|
Add <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. Implements ACE_Map. Definition at line 710 of file Map_T.i. References ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::bind, ACE_Pair< KEY, VALUE >::first, implementation_, key_adapter_, ACE_Pair< KEY, VALUE >::second, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::unbind.
00712 {
00713 // Reserve a slot and create an active key.
00714 expanded_value *internal_value = 0;
00715 ACE_Active_Map_Manager_Key active_key;
00716 int result = this->implementation_.bind (active_key,
00717 internal_value);
00718 if (result == 0)
00719 {
00720 // Encode the active key and the existing user key into key part
00721 // of <expanded_value>.
00722 result = this->key_adapter_.encode (key,
00723 active_key,
00724 internal_value->first ());
00725 if (result == 0)
00726 {
00727 // Copy user value into <expanded_value>.
00728 internal_value->second (value);
00729 // Copy new, modified key back to the user key.
00730 key = internal_value->first ();
00731 }
00732 else
00733 {
00734 // In case of errors, unbind from map.
00735 this->implementation_.unbind (active_key);
00736 }
00737 }
00738
00739 return result;
00740 }
|
|
||||||||||
|
Close down a <Map> and release dynamically allocated resources.
Implements ACE_Map. Definition at line 697 of file Map_T.i. References ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::close, and implementation_.
00698 {
00699 return this->implementation_.close ();
00700 }
|
|
||||||||||
|
Produce a key and return it 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. Implements ACE_Map. Definition at line 743 of file Map_T.i.
00744 {
00745 ACE_NOTSUP_RETURN (-1);
00746 }
|
|
||||||||||
|
Return the current size of the map.
Implements ACE_Map. Definition at line 974 of file Map_T.i. References ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::current_size, and implementation_.
00975 {
00976 return this->implementation_.current_size ();
00977 }
|
|
||||||||||
|
Dump the state of an object.
Implements ACE_Map. Definition at line 986 of file Map_T.i. References ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::dump, and implementation_.
00987 {
00988 this->implementation_.dump ();
00989 }
|
|
||||||||||
|
Implements ACE_Map. Definition at line 1002 of file Map_T.i. References ACE_NEW_RETURN.
01003 {
01004 ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0;
01005 ACE_NEW_RETURN (temp,
01006 iterator_impl (this->implementation_.end ()),
01007 0);
01008 return temp;
01009 }
|
|
||||||||||||||||
|
Find helper.
Definition at line 820 of file Map_T.i. References ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::find, implementation_, and key_adapter_.
00822 {
00823 // Ask the <key_adapter_> to recover the active key.
00824 ACE_Active_Map_Manager_Key active_key;
00825 int result = this->key_adapter_.decode (key,
00826 active_key);
00827 if (result == 0)
00828 {
00829 // Find recovered active key in map.
00830 result = this->implementation_.find (active_key,
00831 internal_value);
00832 }
00833
00834 return result;
00835 }
|
|
||||||||||
|
Is <key> in the map?
Implements ACE_Map. Definition at line 855 of file Map_T.i. References find.
00856 {
00857 expanded_value *internal_value = 0;
00858 return this->find (key,
00859 internal_value);
00860 }
|
|
||||||||||||||||
|
Locate <value> associated with <key>.
Implements ACE_Map. Definition at line 838 of file Map_T.i. References ACE_Pair< KEY, VALUE >::second. Referenced by find, and rebind.
00840 {
00841 expanded_value *internal_value = 0;
00842 int result = this->find (key,
00843 internal_value);
00844
00845 if (result == 0)
00846 {
00847 // Copy value.
00848 value = internal_value->second ();
00849 }
00850
00851 return result;
00852 }
|
|
||||||||||
|
Accessor to implementation object.
Definition at line 1032 of file Map_T.i. References implementation_.
01033 {
01034 return this->implementation_;
01035 }
|
|
||||||||||
|
Accessor to key adapter.
Definition at line 1038 of file Map_T.i. References key_adapter_.
01039 {
01040 return this->key_adapter_;
01041 }
|
|
||||||||||||||||
|
Initialize a <Map> with size <length>.
Implements ACE_Map. Definition at line 689 of file Map_T.i. References implementation_, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::open.
00691 {
00692 return this->implementation_.open (length,
00693 alloc);
00694 }
|
|
||||||||||
|
|
|
||||||||||
|
Return reverse iterator.
Implements ACE_Map. Definition at line 1012 of file Map_T.i. References ACE_NEW_RETURN.
01013 {
01014 ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0;
01015 ACE_NEW_RETURN (temp,
01016 reverse_iterator_impl (this->implementation_.rbegin ()),
01017 0);
01018 return temp;
01019 }
|
|
||||||||||||||||||||||||
|
Reassociate <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. Implements ACE_Map. Definition at line 901 of file Map_T.i. References find, ACE_Pair< KEY, VALUE >::first, and ACE_Pair< KEY, VALUE >::second.
00905 {
00906 expanded_value *internal_value = 0;
00907 int result = this->find (key,
00908 internal_value);
00909
00910 if (result == 0)
00911 {
00912 // Copy old key and value.
00913 old_key = internal_value->first ();
00914 old_value = internal_value->second ();
00915
00916 // Reset to new value.
00917 internal_value->second (value);
00918 }
00919
00920 return result;
00921 }
|
|
||||||||||||||||||||
|
Reassociate <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. Implements ACE_Map. Definition at line 880 of file Map_T.i. References find, and ACE_Pair< KEY, VALUE >::second.
00883 {
00884 expanded_value *internal_value = 0;
00885 int result = this->find (key,
00886 internal_value);
00887
00888 if (result == 0)
00889 {
00890 // Copy old value.
00891 old_value = internal_value->second ();
00892
00893 // Reset to new value.
00894 internal_value->second (value);
00895 }
00896
00897 return result;
00898 }
|
|
||||||||||||||||
|
Reassociate <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. Implements ACE_Map. Definition at line 863 of file Map_T.i. References find, and ACE_Pair< KEY, VALUE >::second.
00865 {
00866 expanded_value *internal_value = 0;
00867 int result = this->find (key,
00868 internal_value);
00869
00870 if (result == 0)
00871 {
00872 // Reset value.
00873 internal_value->second (value);
00874 }
00875
00876 return result;
00877 }
|
|
||||||||||||||||
|
Recovers the original key potentially modified by the map during <bind_modify_key>.
Implements ACE_Map. Definition at line 810 of file Map_T.i. References key_adapter_.
00812 {
00813 // Ask the <key_adapter_> to help out with recovering the original
00814 // user key, since it was the one that encode it in the first place.
00815 return this->key_adapter_.decode (modified_key,
00816 original_key);
00817 }
|
|
||||||||||
|
Implements ACE_Map. Definition at line 1022 of file Map_T.i. References ACE_NEW_RETURN.
01023 {
01024 ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *temp = 0;
01025 ACE_NEW_RETURN (temp,
01026 reverse_iterator_impl (this->implementation_.rend ()),
01027 0);
01028 return temp;
01029 }
|
|
||||||||||
|
Return the total size of the map.
Implements ACE_Map. Definition at line 980 of file Map_T.i. References implementation_, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::total_size.
00981 {
00982 return this->implementation_.total_size ();
00983 }
|
|
||||||||||||||||
|
Associate <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. Implements ACE_Map. Definition at line 924 of file Map_T.i.
00926 {
00927 ACE_NOTSUP_RETURN (-1);
00928 }
|
|
||||||||||||||||
|
Unbind helper.
Definition at line 931 of file Map_T.i. References implementation_, key_adapter_, and ACE_Active_Map_Manager< ACE_Pair< KEY, VALUE > >::unbind.
00933 {
00934 // Ask the <key_adapter_> to recover the active key.
00935 ACE_Active_Map_Manager_Key active_key;
00936 int result = this->key_adapter_.decode (key,
00937 active_key);
00938 if (result == 0)
00939 {
00940 // Unbind recovered active key from map.
00941 result = this->implementation_.unbind (active_key,
00942 internal_value);
00943 }
00944
00945 return result;
00946 }
|
|
||||||||||||||||
|
Remove <key> from the map, and return the <value> associated with <key>.
Implements ACE_Map. Definition at line 957 of file Map_T.i. References ACE_Pair< KEY, VALUE >::second, and unbind.
00959 {
00960 expanded_value *internal_value = 0;
00961 int result = this->unbind (key,
00962 internal_value);
00963
00964 if (result == 0)
00965 {
00966 // Copy value.
00967 value = internal_value->second ();
00968 }
00969
00970 return result;
00971 }
|
|
||||||||||
|
Remove <key> from the map.
Implements ACE_Map. Definition at line 949 of file Map_T.i. Referenced by unbind.
00950 {
00951 expanded_value *internal_value = 0;
00952 return this->unbind (key,
00953 internal_value);
00954 }
|
|
|||||
|
All implementation details are forwarded to this class.
Definition at line 994 of file Map_T.h. Referenced by bind_create_key, bind_modify_key, close, current_size, dump, find, impl, open, total_size, and unbind. |
|
|||||
|
Adapts between the user key and the Active_Map_Manager_Key.
Definition at line 997 of file Map_T.h. Referenced by bind_create_key, bind_modify_key, find, key_adapter, recover_key, and unbind. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002