00001
00002
00003
00004
00005
00006
00007 #include "ace/OS_Memory.h"
00008
00009 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00010
00011 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE
00012 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation,
00013 int delete_implementation)
00014 : implementation_ (implementation),
00015 delete_implementation_ (delete_implementation)
00016 {
00017 if (this->implementation_ == 0)
00018 {
00019 ACE_NEW (this->implementation_,
00020 IMPLEMENTATION);
00021 this->delete_implementation_ = 1;
00022 }
00023 }
00024
00025 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE
00026 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::~ACE_Caching_Strategy_Adapter (void)
00027 {
00028 if (this->delete_implementation_)
00029 {
00030 delete this->implementation_;
00031 this->delete_implementation_ = 0;
00032 this->implementation_ = 0;
00033 }
00034 }
00035
00036 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE ATTRIBUTES
00037 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::attributes (void)
00038 {
00039 return this->implementation_->attributes ();
00040 }
00041
00042 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE double
00043 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::purge_percent (void)
00044 {
00045 return this->implementation_->purge_percent ();
00046 }
00047
00048 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE void
00049 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::purge_percent (double percentage)
00050 {
00051 this->implementation_->purge_percent (percentage);
00052 }
00053
00054 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
00055 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_bind (int result,
00056 const ATTRIBUTES &attr)
00057 {
00058 return this->implementation_->notify_bind (result,
00059 attr);
00060 }
00061
00062 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
00063 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_find (int result,
00064 ATTRIBUTES &attr)
00065 {
00066 return this->implementation_->notify_find (result,
00067 attr);
00068 }
00069
00070 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
00071 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_unbind (int result,
00072 const ATTRIBUTES &attr)
00073 {
00074 return this->implementation_->notify_unbind (result,
00075 attr);
00076 }
00077
00078 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
00079 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_trybind (int result,
00080 ATTRIBUTES &attr)
00081 {
00082 return this->implementation_->notify_trybind (result,
00083 attr);
00084 }
00085
00086 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE int
00087 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::notify_rebind (int result,
00088 const ATTRIBUTES &attr)
00089 {
00090 return this->implementation_->notify_rebind (result,
00091 attr);
00092 }
00093
00094 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE IMPLEMENTATION &
00095 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::implementation (void)
00096 {
00097 return *this->implementation_;
00098 }
00099
00100 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE CACHING_UTILITY &
00101 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::caching_utility (void)
00102 {
00103 return this->implementation_->caching_utility ();
00104 }
00105
00106 template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE void
00107 ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::dump (void) const
00108 {
00109 #if defined (ACE_HAS_DUMP)
00110 ACE_TRACE ("ACE_Caching_Strategy_Adapter::dump");
00111
00112 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00113 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00114 #endif
00115 }
00116
00117
00118
00119 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
00120 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
00121 {
00122 return this->timer_;
00123 }
00124
00125 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
00126 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
00127 {
00128 return this->purge_percent_;
00129 }
00130
00131 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00132 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
00133 {
00134 this->purge_percent_ = percentage;
00135 }
00136
00137 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00138 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (
00139 int result,
00140 const ATTRIBUTES & )
00141 {
00142 if (result == 0)
00143 ++this->timer_;
00144
00145 return result;
00146 }
00147
00148 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00149 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (
00150 int result,
00151 ATTRIBUTES &attr)
00152 {
00153 if (result == 0)
00154 {
00155 attr = this->timer_;
00156 ++this->timer_;
00157 }
00158
00159 return result;
00160 }
00161
00162 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00163 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (
00164 int result,
00165 const ATTRIBUTES & )
00166 {
00167 return result;
00168 }
00169
00170 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00171 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (
00172 int result,
00173 ATTRIBUTES & )
00174 {
00175 return result;
00176 }
00177
00178 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00179 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (
00180 int result,
00181 const ATTRIBUTES & )
00182 {
00183 if (result == 0)
00184 ++this->timer_;
00185
00186 return result;
00187 }
00188
00189 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
00190 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
00191 {
00192 return this->caching_utility_;
00193 }
00194
00195 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00196 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
00197 {
00198 #if defined (ACE_HAS_DUMP)
00199 ACE_TRACE ("ACE_LRU_Caching_Strategy::dump");
00200
00201 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00202 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("timer_ = %d "), this->timer_));
00203 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00204 #endif
00205 }
00206
00207
00208
00209 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
00210 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
00211 {
00212 return 0;
00213 }
00214
00215 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
00216 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
00217 {
00218 return this->purge_percent_;
00219 }
00220
00221 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00222 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
00223 {
00224 this->purge_percent_ = percentage;
00225 }
00226
00227 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00228 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
00229 const ATTRIBUTES & )
00230 {
00231
00232 return result;
00233 }
00234
00235 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00236 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
00237 ATTRIBUTES &attr)
00238 {
00239 if (result == 0)
00240 ++attr;
00241
00242 return result;
00243 }
00244
00245 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00246 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
00247 ATTRIBUTES & )
00248 {
00249 return result;
00250 }
00251
00252 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00253 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
00254 const ATTRIBUTES & )
00255 {
00256 return result;
00257 }
00258
00259 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00260 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
00261 const ATTRIBUTES & )
00262 {
00263 return result;
00264 }
00265
00266 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
00267 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
00268 {
00269 return this->caching_utility_;
00270 }
00271
00272 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00273 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
00274 {
00275 #if defined (ACE_HAS_DUMP)
00276 ACE_TRACE ("ACE_LFU_Caching_Strategy::dump");
00277
00278 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00279 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00280 #endif
00281 }
00282
00283
00284
00285 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
00286 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
00287 {
00288 return this->order_;
00289 }
00290
00291 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
00292 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
00293 {
00294 return this->purge_percent_;
00295 }
00296
00297 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00298 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
00299 {
00300 this->purge_percent_ = percentage;
00301 }
00302
00303 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00304 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
00305 const ATTRIBUTES &attr)
00306 {
00307 ACE_UNUSED_ARG (attr);
00308
00309 if (result == 0)
00310 ++this->order_;
00311
00312 return result;
00313 }
00314
00315 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00316 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
00317 ATTRIBUTES &attr)
00318 {
00319 ACE_UNUSED_ARG (attr);
00320
00321 return result;
00322 }
00323
00324 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00325 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
00326 const ATTRIBUTES &attr)
00327 {
00328 ACE_UNUSED_ARG (attr);
00329
00330 return result;
00331 }
00332
00333 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00334 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
00335 ATTRIBUTES &attr)
00336 {
00337 ACE_UNUSED_ARG (attr);
00338
00339 return result;
00340 }
00341
00342 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00343 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
00344 const ATTRIBUTES &attr)
00345 {
00346 ACE_UNUSED_ARG (attr);
00347
00348 if (result == 0)
00349 ++this->order_;
00350
00351 return result;
00352 }
00353
00354 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
00355 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
00356 {
00357 return this->caching_utility_;
00358 }
00359
00360 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00361 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
00362 {
00363 #if defined (ACE_HAS_DUMP)
00364 ACE_TRACE ("ACE_FIFO_Caching_Strategy::dump");
00365
00366 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00367 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("order_ = %d "), this->order_));
00368 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00369 #endif
00370 }
00371
00372
00373
00374 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
00375 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
00376 {
00377 return 0;
00378 }
00379
00380 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
00381 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
00382 {
00383 return 0;
00384 }
00385
00386 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00387 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
00388 {
00389 ACE_UNUSED_ARG (percentage);
00390 }
00391
00392 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00393 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
00394 const ATTRIBUTES &attr)
00395 {
00396 ACE_UNUSED_ARG (attr);
00397
00398 return result;
00399 }
00400
00401 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00402 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
00403 ATTRIBUTES &attr)
00404 {
00405 ACE_UNUSED_ARG (attr);
00406
00407 return result;
00408 }
00409
00410 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00411 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
00412 const ATTRIBUTES &attr)
00413 {
00414 ACE_UNUSED_ARG (attr);
00415
00416 return result;
00417 }
00418
00419 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00420 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
00421 ATTRIBUTES &attr)
00422 {
00423 ACE_UNUSED_ARG (attr);
00424
00425 return result;
00426 }
00427
00428 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00429 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
00430 const ATTRIBUTES &attr)
00431 {
00432 ACE_UNUSED_ARG (attr);
00433
00434 return result;
00435 }
00436
00437 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
00438 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
00439 {
00440 return this->caching_utility_;
00441 }
00442
00443 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00444 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
00445 {
00446 #if defined (ACE_HAS_DUMP)
00447 ACE_TRACE ("ACE_Null_Caching_Strategy::dump");
00448
00449 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00450 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00451 #endif
00452 }
00453
00454 ACE_END_VERSIONED_NAMESPACE_DECL
00455
00456