Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Map_T.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Map_T.h
00006  *
00007  *  $Id: Map_T.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Irfan Pyarali <irfan@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_MAP_T_H
00014 #define ACE_MAP_T_H
00015 #include "ace/pre.h"
00016 
00017 #include "ace/Pair_T.h"
00018 #include "ace/Map_Manager.h"
00019 #include "ace/Hash_Map_Manager.h"
00020 #include "ace/Active_Map_Manager.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 /**
00027  * @class ACE_Noop_Key_Generator
00028  *
00029  * @brief Defines a noop key generator.
00030  */
00031 template <class T>
00032 class ACE_Noop_Key_Generator
00033 {
00034 public:
00035 
00036   /// Functor method: generates a new key.
00037   int operator () (T &);
00038 };
00039 
00040 /**
00041  * @class ACE_Incremental_Key_Generator
00042  *
00043  * @brief Defines a simple incremental key generator.
00044  *
00045  * Generates a new key of type T by incrementing current
00046  * value. Requirements on T are:
00047  * - Constructor that accepts 0 in the constructor.
00048  * - Prefix increment.
00049  * - Assignment.
00050  * Note that a primitive types such as u_long, int, etc., are
00051  * suitable for this class.
00052  */
00053 template <class T>
00054 class ACE_Incremental_Key_Generator
00055 {
00056 public:
00057 
00058   /// Constructor.
00059   ACE_Incremental_Key_Generator (void);
00060 
00061   /// Functor method: generates a new key.
00062   int operator () (T &t);
00063 
00064   /// Returns the current value.
00065   const T& current_value (void) const;
00066 
00067 protected:
00068 
00069   /// Current value.
00070   T t_;
00071 };
00072 
00073 /**
00074  * @class ACE_Iterator_Impl
00075  *
00076  * @brief Defines a abstract iterator.
00077  *
00078  * Implementation to be provided by subclasses.
00079  */
00080 template <class T>
00081 class ACE_Iterator_Impl
00082 {
00083 public:
00084 
00085   /// Destructor.
00086   virtual ~ACE_Iterator_Impl (void);
00087 
00088   /// Clone.
00089   virtual ACE_Iterator_Impl<T> *clone (void) const = 0;
00090 
00091   /// Comparison.
00092   virtual int compare (const ACE_Iterator_Impl<T> &rhs) const = 0;
00093 
00094   /// Dereference.
00095   virtual T dereference (void) const = 0;
00096 
00097   /// Advance.
00098   virtual void plus_plus (void) = 0;
00099 
00100   /// Reverse.
00101   virtual void minus_minus (void) = 0;
00102 };
00103 
00104 /**
00105  * @class ACE_Reverse_Iterator_Impl
00106  *
00107  * @brief Defines a abstract reverse iterator.
00108  *
00109  * Implementation to be provided by subclasses.
00110  */
00111 template <class T>
00112 class ACE_Reverse_Iterator_Impl
00113 {
00114 public:
00115 
00116   /// Destructor.
00117   virtual ~ACE_Reverse_Iterator_Impl (void);
00118 
00119   /// Clone.
00120   virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const = 0;
00121 
00122   /// Comparison.
00123   virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const = 0;
00124 
00125   /// Dereference.
00126   virtual T dereference (void) const = 0;
00127 
00128   /// Advance.
00129   virtual void plus_plus (void) = 0;
00130 
00131   /// Reverse.
00132   virtual void minus_minus (void) = 0;
00133 };
00134 
00135 /**
00136  * @class ACE_Iterator
00137  *
00138  * @brief Defines the iterator interface.
00139  *
00140  * Implementation to be provided by forwarding.
00141  */
00142 template <class T>
00143 class ACE_Iterator
00144 {
00145 public:
00146 
00147   // = Traits.
00148   typedef T value_type;
00149   typedef ACE_Iterator_Impl<T> implementation;
00150 
00151   /// Constructor.
00152   ACE_Iterator (ACE_Iterator_Impl<T> *impl);
00153 
00154   /// Copy constructor.
00155   ACE_Iterator (const ACE_Iterator<T> &rhs);
00156 
00157   /// Destructor.
00158   ~ACE_Iterator (void);
00159 
00160   /// Assignment operator.
00161   ACE_Iterator<T> &operator= (const ACE_Iterator<T> &rhs);
00162 
00163   /// Comparison operators.
00164   int operator== (const ACE_Iterator<T> &rhs) const;
00165   int operator!= (const ACE_Iterator<T> &rhs) const;
00166 
00167   /// Dereference operator.
00168   T operator *() const;
00169 
00170   /// Prefix advance.
00171   ACE_Iterator<T> &operator++ (void);
00172 
00173   /// Postfix advance.
00174   ACE_Iterator<T> operator++ (int);
00175 
00176   /// Prefix reverse.
00177   ACE_Iterator<T> &operator-- (void);
00178 
00179   /// Postfix reverse.
00180   ACE_Iterator<T> operator-- (int);
00181 
00182   /// Accessor to implementation object.
00183   ACE_Iterator_Impl<T> &impl (void);
00184 
00185 protected:
00186 
00187   /// Implementation pointer.
00188   ACE_Iterator_Impl<T> *implementation_;
00189 };
00190 
00191 /**
00192  * @class ACE_Reverse_Iterator
00193  *
00194  * @brief Defines the reverse iterator interface.
00195  *
00196  * Implementation to be provided by forwarding.
00197  */
00198 template <class T>
00199 class ACE_Reverse_Iterator
00200 {
00201 public:
00202 
00203   // = Traits.
00204   typedef T value_type;
00205   typedef ACE_Reverse_Iterator_Impl<T> implementation;
00206 
00207   /// Constructor.
00208   ACE_Reverse_Iterator (ACE_Reverse_Iterator_Impl<T> *impl);
00209 
00210   /// Copy constructor.
00211   ACE_Reverse_Iterator (const ACE_Reverse_Iterator<T> &rhs);
00212 
00213   /// Destructor.
00214   ~ACE_Reverse_Iterator (void);
00215 
00216   /// Assignment operator.
00217   ACE_Reverse_Iterator<T> &operator= (const ACE_Reverse_Iterator<T> &rhs);
00218 
00219   /// Comparison operators.
00220   int operator== (const ACE_Reverse_Iterator<T> &rhs) const;
00221   int operator!= (const ACE_Reverse_Iterator<T> &rhs) const;
00222 
00223   /// Dereference operator.
00224   T operator *() const;
00225 
00226   /// Prefix advance.
00227   ACE_Reverse_Iterator<T> &operator++ (void);
00228 
00229   /// Postfix advance.
00230   ACE_Reverse_Iterator<T> operator++ (int);
00231 
00232   /// Prefix reverse.
00233   ACE_Reverse_Iterator<T> &operator-- (void);
00234 
00235   /// Postfix reverse.
00236   ACE_Reverse_Iterator<T> operator-- (int);
00237 
00238   /// Accessor to implementation object.
00239   ACE_Reverse_Iterator_Impl<T> &impl (void);
00240 
00241 protected:
00242 
00243   /// Implementation pointer.
00244   ACE_Reverse_Iterator_Impl<T> *implementation_;
00245 };
00246 
00247 /**
00248  * @class ACE_Map
00249  *
00250  * @brief Defines a map interface.
00251  *
00252  * Implementation to be provided by subclasses.
00253  */
00254 template <class KEY, class VALUE>
00255 class ACE_Map
00256 {
00257 public:
00258 
00259   // = Traits.
00260   typedef KEY
00261           key_type;
00262   typedef VALUE
00263           mapped_type;
00264   typedef ACE_Reference_Pair<const KEY, VALUE>
00265           value_type;
00266   typedef ACE_Iterator<value_type>
00267           iterator;
00268   typedef ACE_Reverse_Iterator<value_type>
00269           reverse_iterator;
00270   typedef ACE_Iterator_Impl<value_type>
00271           iterator_implementation;
00272   typedef ACE_Reverse_Iterator_Impl<value_type>
00273           reverse_iterator_implementation;
00274 
00275   /// Close down and release dynamically allocated resources.
00276   virtual ~ACE_Map (void);
00277 
00278   /// Initialize a <Map> with size <length>.
00279   virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE,
00280                     ACE_Allocator *alloc = 0) = 0;
00281 
00282   /// Close down a <Map> and release dynamically allocated resources.
00283   virtual int close (void) = 0;
00284 
00285   /**
00286    * Add <key>/<value> pair to the map.  If <key> is already in the
00287    * map then no changes are made and 1 is returned.  Returns 0 on a
00288    * successful addition.  This function fails for maps that do not
00289    * allow user specified keys. <key> is an "in" parameter.
00290    */
00291   virtual int bind (const KEY &key,
00292                     const VALUE &value) = 0;
00293 
00294   /**
00295    * Add <key>/<value> pair to the map.  <key> is an "inout" parameter
00296    * and maybe modified/extended by the map to add additional
00297    * information.  To recover original key, call the <recover_key>
00298    * method.
00299    */
00300   virtual int bind_modify_key (const VALUE &value,
00301                                KEY &key) = 0;
00302 
00303   /**
00304    * Produce a key and return it through <key> which is an "out"
00305    * parameter.  For maps that do not naturally produce keys, the map
00306    * adapters will use the <KEY_GENERATOR> class to produce a key.
00307    * However, the users are responsible for not jeopardizing this key
00308    * production scheme by using user specified keys with keys produced
00309    * by the key generator.
00310    */
00311   virtual int create_key (KEY &key) = 0;
00312 
00313   /**
00314    * Add <value> to the map, and the corresponding key produced by the
00315    * Map is returned through <key> which is an "out" parameter.  For
00316    * maps that do not naturally produce keys, the map adapters will
00317    * use the <KEY_GENERATOR> class to produce a key.  However, the
00318    * users are responsible for not jeopardizing this key production
00319    * scheme by using user specified keys with keys produced by the key
00320    * generator.
00321    */
00322   virtual int bind_create_key (const VALUE &value,
00323                                KEY &key) = 0;
00324 
00325   /**
00326    * Add <value> to the map.  The user does not care about the
00327    * corresponding key produced by the Map. For maps that do not
00328    * naturally produce keys, the map adapters will use the
00329    * <KEY_GENERATOR> class to produce a key.  However, the users are
00330    * responsible for not jeopardizing this key production scheme by
00331    * using user specified keys with keys produced by the key
00332    * generator.
00333    */
00334   virtual int bind_create_key (const VALUE &value) = 0;
00335 
00336   /// Recovers the original key potentially modified by the map during
00337   /// <bind_modify_key>.
00338   virtual int recover_key (const KEY &modified_key,
00339                            KEY &original_key) = 0;
00340 
00341   /**
00342    * Reassociate <key> with <value>. The function fails if <key> is
00343    * not in the map for maps that do not allow user specified keys.
00344    * However, for maps that allow user specified keys, if the key is
00345    * not in the map, a new <key>/<value> association is created.
00346    */
00347   virtual int rebind (const KEY &key,
00348                       const VALUE &value) = 0;
00349 
00350   /**
00351    * Reassociate <key> with <value>, storing the old value into the
00352    * "out" parameter <old_value>.  The function fails if <key> is not
00353    * in the map for maps that do not allow user specified keys.
00354    * However, for maps that allow user specified keys, if the key is
00355    * not in the map, a new <key>/<value> association is created.
00356    */
00357   virtual int rebind (const KEY &key,
00358                       const VALUE &value,
00359                       VALUE &old_value) = 0;
00360 
00361   /**
00362    * Reassociate <key> with <value>, storing the old key and value
00363    * into the "out" parameters <old_key> and <old_value>.  The
00364    * function fails if <key> is not in the map for maps that do not
00365    * allow user specified keys.  However, for maps that allow user
00366    * specified keys, if the key is not in the map, a new <key>/<value>
00367    * association is created.
00368    */
00369   virtual int rebind (const KEY &key,
00370                       const VALUE &value,
00371                       KEY &old_key,
00372                       VALUE &old_value) = 0;
00373 
00374   /**
00375    * Associate <key> with <value> if and only if <key> is not in the
00376    * map.  If <key> is already in the map, then the <value> parameter
00377    * is overwritten with the existing value in the map. Returns 0 if a
00378    * new <key>/<value> association is created.  Returns 1 if an
00379    * attempt is made to bind an existing entry.  This function fails
00380    * for maps that do not allow user specified keys.
00381    */
00382   virtual int trybind (const KEY &key,
00383                        VALUE &value) = 0;
00384 
00385   /// Locate <value> associated with <key>.
00386   virtual int find (const KEY &key,
00387                     VALUE &value) = 0;
00388 
00389   /// Is <key> in the map?
00390   virtual int find (const KEY &key) = 0;
00391 
00392   /// Remove <key> from the map.
00393   virtual int unbind (const KEY &key) = 0;
00394 
00395   /// Remove <key> from the map, and return the <value> associated with
00396   /// <key>.
00397   virtual int unbind (const KEY &key,
00398                       VALUE &value) = 0;
00399 
00400   /// Return the current size of the map.
00401   virtual size_t current_size (void) const = 0;
00402 
00403   /// Return the total size of the map.
00404   virtual size_t total_size (void) const = 0;
00405 
00406   /// Dump the state of an object.
00407   virtual void dump (void) const = 0;
00408 
00409   // = STL styled iterator factory functions.
00410 
00411   /// Return forward iterator.
00412   iterator begin (void);
00413   iterator end (void);
00414 
00415   /// Return reverse iterator.
00416   reverse_iterator rbegin (void);
00417   reverse_iterator rend (void);
00418 
00419 protected:
00420 
00421   // = Protected no-op constructor.
00422   ACE_Map (void);
00423 
00424   /// Return forward iterator.
00425   virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl (void) = 0;
00426   virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *end_impl (void) = 0;
00427 
00428   /// Return reverse iterator.
00429   virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rbegin_impl (void) = 0;
00430   virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl (void) = 0;
00431 
00432 private:
00433 
00434   // = Disallow these operations.
00435   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Map<KEY, VALUE> &))
00436   ACE_UNIMPLEMENTED_FUNC (ACE_Map (const ACE_Map<KEY, VALUE> &))
00437 };
00438 
00439 /**
00440  * @class ACE_Map_Impl_Iterator_Adapter
00441  *
00442  * @brief Defines a iterator implementation for the Map_Impl class.
00443  *
00444  * Implementation to be provided by <IMPLEMENTATION>.
00445  */
00446 template <class T, class IMPLEMENTATION, class ENTRY>
00447 class ACE_Map_Impl_Iterator_Adapter : public ACE_Iterator_Impl<T>
00448 {
00449 public:
00450 
00451   // = Traits.
00452   typedef IMPLEMENTATION
00453           implementation;
00454 
00455   /// Constructor.
00456   ACE_Map_Impl_Iterator_Adapter (const IMPLEMENTATION &impl);
00457 
00458   /// Destructor.
00459   virtual ~ACE_Map_Impl_Iterator_Adapter (void);
00460 
00461   /// Clone.
00462   virtual ACE_Iterator_Impl<T> *clone (void) const;
00463 
00464   /// Comparison.
00465   virtual int compare (const ACE_Iterator_Impl<T> &rhs) const;
00466 
00467   /// Dereference.
00468   virtual T dereference (void) const;
00469 
00470   /// Advance.
00471   virtual void plus_plus (void);
00472 
00473   /// Reverse.
00474   virtual void minus_minus (void);
00475 
00476   /// Accessor to implementation object.
00477   IMPLEMENTATION &impl (void);
00478 
00479 protected:
00480 
00481   /// All implementation details are forwarded to this class.
00482   IMPLEMENTATION implementation_;
00483 };
00484 
00485 /**
00486  * @class ACE_Map_Impl_Reverse_Iterator_Adapter
00487  *
00488  * @brief Defines a reverse iterator implementation for the Map_Impl class.
00489  *
00490  * Implementation to be provided by IMPLEMENTATION.
00491  */
00492 template <class T, class IMPLEMENTATION, class ENTRY>
00493 class ACE_Map_Impl_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T>
00494 {
00495 public:
00496 
00497   // = Traits.
00498   typedef IMPLEMENTATION
00499           implementation;
00500 
00501   /// Constructor.
00502   ACE_Map_Impl_Reverse_Iterator_Adapter (const IMPLEMENTATION &impl);
00503 
00504   /// Destructor.
00505   virtual ~ACE_Map_Impl_Reverse_Iterator_Adapter (void);
00506 
00507   /// Clone.
00508   virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const;
00509 
00510   /// Comparison.
00511   virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const;
00512 
00513   /// Dereference.
00514   virtual T dereference (void) const;
00515 
00516   /// Advance.
00517   virtual void plus_plus (void);
00518 
00519   /// Reverse.
00520   virtual void minus_minus (void);
00521 
00522   /// Accessor to implementation object.
00523   IMPLEMENTATION &impl (void);
00524 
00525 protected:
00526 
00527   /// All implementation details are forwarded to this class.
00528   IMPLEMENTATION implementation_;
00529 };
00530 
00531 /**
00532  * @class ACE_Map_Impl
00533  *
00534  * @brief Defines a map implementation.
00535  *
00536  * Implementation to be provided by <IMPLEMENTATION>.
00537  */
00538 template <class KEY, class VALUE, class IMPLEMENTATION, class ITERATOR, class REVERSE_ITERATOR, class ENTRY>
00539 class ACE_Map_Impl : public ACE_Map<KEY, VALUE>
00540 {
00541 public:
00542 
00543   // = Traits.
00544   typedef ACE_Map_Impl_Iterator_Adapter<ACE_TYPENAME ACE_Map<KEY, VALUE>::value_type, ITERATOR, ENTRY>
00545           iterator_impl;
00546   typedef ACE_Map_Impl_Reverse_Iterator_Adapter<ACE_TYPENAME ACE_Map<KEY, VALUE>::value_type, REVERSE_ITERATOR, ENTRY>
00547           reverse_iterator_impl;
00548 
00549   typedef IMPLEMENTATION
00550           implementation;
00551 
00552   // = Initialization and termination methods.
00553   /// Initialize with the <ACE_DEFAULT_MAP_SIZE>.
00554   ACE_Map_Impl (ACE_Allocator *alloc = 0);
00555 
00556   /// Initialize with <size> entries.  The <size> parameter is ignored
00557   /// by maps for which an initialize size does not make sense.
00558   ACE_Map_Impl (size_t size,
00559                 ACE_Allocator *alloc = 0);
00560 
00561   /// Close down and release dynamically allocated resources.
00562   virtual ~ACE_Map_Impl (void);
00563 
00564   /// Initialize a <Map> with size <length>.
00565   virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE,
00566                     ACE_Allocator *alloc = 0);
00567 
00568   /// Close down a <Map> and release dynamically allocated resources.
00569   virtual int close (void);
00570 
00571   /**
00572    * Add <key>/<value> pair to the map.  If <key> is already in the
00573    * map then no changes are made and 1 is returned.  Returns 0 on a
00574    * successful addition.  This function fails for maps that do not
00575    * allow user specified keys. <key> is an "in" parameter.
00576    */
00577   virtual int bind (const KEY &key,
00578                     const VALUE &value);
00579 
00580   /**
00581    * Add <key>/<value> pair to the map.  <key> is an "inout" parameter
00582    * and maybe modified/extended by the map to add additional
00583    * information.  To recover original key, call the <recover_key>
00584    * method.
00585    */
00586   virtual int bind_modify_key (const VALUE &value,
00587                                KEY &key);
00588 
00589   /**
00590    * Produce a key and return it through <key> which is an "out"
00591    * parameter.  For maps that do not naturally produce keys, the map
00592    * adapters will use the <KEY_GENERATOR> class to produce a key.
00593    * However, the users are responsible for not jeopardizing this key
00594    * production scheme by using user specified keys with keys produced
00595    * by the key generator.
00596    */
00597   virtual int create_key (KEY &key);
00598 
00599   /**
00600    * Add <value> to the map, and the corresponding key produced by the
00601    * Map is returned through <key> which is an "out" parameter.  For
00602    * maps that do not naturally produce keys, the map adapters will
00603    * use the <KEY_GENERATOR> class to produce a key.  However, the
00604    * users are responsible for not jeopardizing this key production
00605    * scheme by using user specified keys with keys produced by the key
00606    * generator.
00607    */
00608   virtual int bind_create_key (const VALUE &value,
00609                                KEY &key);
00610 
00611   /**
00612    * Add <value> to the map.  The user does not care about the
00613    * corresponding key produced by the Map. For maps that do not
00614    * naturally produce keys, the map adapters will use the
00615    * <KEY_GENERATOR> class to produce a key.  However, the users are
00616    * responsible for not jeopardizing this key production scheme by
00617    * using user specified keys with keys produced by the key
00618    * generator.
00619    */
00620   virtual int bind_create_key (const VALUE &value);
00621 
00622   /// Recovers the original key potentially modified by the map during
00623   /// <bind_modify_key>.
00624   virtual int recover_key (const KEY &modified_key,
00625                            KEY &original_key);
00626 
00627   /**
00628    * Reassociate <key> with <value>. The function fails if <key> is
00629    * not in the map for maps that do not allow user specified keys.
00630    * However, for maps that allow user specified keys, if the key is
00631    * not in the map, a new <key>/<value> association is created.
00632    */
00633   virtual int rebind (const KEY &key,
00634                       const VALUE &value);
00635 
00636   /**
00637    * Reassociate <key> with <value>, storing the old value into the
00638    * "out" parameter <old_value>.  The function fails if <key> is not
00639    * in the map for maps that do not allow user specified keys.
00640    * However, for maps that allow user specified keys, if the key is
00641    * not in the map, a new <key>/<value> association is created.
00642    */
00643   virtual int rebind (const KEY &key,
00644                       const VALUE &value,
00645                       VALUE &old_value);
00646 
00647   /**
00648    * Reassociate <key> with <value>, storing the old key and value
00649    * into the "out" parameters <old_key> and <old_value>.  The
00650    * function fails if <key> is not in the map for maps that do not
00651    * allow user specified keys.  However, for maps that allow user
00652    * specified keys, if the key is not in the map, a new <key>/<value>
00653    * association is created.
00654    */
00655   virtual int rebind (const KEY &key,
00656                       const VALUE &value,
00657                       KEY &old_key,
00658                       VALUE &old_value);
00659 
00660   /**
00661    * Associate <key> with <value> if and only if <key> is not in the
00662    * map.  If <key> is already in the map, then the <value> parameter
00663    * is overwritten with the existing value in the map. Returns 0 if a
00664    * new <key>/<value> association is created.  Returns 1 if an
00665    * attempt is made to bind an existing entry.  This function fails
00666    * for maps that do not allow user specified keys.
00667    */
00668   virtual int trybind (const KEY &key,
00669                        VALUE &value);
00670 
00671   /// Locate <value> associated with <key>.
00672   virtual int find (const KEY &key,
00673                     VALUE &value);
00674 
00675   /// Is <key> in the map?
00676   virtual int find (const KEY &key);
00677 
00678   /// Remove <key> from the map.
00679   virtual int unbind (const KEY &key);
00680 
00681   /// Remove <key> from the map, and return the <value> associated with
00682   /// <key>.
00683   virtual int unbind (const KEY &key,
00684                       VALUE &value);
00685 
00686   /// Return the current size of the map.
00687   virtual size_t current_size (void) const;
00688 
00689   /// Return the total size of the map.
00690   virtual size_t total_size (void) const;
00691 
00692   /// Dump the state of an object.
00693   virtual void dump (void) const;
00694 
00695   /// Accessor to implementation object.
00696   IMPLEMENTATION &impl (void);
00697 
00698 protected:
00699 
00700   /// All implementation details are forwarded to this class.
00701   IMPLEMENTATION implementation_;
00702 
00703   // = STL styled iterator factory functions.
00704 
00705   /// Return forward iterator.
00706   virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl (void);
00707   virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *end_impl (void);
00708 
00709   /// Return reverse iterator.
00710   virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rbegin_impl (void);
00711   virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl (void);
00712 
00713 private:
00714 
00715   // = Disallow these operations.
00716   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY> &))
00717   ACE_UNIMPLEMENTED_FUNC (ACE_Map_Impl (const ACE_Map_Impl<KEY, VALUE, IMPLEMENTATION, ITERATOR, REVERSE_ITERATOR, ENTRY> &))
00718 };
00719 
00720 /**
00721  * @class ACE_Active_Map_Manager_Iterator_Adapter
00722  *
00723  * @brief Defines a iterator implementation for the Active_Map_Manager_Adapter.
00724  *
00725  * Implementation to be provided by ACE_Active_Map_Manager::iterator.
00726  */
00727 template <class T, class VALUE>
00728 class ACE_Active_Map_Manager_Iterator_Adapter : public ACE_Iterator_Impl<T>
00729 {
00730 public:
00731 
00732   // = Traits.
00733   typedef ACE_TYPENAME ACE_Active_Map_Manager<VALUE>::iterator
00734           implementation;
00735 
00736   /// Constructor.
00737   ACE_Active_Map_Manager_Iterator_Adapter (const ACE_Map_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &impl);
00738 
00739   /// Destructor.
00740   virtual ~ACE_Active_Map_Manager_Iterator_Adapter (void);
00741 
00742   /// Clone.
00743   virtual ACE_Iterator_Impl<T> *clone (void) const;
00744 
00745   /// Comparison.
00746   virtual int compare (const ACE_Iterator_Impl<T> &rhs) const;
00747 
00748   /// Dereference.
00749   virtual T dereference (void) const;
00750 
00751   /// Advance.
00752   virtual void plus_plus (void);
00753 
00754   /// Reverse.
00755   virtual void minus_minus (void);
00756 
00757   /// Accessor to implementation object.
00758   ACE_Map_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &impl (void);
00759 
00760 protected:
00761 
00762   /// All implementation details are forwarded to this class.
00763   ACE_Map_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> implementation_;
00764 };
00765 
00766 /**
00767  * @class ACE_Active_Map_Manager_Reverse_Iterator_Adapter
00768  *
00769  * @brief Defines a reverse iterator implementation for the Active_Map_Manager_Adapter.
00770  *
00771  * Implementation to be provided by ACE_Active_Map_Manager::reverse_iterator.
00772  */
00773 template <class T, class VALUE>
00774 class ACE_Active_Map_Manager_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T>
00775 {
00776 public:
00777 
00778   // = Traits.
00779   typedef ACE_TYPENAME ACE_Active_Map_Manager<VALUE>::reverse_iterator
00780           implementation;
00781 
00782   /// Constructor.
00783   ACE_Active_Map_Manager_Reverse_Iterator_Adapter (const ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &impl);
00784 
00785   /// Destructor.
00786   virtual ~ACE_Active_Map_Manager_Reverse_Iterator_Adapter (void);
00787 
00788   /// Clone.
00789   virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const;
00790 
00791   /// Comparison.
00792   virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const;
00793 
00794   /// Dereference.
00795   virtual T dereference (void) const;
00796 
00797   /// Advance.
00798   virtual void plus_plus (void);
00799 
00800   /// Reverse.
00801   virtual void minus_minus (void);
00802 
00803   /// Accessor to implementation object.
00804   ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> &impl (void);
00805 
00806 protected:
00807 
00808   /// All implementation details are forwarded to this class.
00809   ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, VALUE, ACE_Null_Mutex> implementation_;
00810 };
00811 
00812 /**
00813  * @class ACE_Active_Map_Manager_Adapter
00814  *
00815  * @brief Defines a map implementation.
00816  *
00817  * Implementation to be provided by <ACE_Active_Map_Manager>.
00818  */
00819 template <class KEY, class VALUE, class KEY_ADAPTER>
00820 class ACE_Active_Map_Manager_Adapter : public ACE_Map<KEY, VALUE>
00821 {
00822 public:
00823 
00824   // = Traits.
00825   typedef ACE_Pair<KEY, VALUE>
00826           expanded_value;
00827   typedef ACE_Active_Map_Manager_Iterator_Adapter<ACE_Reference_Pair<const KEY, VALUE>, expanded_value>
00828           iterator_impl;
00829   typedef ACE_Active_Map_Manager_Reverse_Iterator_Adapter<ACE_Reference_Pair<const KEY, VALUE>, expanded_value>
00830           reverse_iterator_impl;
00831   typedef ACE_Active_Map_Manager<expanded_value>
00832           implementation;
00833 
00834   // = Initialization and termination methods.
00835   /// Initialize with the <ACE_DEFAULT_MAP_SIZE>.
00836   ACE_Active_Map_Manager_Adapter (ACE_Allocator *alloc = 0);
00837 
00838   /// Initialize with <size> entries.  The <size> parameter is ignored
00839   /// by maps for which an initialize size does not make sense.
00840   ACE_Active_Map_Manager_Adapter (size_t size,
00841                                   ACE_Allocator *alloc = 0);
00842 
00843   /// Close down and release dynamically allocated resources.
00844   virtual ~ACE_Active_Map_Manager_Adapter (void);
00845 
00846   /// Initialize a <Map> with size <length>.
00847   virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE,
00848                     ACE_Allocator *alloc = 0);
00849 
00850   /// Close down a <Map> and release dynamically allocated resources.
00851   virtual int close (void);
00852 
00853   /**
00854    * Add <key>/<value> pair to the map.  If <key> is already in the
00855    * map then no changes are made and 1 is returned.  Returns 0 on a
00856    * successful addition.  This function fails for maps that do not
00857    * allow user specified keys. <key> is an "in" parameter.
00858    */
00859   virtual int bind (const KEY &key,
00860                     const VALUE &value);
00861 
00862   /**
00863    * Add <key>/<value> pair to the map.  <key> is an "inout" parameter
00864    * and maybe modified/extended by the map to add additional
00865    * information.  To recover original key, call the <recover_key>
00866    * method.
00867    */
00868   virtual int bind_modify_key (const VALUE &value,
00869                                KEY &key);
00870 
00871   /**
00872    * Produce a key and return it through <key> which is an "out"
00873    * parameter.  For maps that do not naturally produce keys, the map
00874    * adapters will use the <KEY_GENERATOR> class to produce a key.
00875    * However, the users are responsible for not jeopardizing this key
00876    * production scheme by using user specified keys with keys produced
00877    * by the key generator.
00878    */
00879   virtual int create_key (KEY &key);
00880 
00881   /**
00882    * Add <value> to the map, and the corresponding key produced by the
00883    * Map is returned through <key> which is an "out" parameter.  For
00884    * maps that do not naturally produce keys, the map adapters will
00885    * use the <KEY_GENERATOR> class to produce a key.  However, the
00886    * users are responsible for not jeopardizing this key production
00887    * scheme by using user specified keys with keys produced by the key
00888    * generator.
00889    */
00890   virtual int bind_create_key (const VALUE &value,
00891                                KEY &key);
00892 
00893   /**
00894    * Add <value> to the map.  The user does not care about the
00895    * corresponding key produced by the Map. For maps that do not
00896    * naturally produce keys, the map adapters will use the
00897    * <KEY_GENERATOR> class to produce a key.  However, the users are
00898    * responsible for not jeopardizing this key production scheme by
00899    * using user specified keys with keys produced by the key
00900    * generator.
00901    */
00902   virtual int bind_create_key (const VALUE &value);
00903 
00904   /// Recovers the original key potentially modified by the map during
00905   /// <bind_modify_key>.
00906   virtual int recover_key (const KEY &modified_key,
00907                            KEY &original_key);
00908 
00909   /**
00910    * Reassociate <key> with <value>. The function fails if <key> is
00911    * not in the map for maps that do not allow user specified keys.
00912    * However, for maps that allow user specified keys, if the key is
00913    * not in the map, a new <key>/<value> association is created.
00914    */
00915   virtual int rebind (const KEY &key,
00916                       const VALUE &value);
00917 
00918   /**
00919    * Reassociate <key> with <value>, storing the old value into the
00920    * "out" parameter <old_value>.  The function fails if <key> is not
00921    * in the map for maps that do not allow user specified keys.
00922    * However, for maps that allow user specified keys, if the key is
00923    * not in the map, a new <key>/<value> association is created.
00924    */
00925   virtual int rebind (const KEY &key,
00926                       const VALUE &value,
00927                       VALUE &old_value);
00928 
00929   /**
00930    * Reassociate <key> with <value>, storing the old key and value
00931    * into the "out" parameters <old_key> and <old_value>.  The
00932    * function fails if <key> is not in the map for maps that do not
00933    * allow user specified keys.  However, for maps that allow user
00934    * specified keys, if the key is not in the map, a new <key>/<value>
00935    * association is created.
00936    */
00937   virtual int rebind (const KEY &key,
00938                       const VALUE &value,
00939                       KEY &old_key,
00940                       VALUE &old_value);
00941 
00942   /**
00943    * Associate <key> with <value> if and only if <key> is not in the
00944    * map.  If <key> is already in the map, then the <value> parameter
00945    * is overwritten with the existing value in the map. Returns 0 if a
00946    * new <key>/<value> association is created.  Returns 1 if an
00947    * attempt is made to bind an existing entry.  This function fails
00948    * for maps that do not allow user specified keys.
00949    */
00950   virtual int trybind (const KEY &key,
00951                        VALUE &value);
00952 
00953   /// Locate <value> associated with <key>.
00954   virtual int find (const KEY &key,
00955                     VALUE &value);
00956 
00957   /// Is <key> in the map?
00958   virtual int find (const KEY &key);
00959 
00960   /// Remove <key> from the map.
00961   virtual int unbind (const KEY &key);
00962 
00963   /// Remove <key> from the map, and return the <value> associated with
00964   /// <key>.
00965   virtual int unbind (const KEY &key,
00966                       VALUE &value);
00967 
00968   /// Return the current size of the map.
00969   virtual size_t current_size (void) const;
00970 
00971   /// Return the total size of the map.
00972   virtual size_t total_size (void) const;
00973 
00974   /// Dump the state of an object.
00975   virtual void dump (void) const;
00976 
00977   /// Accessor to implementation object.
00978   ACE_Active_Map_Manager<ACE_Pair<KEY, VALUE> > &impl (void);
00979 
00980   /// Accessor to key adapter.
00981   KEY_ADAPTER &key_adapter (void);
00982 
00983 protected:
00984 
00985   /// Find helper.
00986   virtual int find (const KEY &key,
00987                     expanded_value *&internal_value);
00988 
00989   /// Unbind helper.
00990   virtual int unbind (const KEY &key,
00991                       expanded_value *&internal_value);
00992 
00993   /// All implementation details are forwarded to this class.
00994   ACE_Active_Map_Manager<ACE_Pair<KEY, VALUE> > implementation_;
00995 
00996   /// Adapts between the user key and the Active_Map_Manager_Key.
00997   KEY_ADAPTER key_adapter_;
00998 
00999   // = STL styled iterator factory functions.
01000 
01001   /// Return forward iterator.
01002   virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl (void);
01003   virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *end_impl (void);
01004 
01005   /// Return reverse iterator.
01006   virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rbegin_impl (void);
01007   virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl (void);
01008 
01009 private:
01010 
01011   // = Disallow these operations.
01012   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER> &))
01013   ACE_UNIMPLEMENTED_FUNC (ACE_Active_Map_Manager_Adapter (const ACE_Active_Map_Manager_Adapter<KEY, VALUE, KEY_ADAPTER> &))
01014 };
01015 
01016 /**
01017  * @class ACE_Hash_Map_Manager_Ex_Iterator_Adapter
01018  *
01019  * @brief Defines a iterator implementation for the Hash_Map_Manager_Adapter.
01020  *
01021  * Implementation to be provided by ACE_Hash_Map_Manager_Ex::iterator.
01022  */
01023 template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS>
01024 class ACE_Hash_Map_Manager_Ex_Iterator_Adapter : public ACE_Iterator_Impl<T>
01025 {
01026 public:
01027 
01028   // = Traits.
01029   typedef ACE_TYPENAME ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>::iterator
01030           implementation;
01031 
01032   /// Constructor.
01033   ACE_Hash_Map_Manager_Ex_Iterator_Adapter (const ACE_Hash_Map_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl);
01034 
01035   /// Destructor.
01036   virtual ~ACE_Hash_Map_Manager_Ex_Iterator_Adapter (void);
01037 
01038   /// Clone.
01039   virtual ACE_Iterator_Impl<T> *clone (void) const;
01040 
01041   /// Comparison.
01042   virtual int compare (const ACE_Iterator_Impl<T> &rhs) const;
01043 
01044   /// Dereference.
01045   virtual T dereference (void) const;
01046 
01047   /// Advance.
01048   virtual void plus_plus (void);
01049 
01050   /// Reverse.
01051   virtual void minus_minus (void);
01052 
01053   /// Accessor to implementation object.
01054   ACE_Hash_Map_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl (void);
01055 
01056 protected:
01057 
01058   /// All implementation details are forwarded to this class.
01059   ACE_Hash_Map_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> implementation_;
01060 };
01061 
01062 /**
01063  * @class ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter
01064  *
01065  * @brief Defines a reverse iterator implementation for the Hash_Map_Manager_Adapter.
01066  *
01067  * Implementation to be provided by ACE_Hash_Map_Manager_Ex::reverse_iterator.
01068  */
01069 template <class T, class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS>
01070 class ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T>
01071 {
01072 public:
01073 
01074   // = Traits.
01075   typedef ACE_TYPENAME ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>::reverse_iterator
01076           implementation;
01077 
01078   /// Constructor.
01079   ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter (const ACE_Hash_Map_Reverse_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl);
01080 
01081   /// Destructor.
01082   virtual ~ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter (void);
01083 
01084   /// Clone.
01085   virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const;
01086 
01087   /// Comparison.
01088   virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const;
01089 
01090   /// Dereference.
01091   virtual T dereference (void) const;
01092 
01093   /// Advance.
01094   virtual void plus_plus (void);
01095 
01096   /// Reverse.
01097   virtual void minus_minus (void);
01098 
01099   /// Accessor to implementation object.
01100   ACE_Hash_Map_Reverse_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl (void);
01101 
01102 protected:
01103 
01104   /// All implementation details are forwarded to this class.
01105   ACE_Hash_Map_Reverse_Iterator_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> implementation_;
01106 };
01107 
01108 /**
01109  * @class ACE_Hash_Map_Manager_Ex_Adapter
01110  *
01111  * @brief Defines a map implementation.
01112  *
01113  * Implementation to be provided by <ACE_Hash_Map_Manager_Ex>.
01114  */
01115 template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class KEY_GENERATOR>
01116 class ACE_Hash_Map_Manager_Ex_Adapter : public ACE_Map<KEY, VALUE>
01117 {
01118 public:
01119 
01120   // = Traits.
01121   typedef ACE_Hash_Map_Manager_Ex_Iterator_Adapter<ACE_Reference_Pair<const KEY, VALUE>, KEY, VALUE, HASH_KEY, COMPARE_KEYS>
01122           iterator_impl;
01123   typedef ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter<ACE_Reference_Pair<const KEY, VALUE>, KEY, VALUE, HASH_KEY, COMPARE_KEYS>
01124           reverse_iterator_impl;
01125   typedef ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex>
01126           implementation;
01127 
01128   // = Initialization and termination methods.
01129   /// Initialize with the <ACE_DEFAULT_MAP_SIZE>.
01130   ACE_Hash_Map_Manager_Ex_Adapter (ACE_Allocator *alloc = 0);
01131 
01132   /// Initialize with <size> entries.  The <size> parameter is ignored
01133   /// by maps for which an initialize size does not make sense.
01134   ACE_Hash_Map_Manager_Ex_Adapter (size_t size,
01135                                    ACE_Allocator *alloc = 0);
01136 
01137   /// Close down and release dynamically allocated resources.
01138   virtual ~ACE_Hash_Map_Manager_Ex_Adapter (void);
01139 
01140   /// Initialize a <Map> with size <length>.
01141   virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE,
01142                     ACE_Allocator *alloc = 0);
01143 
01144   /// Close down a <Map> and release dynamically allocated resources.
01145   virtual int close (void);
01146 
01147   /**
01148    * Add <key>/<value> pair to the map.  If <key> is already in the
01149    * map then no changes are made and 1 is returned.  Returns 0 on a
01150    * successful addition.  This function fails for maps that do not
01151    * allow user specified keys. <key> is an "in" parameter.
01152    */
01153   virtual int bind (const KEY &key,
01154                     const VALUE &value);
01155 
01156   /**
01157    * Add <key>/<value> pair to the map.  <key> is an "inout" parameter
01158    * and maybe modified/extended by the map to add additional
01159    * information.  To recover original key, call the <recover_key>
01160    * method.
01161    */
01162   virtual int bind_modify_key (const VALUE &value,
01163                                KEY &key);
01164 
01165   /**
01166    * Produce a key and return it through <key> which is an "out"
01167    * parameter.  For maps that do not naturally produce keys, the map
01168    * adapters will use the <KEY_GENERATOR> class to produce a key.
01169    * However, the users are responsible for not jeopardizing this key
01170    * production scheme by using user specified keys with keys produced
01171    * by the key generator.
01172    */
01173   virtual int create_key (KEY &key);
01174 
01175   /**
01176    * Add <value> to the map, and the corresponding key produced by the
01177    * Map is returned through <key> which is an "out" parameter.  For
01178    * maps that do not naturally produce keys, the map adapters will
01179    * use the <KEY_GENERATOR> class to produce a key.  However, the
01180    * users are responsible for not jeopardizing this key production
01181    * scheme by using user specified keys with keys produced by the key
01182    * generator.
01183    */
01184   virtual int bind_create_key (const VALUE &value,
01185                                KEY &key);
01186 
01187   /**
01188    * Add <value> to the map.  The user does not care about the
01189    * corresponding key produced by the Map. For maps that do not
01190    * naturally produce keys, the map adapters will use the
01191    * <KEY_GENERATOR> class to produce a key.  However, the users are
01192    * responsible for not jeopardizing this key production scheme by
01193    * using user specified keys with keys produced by the key
01194    * generator.
01195    */
01196   virtual int bind_create_key (const VALUE &value);
01197 
01198   /// Recovers the original key potentially modified by the map during
01199   /// <bind_modify_key>.
01200   virtual int recover_key (const KEY &modified_key,
01201                            KEY &original_key);
01202 
01203   /**
01204    * Reassociate <key> with <value>. The function fails if <key> is
01205    * not in the map for maps that do not allow user specified keys.
01206    * However, for maps that allow user specified keys, if the key is
01207    * not in the map, a new <key>/<value> association is created.
01208    */
01209   virtual int rebind (const KEY &key,
01210                       const VALUE &value);
01211 
01212   /**
01213    * Reassociate <key> with <value>, storing the old value into the
01214    * "out" parameter <old_value>.  The function fails if <key> is not
01215    * in the map for maps that do not allow user specified keys.
01216    * However, for maps that allow user specified keys, if the key is
01217    * not in the map, a new <key>/<value> association is created.
01218    */
01219   virtual int rebind (const KEY &key,
01220                       const VALUE &value,
01221                       VALUE &old_value);
01222 
01223   /**
01224    * Reassociate <key> with <value>, storing the old key and value
01225    * into the "out" parameters <old_key> and <old_value>.  The
01226    * function fails if <key> is not in the map for maps that do not
01227    * allow user specified keys.  However, for maps that allow user
01228    * specified keys, if the key is not in the map, a new <key>/<value>
01229    * association is created.
01230    */
01231   virtual int rebind (const KEY &key,
01232                       const VALUE &value,
01233                       KEY &old_key,
01234                       VALUE &old_value);
01235 
01236   /**
01237    * Associate <key> with <value> if and only if <key> is not in the
01238    * map.  If <key> is already in the map, then the <value> parameter
01239    * is overwritten with the existing value in the map. Returns 0 if a
01240    * new <key>/<value> association is created.  Returns 1 if an
01241    * attempt is made to bind an existing entry.  This function fails
01242    * for maps that do not allow user specified keys.
01243    */
01244   virtual int trybind (const KEY &key,
01245                        VALUE &value);
01246 
01247   /// Locate <value> associated with <key>.
01248   virtual int find (const KEY &key,
01249                     VALUE &value);
01250 
01251   /// Is <key> in the map?
01252   virtual int find (const KEY &key);
01253 
01254   /// Remove <key> from the map.
01255   virtual int unbind (const KEY &key);
01256 
01257   /// Remove <key> from the map, and return the <value> associated with
01258   /// <key>.
01259   virtual int unbind (const KEY &key,
01260                       VALUE &value);
01261 
01262   /// Return the current size of the map.
01263   virtual size_t current_size (void) const;
01264 
01265   /// Return the total size of the map.
01266   virtual size_t total_size (void) const;
01267 
01268   /// Dump the state of an object.
01269   virtual void dump (void) const;
01270 
01271   /// Accessor to implementation object.
01272   ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> &impl (void);
01273 
01274   /// Accessor to key generator.
01275   KEY_GENERATOR &key_generator (void);
01276 
01277 protected:
01278 
01279   /// All implementation details are forwarded to this class.
01280   ACE_Hash_Map_Manager_Ex<KEY, VALUE, HASH_KEY, COMPARE_KEYS, ACE_Null_Mutex> implementation_;
01281 
01282   /// Functor class used for generating key.
01283   KEY_GENERATOR key_generator_;
01284 
01285   // = STL styled iterator factory functions.
01286 
01287   /// Return forward iterator.
01288   virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl (void);
01289   virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *end_impl (void);
01290 
01291   /// Return reverse iterator.
01292   virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rbegin_impl (void);
01293   virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl (void);
01294 
01295 private:
01296 
01297   // = Disallow these operations.
01298   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR> &))
01299   ACE_UNIMPLEMENTED_FUNC (ACE_Hash_Map_Manager_Ex_Adapter (const ACE_Hash_Map_Manager_Ex_Adapter<KEY, VALUE, HASH_KEY, COMPARE_KEYS, KEY_GENERATOR> &))
01300 };
01301 
01302 /**
01303  * @class ACE_Map_Manager_Iterator_Adapter
01304  *
01305  * @brief Defines a iterator implementation for the Map_Manager_Adapter.
01306  *
01307  * Implementation to be provided by ACE_Map_Manager::iterator.
01308  */
01309 template <class T, class KEY, class VALUE>
01310 class ACE_Map_Manager_Iterator_Adapter : public ACE_Iterator_Impl<T>
01311 {
01312 public:
01313 
01314   // = Traits.
01315   typedef ACE_TYPENAME ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex>::iterator
01316           implementation;
01317 
01318   /// Constructor.
01319   ACE_Map_Manager_Iterator_Adapter (const ACE_Map_Iterator<KEY, VALUE, ACE_Null_Mutex> &impl);
01320 
01321   /// Destructor.
01322   virtual ~ACE_Map_Manager_Iterator_Adapter (void);
01323 
01324   /// Clone.
01325   virtual ACE_Iterator_Impl<T> *clone (void) const;
01326 
01327   /// Comparison.
01328   virtual int compare (const ACE_Iterator_Impl<T> &rhs) const;
01329 
01330   /// Dereference.
01331   virtual T dereference (void) const;
01332 
01333   /// Advance.
01334   virtual void plus_plus (void);
01335 
01336   /// Reverse.
01337   virtual void minus_minus (void);
01338 
01339   /// Accessor to implementation object.
01340   ACE_Map_Iterator<KEY, VALUE, ACE_Null_Mutex> &impl (void);
01341 
01342 protected:
01343 
01344   /// All implementation details are forwarded to this class.
01345   ACE_Map_Iterator<KEY, VALUE, ACE_Null_Mutex> implementation_;
01346 };
01347 
01348 /**
01349  * @class ACE_Map_Manager_Reverse_Iterator_Adapter
01350  *
01351  * @brief Defines a reverse iterator implementation for the Map Manager.
01352  *
01353  * Implementation to be provided by ACE_Map_Manager::reverse_iterator.
01354  */
01355 template <class T, class KEY, class VALUE>
01356 class ACE_Map_Manager_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl<T>
01357 {
01358 public:
01359 
01360   // = Traits.
01361   typedef ACE_TYPENAME ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex>::reverse_iterator
01362           implementation;
01363 
01364   /// Constructor.
01365   ACE_Map_Manager_Reverse_Iterator_Adapter (const ACE_Map_Reverse_Iterator<KEY, VALUE, ACE_Null_Mutex> &impl);
01366 
01367   /// Destructor.
01368   virtual ~ACE_Map_Manager_Reverse_Iterator_Adapter (void);
01369 
01370   /// Clone.
01371   virtual ACE_Reverse_Iterator_Impl<T> *clone (void) const;
01372 
01373   /// Comparison.
01374   virtual int compare (const ACE_Reverse_Iterator_Impl<T> &rhs) const;
01375 
01376   /// Dereference.
01377   virtual T dereference (void) const;
01378 
01379   /// Advance.
01380   virtual void plus_plus (void);
01381 
01382   /// Reverse.
01383   virtual void minus_minus (void);
01384 
01385   /// Accessor to implementation object.
01386   ACE_Map_Reverse_Iterator<KEY, VALUE, ACE_Null_Mutex> &impl (void);
01387 
01388 protected:
01389 
01390   /// All implementation details are forwarded to this class.
01391   ACE_Map_Reverse_Iterator<KEY, VALUE, ACE_Null_Mutex> implementation_;
01392 };
01393 
01394 /**
01395  * @class ACE_Map_Manager_Adapter
01396  *
01397  * @brief Defines a map implementation.
01398  *
01399  * Implementation to be provided by <ACE_Map_Manager>.
01400  */
01401 template <class KEY, class VALUE, class KEY_GENERATOR>
01402 class ACE_Map_Manager_Adapter : public ACE_Map<KEY, VALUE>
01403 {
01404 public:
01405 
01406   // = Traits.
01407   typedef ACE_Map_Manager_Iterator_Adapter<ACE_Reference_Pair<const KEY, VALUE>, KEY, VALUE>
01408           iterator_impl;
01409   typedef ACE_Map_Manager_Reverse_Iterator_Adapter<ACE_Reference_Pair<const KEY, VALUE>, KEY, VALUE>
01410           reverse_iterator_impl;
01411   typedef ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex>
01412           implementation;
01413 
01414   // = Initialization and termination methods.
01415   /// Initialize with the <ACE_DEFAULT_MAP_SIZE>.
01416   ACE_Map_Manager_Adapter (ACE_Allocator *alloc = 0);
01417 
01418   /// Initialize with <size> entries.  The <size> parameter is ignored
01419   /// by maps for which an initialize size does not make sense.
01420   ACE_Map_Manager_Adapter (size_t size,
01421                            ACE_Allocator *alloc = 0);
01422 
01423   /// Close down and release dynamically allocated resources.
01424   virtual ~ACE_Map_Manager_Adapter (void);
01425 
01426   /// Initialize a <Map> with size <length>.
01427   virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE,
01428                     ACE_Allocator *alloc = 0);
01429 
01430   /// Close down a <Map> and release dynamically allocated resources.
01431   virtual int close (void);
01432 
01433   /**
01434    * Add <key>/<value> pair to the map.  If <key> is already in the
01435    * map then no changes are made and 1 is returned.  Returns 0 on a
01436    * successful addition.  This function fails for maps that do not
01437    * allow user specified keys. <key> is an "in" parameter.
01438    */
01439   virtual int bind (const KEY &key,
01440                     const VALUE &value);
01441 
01442   /**
01443    * Add <key>/<value> pair to the map.  <key> is an "inout" parameter
01444    * and maybe modified/extended by the map to add additional
01445    * information.  To recover original key, call the <recover_key>
01446    * method.
01447    */
01448   virtual int bind_modify_key (const VALUE &value,
01449                                KEY &key);
01450 
01451   /**
01452    * Produce a key and return it through <key> which is an "out"
01453    * parameter.  For maps that do not naturally produce keys, the map
01454    * adapters will use the <KEY_GENERATOR> class to produce a key.
01455    * However, the users are responsible for not jeopardizing this key
01456    * production scheme by using user specified keys with keys produced
01457    * by the key generator.
01458    */
01459   virtual int create_key (KEY &key);
01460 
01461   /**
01462    * Add <value> to the map, and the corresponding key produced by the
01463    * Map is returned through <key> which is an "out" parameter.  For
01464    * maps that do not naturally produce keys, the map adapters will
01465    * use the <KEY_GENERATOR> class to produce a key.  However, the
01466    * users are responsible for not jeopardizing this key production
01467    * scheme by using user specified keys with keys produced by the key
01468    * generator.
01469    */
01470   virtual int bind_create_key (const VALUE &value,
01471                                KEY &key);
01472 
01473   /**
01474    * Add <value> to the map.  The user does not care about the
01475    * corresponding key produced by the Map. For maps that do not
01476    * naturally produce keys, the map adapters will use the
01477    * <KEY_GENERATOR> class to produce a key.  However, the users are
01478    * responsible for not jeopardizing this key production scheme by
01479    * using user specified keys with keys produced by the key
01480    * generator.
01481    */
01482   virtual int bind_create_key (const VALUE &value);
01483 
01484   /// Recovers the original key potentially modified by the map during
01485   /// <bind_modify_key>.
01486   virtual int recover_key (const KEY &modified_key,
01487                            KEY &original_key);
01488 
01489   /**
01490    * Reassociate <key> with <value>. The function fails if <key> is
01491    * not in the map for maps that do not allow user specified keys.
01492    * However, for maps that allow user specified keys, if the key is
01493    * not in the map, a new <key>/<value> association is created.
01494    */
01495   virtual int rebind (const KEY &key,
01496                       const VALUE &value);
01497 
01498   /**
01499    * Reassociate <key> with <value>, storing the old value into the
01500    * "out" parameter <old_value>.  The function fails if <key> is not
01501    * in the map for maps that do not allow user specified keys.
01502    * However, for maps that allow user specified keys, if the key is
01503    * not in the map, a new <key>/<value> association is created.
01504    */
01505   virtual int rebind (const KEY &key,
01506                       const VALUE &value,
01507                       VALUE &old_value);
01508 
01509   /**
01510    * Reassociate <key> with <value>, storing the old key and value
01511    * into the "out" parameters <old_key> and <old_value>.  The
01512    * function fails if <key> is not in the map for maps that do not
01513    * allow user specified keys.  However, for maps that allow user
01514    * specified keys, if the key is not in the map, a new <key>/<value>
01515    * association is created.
01516    */
01517   virtual int rebind (const KEY &key,
01518                       const VALUE &value,
01519                       KEY &old_key,
01520                       VALUE &old_value);
01521 
01522   /**
01523    * Associate <key> with <value> if and only if <key> is not in the
01524    * map.  If <key> is already in the map, then the <value> parameter
01525    * is overwritten with the existing value in the map. Returns 0 if a
01526    * new <key>/<value> association is created.  Returns 1 if an
01527    * attempt is made to bind an existing entry.  This function fails
01528    * for maps that do not allow user specified keys.
01529    */
01530   virtual int trybind (const KEY &key,
01531                        VALUE &value);
01532 
01533   /// Locate <value> associated with <key>.
01534   virtual int find (const KEY &key,
01535                     VALUE &value);
01536 
01537   /// Is <key> in the map?
01538   virtual int find (const KEY &key);
01539 
01540   /// Remove <key> from the map.
01541   virtual int unbind (const KEY &key);
01542 
01543   /// Remove <key> from the map, and return the <value> associated with
01544   /// <key>.
01545   virtual int unbind (const KEY &key,
01546                       VALUE &value);
01547 
01548   /// Return the current size of the map.
01549   virtual size_t current_size (void) const;
01550 
01551   /// Return the total size of the map.
01552   virtual size_t total_size (void) const;
01553 
01554   /// Dump the state of an object.
01555   virtual void dump (void) const;
01556 
01557   /// Accessor to implementation object.
01558   ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> &impl (void);
01559 
01560   /// Accessor to key generator.
01561   KEY_GENERATOR &key_generator (void);
01562 
01563 protected:
01564 
01565   /// All implementation details are forwarded to this class.
01566   ACE_Map_Manager<KEY, VALUE, ACE_Null_Mutex> implementation_;
01567 
01568   /// Functor class used for generating key.
01569   KEY_GENERATOR key_generator_;
01570 
01571   // = STL styled iterator factory functions.
01572 
01573   /// Return forward iterator.
01574   virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *begin_impl (void);
01575   virtual ACE_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *end_impl (void);
01576 
01577   /// Return reverse iterator.
01578   virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rbegin_impl (void);
01579   virtual ACE_Reverse_Iterator_Impl<ACE_Reference_Pair<const KEY, VALUE> > *rend_impl (void);
01580 
01581 private:
01582 
01583   // = Disallow these operations.
01584   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR> &))
01585   ACE_UNIMPLEMENTED_FUNC (ACE_Map_Manager_Adapter (const ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR> &))
01586 };
01587 
01588 #if defined (__ACE_INLINE__)
01589 #include "ace/Map_T.i"
01590 #endif /* __ACE_INLINE__ */
01591 
01592 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
01593 #include "ace/Map_T.cpp"
01594 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
01595 
01596 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
01597 #pragma implementation ("Map_T.cpp")
01598 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
01599 
01600 #include "ace/post.h"
01601 #endif /* ACE_MAP_T_H */

Generated on Mon Jun 16 11:20:13 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002