00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Cleanup_Strategies_T.h 00006 * 00007 * $Id: Cleanup_Strategies_T.h 81388 2008-04-23 14:02:05Z johnnyw $ 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 public: 00093 /// The method which will do the cleanup of the entry in the container. 00094 virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); 00095 }; 00096 00097 ////////////////////////////////////////////////////////////////////// 00098 00099 /** 00100 * @class ACE_Handler_Cleanup_Strategy 00101 * 00102 * @brief Defines a strategy to be followed for cleaning up 00103 * entries which are svc_handlers from a container. 00104 * 00105 * The entry to be cleaned up is removed from the container. 00106 * Here, since we are dealing with svc_handlers specifically, we 00107 * perform a couple of extra operations. @note This cleanup strategy 00108 * should be used in the case when the handler has the caching 00109 * attributes. 00110 */ 00111 template <class KEY, class VALUE, class CONTAINER> 00112 class ACE_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> 00113 { 00114 public: 00115 /// The method which will do the cleanup of the entry in the container. 00116 virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); 00117 }; 00118 00119 ////////////////////////////////////////////////////////////////////// 00120 #define ACE_Null_Cleanup_Strategy ANCLE 00121 00122 /** 00123 * @class ACE_Null_Cleanup_Strategy 00124 * 00125 * @brief Defines a do-nothing implementation of the cleanup strategy. 00126 * 00127 * This class simply does nothing at all! Can be used to nullify 00128 * the effect of the Cleanup Strategy. 00129 */ 00130 template <class KEY, class VALUE, class CONTAINER> 00131 class ACE_Null_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> 00132 { 00133 public: 00134 /// The dummy cleanup method. 00135 virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); 00136 }; 00137 00138 ACE_END_VERSIONED_NAMESPACE_DECL 00139 00140 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00141 #include "ace/Cleanup_Strategies_T.cpp" 00142 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00143 00144 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00145 #pragma implementation ("Cleanup_Strategies_T.cpp") 00146 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00147 00148 #include /**/ "ace/post.h" 00149 #endif /* CLEANUP_STRATEGIES_H */