diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-11 01:00:50 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-11 01:00:50 +0000 |
commit | 29b2abf2ce7284b596329f3cba474e0fdbd74c18 (patch) | |
tree | 951844f70517ed556b0377c652b0a6ec7eae44a5 /ace/Caching_Strategies_T.cpp | |
parent | 353fe14773dbb689cfc69679f621b85597c9291a (diff) | |
download | ATCD-29b2abf2ce7284b596329f3cba474e0fdbd74c18.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace/Caching_Strategies_T.cpp')
-rw-r--r-- | ace/Caching_Strategies_T.cpp | 118 |
1 files changed, 35 insertions, 83 deletions
diff --git a/ace/Caching_Strategies_T.cpp b/ace/Caching_Strategies_T.cpp index 395b476a848..5d2871bebd0 100644 --- a/ace/Caching_Strategies_T.cpp +++ b/ace/Caching_Strategies_T.cpp @@ -15,7 +15,7 @@ ACE_RCSID(ace, Caching_Strategies_T, "$Id$") -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::ACE_LRU_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s, int delete_cleanup_strategy, CACHING_STRATEGY_UTILITY *utility_s, @@ -28,27 +28,27 @@ ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI caching_strategy_utility_ (0), delete_caching_strategy_utility_ (1) { - if (this->open (cleanup_s, + if (this->open (cleanup_s, delete_cleanup_strategy, - utility_s, + utility_s, delete_caching_strategy_utility) == -1) ACE_ERROR ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("ACE_LRU_Caching_Strategy::ACE_LRU_Caching_Strategy"))); - + } -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::~ACE_LRU_Caching_Strategy (void) { if (this->delete_cleanup_strategy_ == 1) delete this->cleanup_strategy_; if (this->delete_caching_strategy_utility_ == 1) - delete this->caching_strategy_utility_; + delete this->caching_strategy_utility_; } -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s, int delete_cleanup_strategy, CACHING_STRATEGY_UTILITY *utility_s, @@ -60,28 +60,21 @@ ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI if (this->cleanup_strategy_ != 0 && this->delete_cleanup_strategy_ == 1 && cleanup_s != 0) - { - delete this->cleanup_strategy_; - this->cleanup_strategy_ = 0; - this->delete_cleanup_strategy_ = delete_cleanup_strategy; - } if (cleanup_s != 0) this->cleanup_strategy_ = cleanup_s; else if (this->cleanup_strategy_ == 0) { - ACE_NEW_RETURN (this->cleanup_strategy_, CLEANUP_STRATEGY, -1); this->delete_cleanup_strategy_ = delete_cleanup_strategy; - } // Initialise the caching strategy utility. @@ -90,31 +83,24 @@ ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI if (this->caching_strategy_utility_ != 0 && this->delete_caching_strategy_utility_ == 1 && utility_s != 0) - { - delete this->caching_strategy_utility_; - this->caching_strategy_utility_ = 0; - this->delete_caching_strategy_utility_ = delete_caching_strategy_utility; - } if (utility_s != 0) this->caching_strategy_utility_ = utility_s; else if (this->caching_strategy_utility_ == 0) { - ACE_NEW_RETURN (this->caching_strategy_utility_, CACHING_STRATEGY_UTILITY, -1); this->delete_caching_strategy_utility_ = delete_caching_strategy_utility; - } - - return 0; + + return 0; } template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int @@ -130,16 +116,16 @@ template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHIN ACE_LRU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::clear_cache (CONTAINER &container, unsigned int &total_container_entries) { - + return this->caching_strategy_utility_->clear_cache (container, this->cleanup_strategy_, this->purge_percent_, total_container_entries); } - + //////////////////////////////////////////////////////////////////////////////////////////////// -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::ACE_LFU_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s, int delete_cleanup_strategy, CACHING_STRATEGY_UTILITY *utility_s, @@ -151,22 +137,22 @@ ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI caching_strategy_utility_ (0), delete_caching_strategy_utility_ (1) { - if (this->open (cleanup_s, - delete_cleanup_strategy, - utility_s, + if (this->open (cleanup_s, + delete_cleanup_strategy, + utility_s, delete_caching_strategy_utility) == -1) ACE_ERROR ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("ACE_LFU_Caching_Strategy::ACE_LFU_Caching_Strategy"))); - + } -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::~ACE_LFU_Caching_Strategy (void) { } -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s, int delete_cleanup_strategy, CACHING_STRATEGY_UTILITY *utility_s, @@ -179,65 +165,51 @@ ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI this->delete_cleanup_strategy_ == 1 && cleanup_s != 0) { - delete this->cleanup_strategy_; - this->cleanup_strategy_ = 0; - this->delete_cleanup_strategy_ = delete_cleanup_strategy; - } if (cleanup_s != 0) this->cleanup_strategy_ = cleanup_s; else if (this->cleanup_strategy_ == 0) { - ACE_NEW_RETURN (this->cleanup_strategy_, CLEANUP_STRATEGY, -1); this->delete_cleanup_strategy_ = delete_cleanup_strategy; - } - + // Initialise the caching strategy utility. // First we decide whether we need to clean up. if (this->caching_strategy_utility_ != 0 && this->delete_caching_strategy_utility_ == 1 && utility_s != 0) - { - delete this->caching_strategy_utility_; - this->caching_strategy_utility_ = 0; - this->delete_caching_strategy_utility_ = delete_caching_strategy_utility; - } if (utility_s != 0) this->caching_strategy_utility_ = utility_s; else if (this->caching_strategy_utility_ == 0) { - ACE_NEW_RETURN (this->caching_strategy_utility_, CACHING_STRATEGY_UTILITY, -1); this->delete_caching_strategy_utility_ = delete_caching_strategy_utility; - } - + return 0; } template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::clear_cache (CONTAINER &container) { - return this->caching_strategy_utility_->clear_cache (container, this->cleanup_strategy_, this->purge_percent_, @@ -248,7 +220,6 @@ template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHIN ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::clear_cache (CONTAINER &container, unsigned int &total_container_entries) { - return this->caching_strategy_utility_->clear_cache (container, this->cleanup_strategy_, this->purge_percent_, @@ -257,7 +228,7 @@ ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTI //////////////////////////////////////////////////////////////////////////////////////////////// -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::ACE_FIFO_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s, int delete_cleanup_strategy, CACHING_STRATEGY_UTILITY *utility_s, @@ -270,22 +241,22 @@ ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UT caching_strategy_utility_ (0), delete_caching_strategy_utility_ (1) { - if (this->open (cleanup_s, + if (this->open (cleanup_s, delete_cleanup_strategy, - utility_s, + utility_s, delete_caching_strategy_utility) == -1) ACE_ERROR ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("ACE_FIFO_Caching_Strategy::ACE_FIFO_Caching_Strategy"))); } -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::~ACE_FIFO_Caching_Strategy (void) { } -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s, int delete_cleanup_strategy, CACHING_STRATEGY_UTILITY *utility_s, @@ -298,65 +269,51 @@ ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UT this->delete_cleanup_strategy_ == 1 && cleanup_s != 0) { - delete this->cleanup_strategy_; - this->cleanup_strategy_ = 0; - this->delete_cleanup_strategy_ = delete_cleanup_strategy; - } if (cleanup_s != 0) this->cleanup_strategy_ = cleanup_s; else if (this->cleanup_strategy_ == 0) { - ACE_NEW_RETURN (this->cleanup_strategy_, - CLEANUP_STRATEGY, + CLEANUP_STRATEGY, -1); this->delete_cleanup_strategy_ = delete_cleanup_strategy; - } - + // Initialise the caching strategy utility. // First we decide whether we need to clean up. if (this->caching_strategy_utility_ != 0 && this->delete_caching_strategy_utility_ == 1 && utility_s != 0) - { - delete this->caching_strategy_utility_; - this->caching_strategy_utility_ = 0; - this->delete_caching_strategy_utility_ = delete_caching_strategy_utility; - } if (utility_s != 0) this->caching_strategy_utility_ = utility_s; else if (this->caching_strategy_utility_ == 0) { - ACE_NEW_RETURN (this->caching_strategy_utility_, CACHING_STRATEGY_UTILITY, -1); this->delete_caching_strategy_utility_ = delete_caching_strategy_utility; - } - - return 0; + + return 0; } template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::clear_cache (CONTAINER &container) { - return this->caching_strategy_utility_->clear_cache (container, this->cleanup_strategy_, this->purge_percent_, @@ -367,7 +324,6 @@ template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHIN ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::clear_cache (CONTAINER &container, unsigned int &total_container_entries) { - return this->caching_strategy_utility_->clear_cache (container, this->cleanup_strategy_, this->purge_percent_, @@ -377,7 +333,7 @@ ACE_FIFO_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UT //////////////////////////////////////////////////////////////////////////////////////////////// -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::ACE_Null_Caching_Strategy (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s, int delete_cleanup_strategy, CACHING_STRATEGY_UTILITY *utility_s, @@ -385,7 +341,7 @@ ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UT { } -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s, int delete_cleanup_strategy, CACHING_STRATEGY_UTILITY *utility_s, @@ -393,7 +349,7 @@ ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UT { } -template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> +template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::~ACE_Null_Caching_Strategy (void) { } @@ -406,9 +362,9 @@ ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UT template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY> int ACE_Null_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::clear_cache (CONTAINER &container, - unsigned int &total_container_entries) + unsigned int &total_container_entries) { - + return 0; } @@ -418,9 +374,5 @@ ACE_ALLOC_HOOK_DEFINE(ACE_LRU_Caching_Strategy) ACE_ALLOC_HOOK_DEFINE(ACE_LFU_Caching_Strategy) ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Caching_Strategy) ACE_ALLOC_HOOK_DEFINE(ACE_Null_Caching_Strategy) -#endif /* CACHING_STRATEGIES_T_C */ - - - - +#endif /* CACHING_STRATEGIES_T_C */ |