Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Caching_Strategies_T.inl
blob429b7cf23e9d463d681d56aae6fb03f04f224842
1 // -*-C++-*-
2 //
3 //////////////////////////////////////////////////////////////////////////////////
5 #include "ace/OS_Memory.h"
7 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
9 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE
10 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation,
11                                                                                                          bool delete_implementation)
12   : implementation_ (implementation),
13     delete_implementation_ (delete_implementation)
15   if (this->implementation_ == 0)
16     {
17       ACE_NEW (this->implementation_,
18                IMPLEMENTATION);
19       this->delete_implementation_ = true;
20     }
23 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE
24 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::~ACE_Caching_Strategy_Adapter ()
26   if (this->delete_implementation_)
27     {
28       delete this->implementation_;
29       this->delete_implementation_ = false;
30       this->implementation_ = 0;
31     }
34 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE ATTRIBUTES
35 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::attributes ()
37   return this->implementation_->attributes ();
40 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE double
41 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::purge_percent ()
43   return this->implementation_->purge_percent ();
46 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE void
47 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::purge_percent (double percentage)
49   this->implementation_->purge_percent (percentage);
52 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
53 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_bind (int result,
54                                                                                         const ATTRIBUTES &attr)
56   return this->implementation_->notify_bind (result,
57                                              attr);
60 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
61 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_find (int result,
62                                                                                         ATTRIBUTES &attr)
64   return this->implementation_->notify_find (result,
65                                              attr);
68 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
69 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_unbind (int result,
70                                                                                           const ATTRIBUTES &attr)
72   return this->implementation_->notify_unbind (result,
73                                                attr);
76 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
77 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_trybind (int result,
78                                                                                            ATTRIBUTES &attr)
80   return this->implementation_->notify_trybind (result,
81                                                 attr);
84 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
85 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_rebind (int result,
86                                                                                           const ATTRIBUTES &attr)
88   return this->implementation_->notify_rebind (result,
89                                                attr);
92 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE IMPLEMENTATION &
93 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::implementation ()
95   return *this->implementation_;
98 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE CACHING_UTILITY &
99 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::caching_utility ()
101   return this->implementation_->caching_utility ();
104 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE void
105 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::dump () const
107 #if defined (ACE_HAS_DUMP)
108   ACE_TRACE ("ACE_Caching_Strategy_Adapter::dump");
110   ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
111   ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
112 #endif /* ACE_HAS_DUMP */
115 //////////////////////////////////////////////////////////////////////////////////
117 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
118 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes ()
120   return this->timer_;
123 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
124 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent ()
126   return this->purge_percent_;
129 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
130 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
132   this->purge_percent_ = percentage;
135 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
136 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (
137   int result,
138   const ATTRIBUTES & /* attr */)
140   if (result == 0)
141     ++this->timer_;
143   return result;
146 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
147 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (
148   int result,
149   ATTRIBUTES &attr)
151   if (result == 0)
152     {
153       attr = this->timer_;
154       ++this->timer_;
155     }
157   return result;
160 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
161 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (
162   int result,
163   const ATTRIBUTES & /* attr */)
165   return result;
168 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
169 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (
170   int result,
171   ATTRIBUTES & /* attr */)
173   return result;
176 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
177 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (
178   int result,
179   const ATTRIBUTES & /* attr */)
181   if (result == 0)
182     ++this->timer_;
184   return result;
187 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
188 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility ()
190   return this->caching_utility_;
193 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
194 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump () const
196 #if defined (ACE_HAS_DUMP)
197   ACE_TRACE ("ACE_LRU_Caching_Strategy::dump");
199   ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
200   ACELIB_DEBUG ((LM_DEBUG,  ACE_TEXT ("timer_ = %d "), this->timer_));
201   ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
202 #endif /* ACE_HAS_DUMP */
205 //////////////////////////////////////////////////////////////////////////////////
207 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
208 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes ()
210   return 0;
213 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
214 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent ()
216   return this->purge_percent_;
219 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
220 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
222   this->purge_percent_ = percentage;
225 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
226 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
227                                                                     const ATTRIBUTES & /* attr */)
230   return result;
233 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
234 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
235                                                                     ATTRIBUTES &attr)
237   if (result == 0)
238     ++attr;
240   return result;
243 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
244 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
245                                                                        ATTRIBUTES & /* attr */)
247   return result;
250 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
251 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
252                                                                       const ATTRIBUTES & /* attr */)
254   return result;
257 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
258 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
259                                                                       const ATTRIBUTES & /* attr */)
261   return result;
264 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
265 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility ()
267   return this->caching_utility_;
270 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
271 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump () const
273 #if defined (ACE_HAS_DUMP)
274   ACE_TRACE ("ACE_LFU_Caching_Strategy::dump");
276   ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
277   ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
278 #endif /* ACE_HAS_DUMP */
281 //////////////////////////////////////////////////////////////////////////////////////
283 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
284 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes ()
286   return this->order_;
289 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
290 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent ()
292   return this->purge_percent_;
295 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
296 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
298   this->purge_percent_ = percentage;
301 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
302 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
303                                                                      const ATTRIBUTES &attr)
305   ACE_UNUSED_ARG (attr);
307   if (result == 0)
308     ++this->order_;
310   return result;
313 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
314 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
315                                                                      ATTRIBUTES &attr)
317   ACE_UNUSED_ARG (attr);
319   return result;
322 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
323 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
324                                                                        const ATTRIBUTES &attr)
326   ACE_UNUSED_ARG (attr);
328   return result;
331 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
332 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
333                                                                         ATTRIBUTES &attr)
335   ACE_UNUSED_ARG (attr);
337   return result;
340 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
341 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
342                                                                        const ATTRIBUTES &attr)
344   ACE_UNUSED_ARG (attr);
346   if (result == 0)
347     ++this->order_;
349   return result;
352 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
353 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility ()
355   return this->caching_utility_;
358 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
359 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump () const
361 #if defined (ACE_HAS_DUMP)
362   ACE_TRACE ("ACE_FIFO_Caching_Strategy::dump");
364   ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
365   ACELIB_DEBUG ((LM_DEBUG,  ACE_TEXT ("order_ = %d "), this->order_));
366   ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
367 #endif /* ACE_HAS_DUMP */
370 //////////////////////////////////////////////////////////////////////////////////
372 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
373 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes ()
375   return 0;
378 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
379 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent ()
381   return 0;
384 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
385 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
387   ACE_UNUSED_ARG (percentage);
390 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
391 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
392                                                                      const ATTRIBUTES &attr)
394   ACE_UNUSED_ARG (attr);
396   return result;
399 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
400 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
401                                                                      ATTRIBUTES &attr)
403   ACE_UNUSED_ARG (attr);
405   return result;
408 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
409 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
410                                                                        const ATTRIBUTES &attr)
412   ACE_UNUSED_ARG (attr);
414   return result;
417 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
418 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
419                                                                         ATTRIBUTES &attr)
421   ACE_UNUSED_ARG (attr);
423   return result;
426 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
427 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
428                                                                        const ATTRIBUTES &attr)
430   ACE_UNUSED_ARG (attr);
432   return result;
435 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
436 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility ()
438   return this->caching_utility_;
441 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
442 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump () const
444 #if defined (ACE_HAS_DUMP)
445   ACE_TRACE ("ACE_Null_Caching_Strategy::dump");
447   ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
448   ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
449 #endif /* ACE_HAS_DUMP */
452 ACE_END_VERSIONED_NAMESPACE_DECL
454 //////////////////////////////////////////////////////////////////////////////////