[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / Caching_Utility_T.h
blob5428682d099b045fd89c78c2f30f1e18be92c4df
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Caching_Utility_T.h
7 * $Id: Caching_Utility_T.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
11 //=============================================================================
13 #ifndef ACE_CACHING_UTILITY_H
14 #define ACE_CACHING_UTILITY_H
16 #include /**/ "ace/pre.h"
18 #include /**/ "ace/config-all.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "ace/Global_Macros.h"
25 #include "ace/Cleanup_Strategies_T.h"
27 // For linkers that cant grok long names.
28 #define ACE_Pair_Caching_Utility APUTIL
30 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 /**
33 * @class ACE_Pair_Caching_Utility
35 * @brief Defines a helper class for the Caching Strategies.
37 * This class defines the methods commonly used by the different
38 * caching strategies. For instance: <clear_cache> method which
39 * decides and purges the entry from the container. @note This
40 * class helps in the caching_strategies using a container
41 * containing entries of <KEY, ACE_Pair<VALUE, attributes>>
42 * kind. The attributes helps in deciding the entries to be
43 * purged. The Cleanup_Strategy is the callback class to which the
44 * entries to be cleaned up will be delegated.
46 template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
47 class ACE_Pair_Caching_Utility
49 public:
51 typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
53 /// Constructor.
54 ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
55 int delete_cleanup_strategy = 0);
57 /// Destructor.
58 ~ACE_Pair_Caching_Utility (void);
60 /**
61 * Purge entries from the @a container. The Cleanup_Strategy will do the
62 * actual job of cleanup once the entries to be cleaned up are decided.
64 int clear_cache (CONTAINER &container,
65 double purge_percent);
67 protected:
69 /// Find the entry with minimum caching attributes.
70 void minimum (CONTAINER &container,
71 KEY *&key_to_remove,
72 VALUE *&value_to_remove);
74 /// The cleanup strategy which can be used to destroy the entries of
75 /// the container.
76 CLEANUP_STRATEGY *cleanup_strategy_;
78 /// Whether the cleanup_strategy should be destroyed or not.
79 int delete_cleanup_strategy_;
81 ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Pair_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
82 ACE_UNIMPLEMENTED_FUNC (ACE_Pair_Caching_Utility (const ACE_Pair_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
85 ////////////////////////////////////////////////////////////////////////////////
86 #define ACE_Recyclable_Handler_Caching_Utility ARHUTIL
88 /**
89 * @class ACE_Recyclable_Handler_Caching_Utility
91 * @brief Defines a helper class for the Caching Strategies.
93 * This class defines the methods commonly used by the different
94 * caching strategies. For instance: <clear_cache> method which
95 * decides and purges the entry from the container. @note This
96 * class helps in the caching_strategies using a container
97 * containing entries of <KEY, Svc_Handler> kind. The attributes
98 * helps in deciding the entries to be purged. The
99 * Cleanup_Strategy is the callback class to which the entries to
100 * be cleaned up will be delegated.
102 template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
103 class ACE_Recyclable_Handler_Caching_Utility
106 public:
108 typedef ACE_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
109 typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
111 /// Constructor.
112 ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
113 int delete_cleanup_strategy = 0);
115 /// Destructor.
116 ~ACE_Recyclable_Handler_Caching_Utility (void);
119 * Purge entries from the <container>. The Cleanup_Strategy will do
120 * the actual job of cleanup once the entries to be cleaned up are
121 * decided.
123 int clear_cache (CONTAINER &container,
124 double purge_percent);
126 protected:
128 /// Find the entry with minimum caching attributes.
129 void minimum (CONTAINER &container,
130 KEY *&key_to_remove,
131 VALUE *&value_to_remove);
133 /// This is the default Cleanup Strategy for this utility.
134 CLEANUP_STRATEGY_BASE *cleanup_strategy_;
136 /// Whether the cleanup_strategy should be destroyed or not.
137 int delete_cleanup_strategy_;
139 private:
140 ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
141 ACE_UNIMPLEMENTED_FUNC (ACE_Recyclable_Handler_Caching_Utility (const ACE_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
144 ///////////////////////////////////////////////////////////////////////////
145 #define ACE_Refcounted_Recyclable_Handler_Caching_Utility ARRHUTIL
148 * @class ACE_Refcounted_Recyclable_Handler_Caching_Utility
150 * @brief Defines a helper class for the Caching Strategies.
152 * This class defines the methods commonly used by the different
153 * caching strategies. For instance: clear_cache () method which
154 * decides and purges the entry from the container. @note This
155 * class helps in the caching_strategies using a container
156 * containing entries of <Refcounted_KEY,
157 * Recyclable_Connection_Handler> kind. The attributes helps in
158 * deciding the entries to be purged. The Cleanup_Strategy is the
159 * callback class to which the entries to be cleaned up will be
160 * delegated.
162 template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
163 class ACE_Refcounted_Recyclable_Handler_Caching_Utility
166 public:
168 typedef ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
169 typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
171 /// Constructor.
172 ACE_Refcounted_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
173 int delete_cleanup_strategy = 0);
175 /// Destructor.
176 ~ACE_Refcounted_Recyclable_Handler_Caching_Utility (void);
179 * Purge entries from the <container>. The Cleanup_Strategy will do
180 * the actual job of cleanup once the entries to be cleaned up are
181 * decided.
183 int clear_cache (CONTAINER &container,
184 double purge_percent);
186 protected:
188 /// Find the entry with minimum caching attributes.
189 void minimum (CONTAINER &container,
190 KEY *&key_to_remove,
191 VALUE *&value_to_remove);
193 /// This is the default Cleanup Strategy for this utility.
194 CLEANUP_STRATEGY_BASE *cleanup_strategy_;
196 /// Whether the cleanup_strategy should be destroyed or not.
197 int delete_cleanup_strategy_;
200 * This figure denotes the number of entries are there in the
201 * container which have been marked as closed already but might
202 * not have been unbound from the container.
204 size_t marked_as_closed_entries_;
206 private:
207 ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Refcounted_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
208 ACE_UNIMPLEMENTED_FUNC (ACE_Refcounted_Recyclable_Handler_Caching_Utility (const ACE_Refcounted_Recyclable_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
211 ////////////////////////////////////////////////////////////////////////////////////////
214 * @class ACE_Handler_Caching_Utility
216 * @brief Defines a helper class for the Caching Strategies.
218 * This class defines the methods commonly used by the different
219 * caching strategies. For instance: <clear_cache> method which
220 * decides and purges the entry from the container. @note This
221 * class helps in the caching_strategies using a container
222 * containing entries of <KEY, HANDLER> kind where the HANDLER
223 * contains the caching attributes which help in deciding the
224 * entries to be purged. The Cleanup_Strategy is the callback
225 * class to which the entries to be cleaned up will be delegated.
227 template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
228 class ACE_Handler_Caching_Utility
230 public:
232 typedef ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
233 typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
235 /// Constructor.
236 ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
237 int delete_cleanup_strategy = 0);
239 /// Destructor.
240 ~ACE_Handler_Caching_Utility (void);
243 * Purge entries from the <container>. The Cleanup_Strategy will do
244 * the actual job of cleanup once the entries to be cleaned up are
245 * decided.
247 int clear_cache (CONTAINER &container,
248 double purge_percent);
250 protected:
253 * Find the entry with minimum caching attributes. This is handler
254 * specific since this utility is to be used very specifically for
255 * handler who have caching_attributes for server side acched
256 * connection management.
258 void minimum (CONTAINER &container,
259 KEY *&key_to_remove,
260 VALUE *&value_to_remove);
262 /// The cleanup strategy which can be used to destroy the entries of
263 /// the container.
264 CLEANUP_STRATEGY_BASE *cleanup_strategy_;
266 /// Whether the cleanup_strategy should be destroyed or not.
267 int delete_cleanup_strategy_;
269 private:
270 ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
271 ACE_UNIMPLEMENTED_FUNC (ACE_Handler_Caching_Utility (const ACE_Handler_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
274 ///////////////////////////////////////////////////////////////////////////
275 #define ACE_Null_Caching_Utility ANUTIL
277 * @class ACE_Null_Caching_Utility
279 * @brief Defines a dummy helper class for the Caching Strategies.
281 * This class defines the methods commonly used by the different
282 * caching strategies. For instance: <clear_cache> method which
283 * decides and purges the entry from the container. @note This
284 * class is be used with the Null_Caching_Strategy. The
285 * Cleanup_Strategy is the callback class to which the entries to
286 * be cleaned up will be delegated.
288 template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES>
289 class ACE_Null_Caching_Utility
291 public:
293 typedef ACE_Null_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY;
294 typedef ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> CLEANUP_STRATEGY_BASE;
296 /// Constructor.
297 ACE_Null_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy = 0,
298 int delete_cleanup_strategy = 0);
300 /// Destructor.
301 ~ACE_Null_Caching_Utility (void);
304 * Purge entries from the <container>. The Cleanup_Strategy will do
305 * the actual job of cleanup once the entries to be cleaned up are
306 * decided. @note Here it is a no-op.
308 int clear_cache (CONTAINER &container,
309 double purge_percent);
311 protected:
314 * Find the entry with minimum caching attributes. This is handler
315 * specific since this utility is to be used very specifically for
316 * handler who have caching_attributes for server side acched
317 * connection management.@note Here it is a no-op.
319 void minimum (CONTAINER &container,
320 KEY *&key_to_remove,
321 VALUE *&value_to_remove);
323 /// The cleanup strategy which can be used to destroy the entries of
324 /// the container.
325 CLEANUP_STRATEGY_BASE *cleanup_strategy_;
327 /// Whether the cleanup_strategy should be destroyed or not.
328 int delete_cleanup_strategy_;
330 private:
331 ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Null_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
332 ACE_UNIMPLEMENTED_FUNC (ACE_Null_Caching_Utility (const ACE_Null_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &))
335 ACE_END_VERSIONED_NAMESPACE_DECL
337 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
338 #include "ace/Caching_Utility_T.cpp"
339 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
341 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
342 #pragma implementation ("Caching_Utility_T.cpp")
343 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
345 #include /**/ "ace/post.h"
347 #endif /* ACE_CACHING_UTILITY_H */