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

Caching_Utility_T.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Caching_Utility_T.h
00006  *
00007  *  $Id: Caching_Utility_T.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_CACHING_UTILITY_H
00014 #define ACE_CACHING_UTILITY_H
00015 
00016 #include "ace/pre.h"
00017 
00018 #include "ace/config-all.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "ace/Global_Macros.h"
00025 #include "ace/Cleanup_Strategies_T.h"
00026 
00027 // For linkers that cant grok long names.
00028 #define ACE_Pair_Caching_Utility APUTIL
00029 
00030 /**
00031  * @class ACE_Pair_Caching_Utility
00032  *
00033  * @brief Defines a helper class for the Caching Strategies.
00034  *
00035  * This class defines the methods commonly used by the different
00036  * caching strategies. For instance: <clear_cache> method which
00037  * decides and purges the entry from the container.  Note: This
00038  * class helps in the caching_strategies using a container
00039  * containing entries of <KEY, ACE_Pair<VALUE, attributes>>
00040  * kind. The attributes helps in deciding the entries to be
00041  * purged. The Cleanup_Strategy is the callback class to which the
00042  * entries to be cleaned up will be delegated.
00043  */
00044 template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
00045 class ACE_Pair_Caching_Utility
00046 {
00047 public:
00048 
00049   typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
00050 
00051   /// Constructor.
00052   ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
00053                             int delete_cleanup_strategy = 0);
00054 
00055   /// Destructor.
00056   ~ACE_Pair_Caching_Utility (void);
00057 
00058   /**
00059    * Purge entries from the <container>. The Cleanup_Strategy will do the actual
00060    * job of cleanup once the entries to be cleaned up are decided.
00061    */
00062   int clear_cache (CONTAINER &container,
00063                    double purge_percent);
00064 
00065 protected:
00066 
00067   /// Find the entry with minimum caching attributes.
00068   void minimum (CONTAINER &container,
00069                 KEY *&key_to_remove,
00070                 VALUE *&value_to_remove);
00071 
00072   /// The cleanup strategy which can be used to destroy the entries of
00073   /// the container.
00074   CLEANUP_STRATEGY *cleanup_strategy_;
00075 
00076   /// Whether the cleanup_strategy should be destroyed or not.
00077   int delete_cleanup_strategy_;
00078 
00079   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Pair_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
00080   ACE_UNIMPLEMENTED_FUNC (ACE_Pair_Caching_Utility (const ACE_Pair_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
00081 };
00082 
00083 ////////////////////////////////////////////////////////////////////////////////
00084 #define ACE_Recyclable_Handler_Caching_Utility ARHUTIL
00085 
00086 /**
00087  * @class ACE_Recyclable_Handler_Caching_Utility
00088  *
00089  * @brief Defines a helper class for the Caching Strategies.
00090  *
00091  * This class defines the methods commonly used by the different
00092  * caching strategies. For instance: <clear_cache> method which
00093  * decides and purges the entry from the container.  Note: This
00094  * class helps in the caching_strategies using a container
00095  * containing entries of <KEY, Svc_Handler> kind. The attributes
00096  * helps in deciding the entries to be purged. The
00097  * Cleanup_Strategy is the callback class to which the entries to
00098  * be cleaned up will be delegated.
00099  */
00100 template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
00101 class ACE_Recyclable_Handler_Caching_Utility
00102 {
00103 
00104 public:
00105 
00106   typedef ACE_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
00107   typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
00108 
00109   /// Constructor.
00110   ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
00111                                           int delete_cleanup_strategy = 0);
00112 
00113   /// Destructor.
00114   ~ACE_Recyclable_Handler_Caching_Utility (void);
00115 
00116   /**
00117    * Purge entries from the <container>. The Cleanup_Strategy will do
00118    * the actual job of cleanup once the entries to be cleaned up are
00119    * decided.
00120    */
00121   int clear_cache (CONTAINER &container,
00122                    double purge_percent);
00123 
00124 protected:
00125 
00126   /// Find the entry with minimum caching attributes.
00127   void minimum (CONTAINER &container,
00128                 KEY *&key_to_remove,
00129                 VALUE *&value_to_remove);
00130 
00131   /// This is the default Cleanup Strategy for this utility.
00132   CLEANUP_STRATEGY_BASE *cleanup_strategy_;
00133 
00134   /// Whether the cleanup_strategy should be destroyed or not.
00135   int delete_cleanup_strategy_;
00136 
00137 private:
00138   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
00139   ACE_UNIMPLEMENTED_FUNC (ACE_Recyclable_Handler_Caching_Utility (const ACE_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
00140 };
00141 
00142 ///////////////////////////////////////////////////////////////////////////
00143 #define ACE_Refcounted_Recyclable_Handler_Caching_Utility ARRHUTIL
00144 
00145 /**
00146  * @class ACE_Refcounted_Recyclable_Handler_Caching_Utility
00147  *
00148  * @brief Defines a helper class for the Caching Strategies.
00149  *
00150  * This class defines the methods commonly used by the different
00151  * caching strategies. For instance: clear_cache () method which
00152  * decides and purges the entry from the container.  Note: This
00153  * class helps in the caching_strategies using a container
00154  * containing entries of <Refcounted_KEY,
00155  * Recyclable_Connection_Handler> kind. The attributes helps in
00156  * deciding the entries to be purged. The Cleanup_Strategy is the
00157  * callback class to which the entries to be cleaned up will be
00158  * delegated.
00159  */
00160 template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
00161 class ACE_Refcounted_Recyclable_Handler_Caching_Utility
00162 {
00163 
00164 public:
00165 
00166   typedef ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
00167   typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
00168 
00169   /// Constructor.
00170   ACE_Refcounted_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
00171                                                      int delete_cleanup_strategy = 0);
00172 
00173   /// Destructor.
00174   ~ACE_Refcounted_Recyclable_Handler_Caching_Utility (void);
00175 
00176   /**
00177    * Purge entries from the <container>. The Cleanup_Strategy will do
00178    * the actual job of cleanup once the entries to be cleaned up are
00179    * decided.
00180    */
00181   int clear_cache (CONTAINER &container,
00182                    double purge_percent);
00183 
00184 protected:
00185 
00186   /// Find the entry with minimum caching attributes.
00187   void minimum (CONTAINER &container,
00188                 KEY *&key_to_remove,
00189                 VALUE *&value_to_remove);
00190 
00191   /// This is the default Cleanup Strategy for this utility.
00192   CLEANUP_STRATEGY_BASE *cleanup_strategy_;
00193 
00194   /// Whether the cleanup_strategy should be destroyed or not.
00195   int delete_cleanup_strategy_;
00196 
00197   /**
00198    * This figure denotes the number of entries are there in the
00199    * container which have been marked as closed already but might
00200    * not have been unbound from the container.
00201    */
00202   size_t marked_as_closed_entries_;
00203 
00204 private:
00205   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Refcounted_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
00206   ACE_UNIMPLEMENTED_FUNC (ACE_Refcounted_Recyclable_Handler_Caching_Utility (const ACE_Refcounted_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
00207 };
00208 
00209 ////////////////////////////////////////////////////////////////////////////////////////
00210 
00211 /**
00212  * @class ACE_Handler_Caching_Utility
00213  *
00214  * @brief Defines a helper class for the Caching Strategies.
00215  *
00216  * This class defines the methods commonly used by the different
00217  * caching strategies. For instance: <clear_cache> method which
00218  * decides and purges the entry from the container.  Note: This
00219  * class helps in the caching_strategies using a container
00220  * containing entries of <KEY, HANDLER> kind where the HANDLER
00221  * contains the caching attributes which help in deciding the
00222  * entries to be purged. The Cleanup_Strategy is the callback
00223  * class to which the entries to be cleaned up will be delegated.
00224  */
00225 template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
00226 class ACE_Handler_Caching_Utility
00227 {
00228 public:
00229 
00230   typedef ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
00231   typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
00232 
00233   /// Constructor.
00234   ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
00235                                int delete_cleanup_strategy = 0);
00236 
00237   /// Destructor.
00238   ~ACE_Handler_Caching_Utility (void);
00239 
00240   /**
00241    * Purge entries from the <container>. The Cleanup_Strategy will do
00242    * the actual job of cleanup once the entries to be cleaned up are
00243    * decided.
00244    */
00245   int clear_cache (CONTAINER &container,
00246                    double purge_percent);
00247 
00248 protected:
00249 
00250   /**
00251    * Find the entry with minimum caching attributes.  This is handler
00252    * specific since this utility is to be used very specifically for
00253    * handler who have caching_attributes for server side acched
00254    * connection management.
00255    */
00256   void minimum (CONTAINER &container,
00257                 KEY *&key_to_remove,
00258                 VALUE *&value_to_remove);
00259 
00260   /// The cleanup strategy which can be used to destroy the entries of
00261   /// the container.
00262   CLEANUP_STRATEGY_BASE *cleanup_strategy_;
00263 
00264   /// Whether the cleanup_strategy should be destroyed or not.
00265   int delete_cleanup_strategy_;
00266 
00267 private:
00268   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
00269   ACE_UNIMPLEMENTED_FUNC (ACE_Handler_Caching_Utility (const ACE_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
00270 };
00271 
00272 ///////////////////////////////////////////////////////////////////////////
00273 #define ACE_Null_Caching_Utility ANUTIL
00274 /**
00275  * @class ACE_Null_Caching_Utility
00276  *
00277  * @brief Defines a dummy helper class for the Caching Strategies.
00278  *
00279  * This class defines the methods commonly used by the different
00280  * caching strategies. For instance: <clear_cache> method which
00281  * decides and purges the entry from the container.  Note: This
00282  * class is be used with the Null_Caching_Strategy. The
00283  * Cleanup_Strategy is the callback class to which the entries to
00284  * be cleaned up will be delegated.
00285  */
00286 template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
00287 class ACE_Null_Caching_Utility
00288 {
00289 public:
00290 
00291   typedef ACE_Null_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
00292   typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
00293 
00294   /// Constructor.
00295   ACE_Null_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
00296                             int delete_cleanup_strategy = 0);
00297 
00298   /// Destructor.
00299   ~ACE_Null_Caching_Utility (void);
00300 
00301   /**
00302    * Purge entries from the <container>. The Cleanup_Strategy will do
00303    * the actual job of cleanup once the entries to be cleaned up are
00304    * decided. Note: Here it is a no-op.
00305    */
00306   int clear_cache (CONTAINER &container,
00307                    double purge_percent);
00308 
00309 protected:
00310 
00311   /**
00312    * Find the entry with minimum caching attributes.  This is handler
00313    * specific since this utility is to be used very specifically for
00314    * handler who have caching_attributes for server side acched
00315    * connection management.Note: Here it is a no-op.
00316    */
00317   void minimum (CONTAINER &container,
00318                 KEY *&key_to_remove,
00319                 VALUE *&value_to_remove);
00320 
00321   /// The cleanup strategy which can be used to destroy the entries of
00322   /// the container.
00323   CLEANUP_STRATEGY_BASE *cleanup_strategy_;
00324 
00325   /// Whether the cleanup_strategy should be destroyed or not.
00326   int delete_cleanup_strategy_;
00327 
00328 private:
00329   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Null_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
00330   ACE_UNIMPLEMENTED_FUNC (ACE_Null_Caching_Utility (const ACE_Null_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
00331 };
00332 
00333 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00334 #include "ace/Caching_Utility_T.cpp"
00335 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00336 
00337 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00338 #pragma implementation ("Caching_Utility_T.cpp")
00339 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00340 
00341 #include "ace/post.h"
00342 
00343 #endif /* ACE_CACHING_UTILITY_H */

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