// -*-C++-*- // //$Id: Caching_Strategies_T.inl 96985 2013-04-11 15:50:32Z huangh $ ////////////////////////////////////////////////////////////////////////////////// #include "ace/OS_Memory.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL template ACE_INLINE ACE_Caching_Strategy_Adapter::ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation, bool delete_implementation) : implementation_ (implementation), delete_implementation_ (delete_implementation) { if (this->implementation_ == 0) { ACE_NEW (this->implementation_, IMPLEMENTATION); this->delete_implementation_ = true; } } template ACE_INLINE ACE_Caching_Strategy_Adapter::~ACE_Caching_Strategy_Adapter (void) { if (this->delete_implementation_) { delete this->implementation_; this->delete_implementation_ = false; this->implementation_ = 0; } } template ACE_INLINE ATTRIBUTES ACE_Caching_Strategy_Adapter::attributes (void) { return this->implementation_->attributes (); } template ACE_INLINE double ACE_Caching_Strategy_Adapter::purge_percent (void) { return this->implementation_->purge_percent (); } template ACE_INLINE void ACE_Caching_Strategy_Adapter::purge_percent (double percentage) { this->implementation_->purge_percent (percentage); } template ACE_INLINE int ACE_Caching_Strategy_Adapter::notify_bind (int result, const ATTRIBUTES &attr) { return this->implementation_->notify_bind (result, attr); } template ACE_INLINE int ACE_Caching_Strategy_Adapter::notify_find (int result, ATTRIBUTES &attr) { return this->implementation_->notify_find (result, attr); } template ACE_INLINE int ACE_Caching_Strategy_Adapter::notify_unbind (int result, const ATTRIBUTES &attr) { return this->implementation_->notify_unbind (result, attr); } template ACE_INLINE int ACE_Caching_Strategy_Adapter::notify_trybind (int result, ATTRIBUTES &attr) { return this->implementation_->notify_trybind (result, attr); } template ACE_INLINE int ACE_Caching_Strategy_Adapter::notify_rebind (int result, const ATTRIBUTES &attr) { return this->implementation_->notify_rebind (result, attr); } template ACE_INLINE IMPLEMENTATION & ACE_Caching_Strategy_Adapter::implementation (void) { return *this->implementation_; } template ACE_INLINE CACHING_UTILITY & ACE_Caching_Strategy_Adapter::caching_utility (void) { return this->implementation_->caching_utility (); } template ACE_INLINE void ACE_Caching_Strategy_Adapter::dump (void) const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Caching_Strategy_Adapter::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } ////////////////////////////////////////////////////////////////////////////////// template ACE_INLINE ATTRIBUTES ACE_LRU_Caching_Strategy::attributes (void) { return this->timer_; } template ACE_INLINE double ACE_LRU_Caching_Strategy::purge_percent (void) { return this->purge_percent_; } template ACE_INLINE void ACE_LRU_Caching_Strategy::purge_percent (double percentage) { this->purge_percent_ = percentage; } template ACE_INLINE int ACE_LRU_Caching_Strategy::notify_bind ( int result, const ATTRIBUTES & /* attr */) { if (result == 0) ++this->timer_; return result; } template ACE_INLINE int ACE_LRU_Caching_Strategy::notify_find ( int result, ATTRIBUTES &attr) { if (result == 0) { attr = this->timer_; ++this->timer_; } return result; } template ACE_INLINE int ACE_LRU_Caching_Strategy::notify_unbind ( int result, const ATTRIBUTES & /* attr */) { return result; } template ACE_INLINE int ACE_LRU_Caching_Strategy::notify_trybind ( int result, ATTRIBUTES & /* attr */) { return result; } template ACE_INLINE int ACE_LRU_Caching_Strategy::notify_rebind ( int result, const ATTRIBUTES & /* attr */) { if (result == 0) ++this->timer_; return result; } template ACE_INLINE CACHING_UTILITY & ACE_LRU_Caching_Strategy::caching_utility (void) { return this->caching_utility_; } template ACE_INLINE void ACE_LRU_Caching_Strategy::dump (void) const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_LRU_Caching_Strategy::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("timer_ = %d "), this->timer_)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } ////////////////////////////////////////////////////////////////////////////////// template ACE_INLINE ATTRIBUTES ACE_LFU_Caching_Strategy::attributes (void) { return 0; } template ACE_INLINE double ACE_LFU_Caching_Strategy::purge_percent (void) { return this->purge_percent_; } template ACE_INLINE void ACE_LFU_Caching_Strategy::purge_percent (double percentage) { this->purge_percent_ = percentage; } template ACE_INLINE int ACE_LFU_Caching_Strategy::notify_bind (int result, const ATTRIBUTES & /* attr */) { return result; } template ACE_INLINE int ACE_LFU_Caching_Strategy::notify_find (int result, ATTRIBUTES &attr) { if (result == 0) ++attr; return result; } template ACE_INLINE int ACE_LFU_Caching_Strategy::notify_trybind (int result, ATTRIBUTES & /* attr */) { return result; } template ACE_INLINE int ACE_LFU_Caching_Strategy::notify_rebind (int result, const ATTRIBUTES & /* attr */) { return result; } template ACE_INLINE int ACE_LFU_Caching_Strategy::notify_unbind (int result, const ATTRIBUTES & /* attr */) { return result; } template ACE_INLINE CACHING_UTILITY & ACE_LFU_Caching_Strategy::caching_utility (void) { return this->caching_utility_; } template ACE_INLINE void ACE_LFU_Caching_Strategy::dump (void) const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_LFU_Caching_Strategy::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } ////////////////////////////////////////////////////////////////////////////////////// template ACE_INLINE ATTRIBUTES ACE_FIFO_Caching_Strategy::attributes (void) { return this->order_; } template ACE_INLINE double ACE_FIFO_Caching_Strategy::purge_percent (void) { return this->purge_percent_; } template ACE_INLINE void ACE_FIFO_Caching_Strategy::purge_percent (double percentage) { this->purge_percent_ = percentage; } template ACE_INLINE int ACE_FIFO_Caching_Strategy::notify_bind (int result, const ATTRIBUTES &attr) { ACE_UNUSED_ARG (attr); if (result == 0) ++this->order_; return result; } template ACE_INLINE int ACE_FIFO_Caching_Strategy::notify_find (int result, ATTRIBUTES &attr) { ACE_UNUSED_ARG (attr); return result; } template ACE_INLINE int ACE_FIFO_Caching_Strategy::notify_unbind (int result, const ATTRIBUTES &attr) { ACE_UNUSED_ARG (attr); return result; } template ACE_INLINE int ACE_FIFO_Caching_Strategy::notify_trybind (int result, ATTRIBUTES &attr) { ACE_UNUSED_ARG (attr); return result; } template ACE_INLINE int ACE_FIFO_Caching_Strategy::notify_rebind (int result, const ATTRIBUTES &attr) { ACE_UNUSED_ARG (attr); if (result == 0) ++this->order_; return result; } template ACE_INLINE CACHING_UTILITY & ACE_FIFO_Caching_Strategy::caching_utility (void) { return this->caching_utility_; } template ACE_INLINE void ACE_FIFO_Caching_Strategy::dump (void) const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_FIFO_Caching_Strategy::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("order_ = %d "), this->order_)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } ////////////////////////////////////////////////////////////////////////////////// template ACE_INLINE ATTRIBUTES ACE_Null_Caching_Strategy::attributes (void) { return 0; } template ACE_INLINE double ACE_Null_Caching_Strategy::purge_percent (void) { return 0; } template ACE_INLINE void ACE_Null_Caching_Strategy::purge_percent (double percentage) { ACE_UNUSED_ARG (percentage); } template ACE_INLINE int ACE_Null_Caching_Strategy::notify_bind (int result, const ATTRIBUTES &attr) { ACE_UNUSED_ARG (attr); return result; } template ACE_INLINE int ACE_Null_Caching_Strategy::notify_find (int result, ATTRIBUTES &attr) { ACE_UNUSED_ARG (attr); return result; } template ACE_INLINE int ACE_Null_Caching_Strategy::notify_unbind (int result, const ATTRIBUTES &attr) { ACE_UNUSED_ARG (attr); return result; } template ACE_INLINE int ACE_Null_Caching_Strategy::notify_trybind (int result, ATTRIBUTES &attr) { ACE_UNUSED_ARG (attr); return result; } template ACE_INLINE int ACE_Null_Caching_Strategy::notify_rebind (int result, const ATTRIBUTES &attr) { ACE_UNUSED_ARG (attr); return result; } template ACE_INLINE CACHING_UTILITY & ACE_Null_Caching_Strategy::caching_utility (void) { return this->caching_utility_; } template ACE_INLINE void ACE_Null_Caching_Strategy::dump (void) const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Null_Caching_Strategy::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } ACE_END_VERSIONED_NAMESPACE_DECL //////////////////////////////////////////////////////////////////////////////////