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 (int result,
00139 const ATTRIBUTES &attr)
00140 {
00141 ACE_UNUSED_ARG (attr);
00142
00143 if (result == 0)
00144 ++this->timer_;
00145
00146 return result;
00147 }
00148
00149 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00150 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (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 (int result,
00164 const ATTRIBUTES &attr)
00165 {
00166 ACE_UNUSED_ARG (attr);
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 (int result,
00172 ATTRIBUTES &attr)
00173 {
00174 ACE_UNUSED_ARG (attr);
00175
00176 return result;
00177 }
00178
00179 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00180 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
00181 const ATTRIBUTES &attr)
00182 {
00183 ACE_UNUSED_ARG (attr);
00184
00185 if (result == 0)
00186 ++this->timer_;
00187
00188 return result;
00189 }
00190
00191 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
00192 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
00193 {
00194 return this->caching_utility_;
00195 }
00196
00197 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00198 ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
00199 {
00200 #if defined (ACE_HAS_DUMP)
00201 ACE_TRACE ("ACE_LRU_Caching_Strategy::dump");
00202
00203 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00204 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("timer_ = %d "), this->timer_));
00205 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00206 #endif
00207 }
00208
00209
00210
00211 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
00212 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
00213 {
00214 return 0;
00215 }
00216
00217 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
00218 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
00219 {
00220 return this->purge_percent_;
00221 }
00222
00223 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00224 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
00225 {
00226 this->purge_percent_ = percentage;
00227 }
00228
00229 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00230 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
00231 const ATTRIBUTES &attr)
00232 {
00233 ACE_UNUSED_ARG (attr);
00234
00235 return result;
00236 }
00237
00238 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00239 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
00240 ATTRIBUTES &attr)
00241 {
00242 if (result == 0)
00243 ++attr;
00244
00245 return result;
00246 }
00247
00248 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00249 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
00250 ATTRIBUTES &attr)
00251 {
00252 ACE_UNUSED_ARG (attr);
00253
00254 return result;
00255 }
00256
00257 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00258 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
00259 const ATTRIBUTES &attr)
00260 {
00261 ACE_UNUSED_ARG (attr);
00262
00263 return result;
00264 }
00265
00266 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00267 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
00268 const ATTRIBUTES &attr)
00269 {
00270 ACE_UNUSED_ARG (attr);
00271
00272 return result;
00273 }
00274
00275 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
00276 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
00277 {
00278 return this->caching_utility_;
00279 }
00280
00281 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00282 ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
00283 {
00284 #if defined (ACE_HAS_DUMP)
00285 ACE_TRACE ("ACE_LFU_Caching_Strategy::dump");
00286
00287 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00288 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00289 #endif
00290 }
00291
00292
00293
00294 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
00295 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
00296 {
00297 return this->order_;
00298 }
00299
00300 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
00301 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
00302 {
00303 return this->purge_percent_;
00304 }
00305
00306 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00307 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
00308 {
00309 this->purge_percent_ = percentage;
00310 }
00311
00312 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00313 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
00314 const ATTRIBUTES &attr)
00315 {
00316 ACE_UNUSED_ARG (attr);
00317
00318 if (result == 0)
00319 ++this->order_;
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_find (int result,
00326 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_unbind (int result,
00335 const 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_trybind (int result,
00344 ATTRIBUTES &attr)
00345 {
00346 ACE_UNUSED_ARG (attr);
00347
00348 return result;
00349 }
00350
00351 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00352 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
00353 const ATTRIBUTES &attr)
00354 {
00355 ACE_UNUSED_ARG (attr);
00356
00357 if (result == 0)
00358 ++this->order_;
00359
00360 return result;
00361 }
00362
00363 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
00364 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
00365 {
00366 return this->caching_utility_;
00367 }
00368
00369 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00370 ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
00371 {
00372 #if defined (ACE_HAS_DUMP)
00373 ACE_TRACE ("ACE_FIFO_Caching_Strategy::dump");
00374
00375 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00376 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("order_ = %d "), this->order_));
00377 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00378 #endif
00379 }
00380
00381
00382
00383 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE ATTRIBUTES
00384 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::attributes (void)
00385 {
00386 return 0;
00387 }
00388
00389 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE double
00390 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (void)
00391 {
00392 return 0;
00393 }
00394
00395 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00396 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double percentage)
00397 {
00398 ACE_UNUSED_ARG (percentage);
00399 }
00400
00401 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00402 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
00403 const 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_find (int result,
00412 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_unbind (int result,
00421 const 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_trybind (int result,
00430 ATTRIBUTES &attr)
00431 {
00432 ACE_UNUSED_ARG (attr);
00433
00434 return result;
00435 }
00436
00437 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
00438 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
00439 const ATTRIBUTES &attr)
00440 {
00441 ACE_UNUSED_ARG (attr);
00442
00443 return result;
00444 }
00445
00446 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE CACHING_UTILITY &
00447 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::caching_utility (void)
00448 {
00449 return this->caching_utility_;
00450 }
00451
00452 template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE void
00453 ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const
00454 {
00455 #if defined (ACE_HAS_DUMP)
00456 ACE_TRACE ("ACE_Null_Caching_Strategy::dump");
00457
00458 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00459 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00460 #endif
00461 }
00462
00463 ACE_END_VERSIONED_NAMESPACE_DECL
00464
00465