00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Cleanup_Strategies_T.h 00006 * 00007 * Cleanup_Strategies_T.h,v 4.16 2006/02/03 23:39:05 ossama Exp 00008 * 00009 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef CLEANUP_STRATEGIES_H 00015 #define CLEANUP_STRATEGIES_H 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 // For linkers that cant grok long names. 00025 #define ACE_Cleanup_Strategy ACLE 00026 00027 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 /** 00030 * @class ACE_Cleanup_Strategy 00031 * 00032 * @brief Defines a default strategy to be followed for cleaning up 00033 * entries from a map which is the container. 00034 * 00035 * By default the entry to be cleaned up is removed from the 00036 * container. 00037 */ 00038 template <class KEY, class VALUE, class CONTAINER> 00039 class ACE_Cleanup_Strategy 00040 { 00041 00042 public: 00043 00044 /// Destructor. 00045 virtual ~ACE_Cleanup_Strategy (void); 00046 00047 /// The method which will do the cleanup of the entry in the container. 00048 virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); 00049 }; 00050 00051 ////////////////////////////////////////////////////////////////////// 00052 #define ACE_Recyclable_Handler_Cleanup_Strategy ARHCLE 00053 00054 /** 00055 * @class ACE_Recyclable_Handler_Cleanup_Strategy 00056 * 00057 * @brief Defines a strategy to be followed for cleaning up 00058 * entries which are svc_handlers from a container. 00059 * 00060 * The entry to be cleaned up is removed from the container. 00061 * Here, since we are dealing with svc_handlers specifically, we 00062 * perform a couple of extra operations. @note To be used when 00063 * the handler is recyclable. 00064 */ 00065 template <class KEY, class VALUE, class CONTAINER> 00066 class ACE_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> 00067 { 00068 00069 public: 00070 00071 /// The method which will do the cleanup of the entry in the container. 00072 virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); 00073 }; 00074 00075 ////////////////////////////////////////////////////////////////////// 00076 #define ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy ARRHCLE 00077 00078 /** 00079 * @class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy 00080 * 00081 * @brief Defines a strategy to be followed for cleaning up 00082 * entries which are svc_handlers from a container. 00083 * 00084 * The entry to be cleaned up is removed from the container. 00085 * Here, since we are dealing with recyclable svc_handlers with 00086 * addresses which are refcountable specifically, we perform a 00087 * couple of extra operations and do so without any locking. 00088 */ 00089 template <class KEY, class VALUE, class CONTAINER> 00090 class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> 00091 { 00092 00093 public: 00094 00095 /// The method which will do the cleanup of the entry in the container. 00096 virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); 00097 }; 00098 00099 ////////////////////////////////////////////////////////////////////// 00100 00101 /** 00102 * @class ACE_Handler_Cleanup_Strategy 00103 * 00104 * @brief Defines a strategy to be followed for cleaning up 00105 * entries which are svc_handlers from a container. 00106 * 00107 * The entry to be cleaned up is removed from the container. 00108 * Here, since we are dealing with svc_handlers specifically, we 00109 * perform a couple of extra operations. @note This cleanup strategy 00110 * should be used in the case when the handler has the caching 00111 * attributes. 00112 */ 00113 template <class KEY, class VALUE, class CONTAINER> 00114 class ACE_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> 00115 { 00116 00117 public: 00118 00119 /// The method which will do the cleanup of the entry in the container. 00120 virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); 00121 }; 00122 00123 ////////////////////////////////////////////////////////////////////// 00124 #define ACE_Null_Cleanup_Strategy ANCLE 00125 00126 /** 00127 * @class ACE_Null_Cleanup_Strategy 00128 * 00129 * @brief Defines a do-nothing implementation of the cleanup strategy. 00130 * 00131 * This class simply does nothing at all! Can be used to nullify 00132 * the effect of the Cleanup Strategy. 00133 */ 00134 template <class KEY, class VALUE, class CONTAINER> 00135 class ACE_Null_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> 00136 { 00137 00138 public: 00139 00140 /// The dummy cleanup method. 00141 virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); 00142 }; 00143 00144 ACE_END_VERSIONED_NAMESPACE_DECL 00145 00146 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00147 #include "ace/Cleanup_Strategies_T.cpp" 00148 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00149 00150 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00151 #pragma implementation ("Cleanup_Strategies_T.cpp") 00152 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00153 00154 #include /**/ "ace/post.h" 00155 #endif /* CLEANUP_STRATEGIES_H */