summaryrefslogtreecommitdiff
path: root/ace/Caching_Strategies_T.cpp
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-12 19:20:35 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-12 19:20:35 +0000
commit5cfb4bb5ed96220ac41075f64c56288f587ea894 (patch)
tree4152f0e4a98529cb2b54703bf873c9371a83af24 /ace/Caching_Strategies_T.cpp
parent288a68560e3b423ce5b02d4e48675ba7d6df505b (diff)
downloadATCD-5cfb4bb5ed96220ac41075f64c56288f587ea894.tar.gz
ChangeLogTag:Mon Jul 12 13:54:34 1999 Kirthika Parameswaran <kirthika@cs.wustl.edu>
Diffstat (limited to 'ace/Caching_Strategies_T.cpp')
-rw-r--r--ace/Caching_Strategies_T.cpp350
1 files changed, 11 insertions, 339 deletions
diff --git a/ace/Caching_Strategies_T.cpp b/ace/Caching_Strategies_T.cpp
index 532064ae23e..f36d593ad84 100644
--- a/ace/Caching_Strategies_T.cpp
+++ b/ace/Caching_Strategies_T.cpp
@@ -15,367 +15,39 @@
ACE_RCSID(ace, Caching_Strategies_T, "$Id$")
-template<class KEY, class VALUE, class CONTAINER, class ATTRIBUTES, class CACHING_STRATEGY_UTILITY>
-ACE_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::~ACE_Caching_Strategy (void)
+template<class ATTRIBUTES, class CACHING_UTILITY>
+ACE_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::~ACE_Caching_Strategy (void)
{
}
//////////////////////////////////////////////////////////////////////////////////
-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,
- int delete_caching_strategy_utility)
+template<class ATTRIBUTES, class CACHING_UTILITY>
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::ACE_LRU_Caching_Strategy (void)
: timer_ (0),
- purge_percent_ (10),
- entries_ (0),
- cleanup_strategy_ (0),
- delete_cleanup_strategy_ (1),
- caching_strategy_utility_ (0),
- delete_caching_strategy_utility_ (1)
+ purge_percent_ (10)
{
- 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_LRU_Caching_Strategy::ACE_LRU_Caching_Strategy")));
-
-}
-
-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_;
- this->delete_cleanup_strategy_ = 0;
- this->cleanup_strategy_ = 0;
-
- if (this->delete_caching_strategy_utility_ == 1)
- delete this->caching_strategy_utility_;
- this->delete_caching_strategy_utility_ = 0;
- this->caching_strategy_utility_ = 0;
-}
-
-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,
- int delete_caching_strategy_utility)
-{
- // Initialise the cleanup strategy.
-
- // First we decide whether we need to clean up.
- 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_ = 0;
- }
-
- if (cleanup_s != 0)
- {
- this->cleanup_strategy_ = cleanup_s;
- this->delete_cleanup_strategy_ = delete_cleanup_strategy;
- }
- else if (this->cleanup_strategy_ == 0)
- {
- ACE_NEW_RETURN (this->cleanup_strategy_,
- CLEANUP_STRATEGY,
- -1);
-
- this->delete_cleanup_strategy_ = 1;
- }
-
- // 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_ = 0;
- }
-
- if (utility_s != 0)
- {
- this->caching_strategy_utility_ = utility_s;
- this->delete_caching_strategy_utility_ = delete_caching_strategy_utility;
- }
- else if (this->caching_strategy_utility_ == 0)
- {
- ACE_NEW_RETURN (this->caching_strategy_utility_,
- CACHING_STRATEGY_UTILITY,
- -1);
-
- this->delete_caching_strategy_utility_ = 1;
- }
-
- return 0;
-}
-
-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>::clear_cache (CONTAINER &container)
-{
- return this->caching_strategy_utility_->clear_cache (container,
- this->cleanup_strategy_,
- this->purge_percent_);
}
////////////////////////////////////////////////////////////////////////////////////////////////
-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,
- int delete_caching_strategy_utility)
- : purge_percent_ (10),
- entries_ (0),
- cleanup_strategy_ (0),
- delete_cleanup_strategy_ (1),
- caching_strategy_utility_ (0),
- delete_caching_strategy_utility_ (1)
-{
- 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>
-ACE_LFU_Caching_Strategy<KEY, VALUE, CONTAINER, ATTRIBUTES, CACHING_STRATEGY_UTILITY>::~ACE_LFU_Caching_Strategy (void)
-{
- if (this->delete_cleanup_strategy_ == 1)
- delete this->cleanup_strategy_;
- this->delete_cleanup_strategy_ = 0;
- this->cleanup_strategy_ = 0;
-
- if (this->delete_caching_strategy_utility_ == 1)
- delete this->caching_strategy_utility_;
- this->delete_caching_strategy_utility_ = 0;
- this->caching_strategy_utility_ = 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>::open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
- int delete_cleanup_strategy,
- CACHING_STRATEGY_UTILITY *utility_s,
- int delete_caching_strategy_utility)
-{
- // Initialise the cleanup strategy.
-
- // First we decide whether we need to clean up.
- 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_ = 1;
- }
-
- // 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_ = 1;
- }
-
- 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)
+template<class ATTRIBUTES, class CACHING_UTILITY>
+ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::ACE_LFU_Caching_Strategy (void)
+ : purge_percent_ (10)
{
- return this->caching_strategy_utility_->clear_cache (container,
- this->cleanup_strategy_,
- this->purge_percent_);
}
-
////////////////////////////////////////////////////////////////////////////////////////////////
-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,
- int delete_caching_strategy_utility)
+template<class ATTRIBUTES, class CACHING_UTILITY>
+ACE_FIFO_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::ACE_FIFO_Caching_Strategy (void)
: order_ (0),
- purge_percent_ (10),
- entries_ (0),
- cleanup_strategy_ (0),
- delete_cleanup_strategy_ (1),
- caching_strategy_utility_ (0),
- delete_caching_strategy_utility_ (1)
-{
- 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_FIFO_Caching_Strategy::ACE_FIFO_Caching_Strategy")));
-}
-
-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)
-
+ purge_percent_ (10)
{
- if (this->delete_cleanup_strategy_ == 1)
- delete this->cleanup_strategy_;
- this->delete_cleanup_strategy_ = 0;
- this->cleanup_strategy_ = 0;
-
- if (this->delete_caching_strategy_utility_ == 1)
- delete this->caching_strategy_utility_;
- this->delete_caching_strategy_utility_ = 0;
- this->caching_strategy_utility_ = 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>::open (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_s,
- int delete_cleanup_strategy,
- CACHING_STRATEGY_UTILITY *utility_s,
- int delete_caching_strategy_utility)
-{
- // Initialise the cleanup strategy.
-
- // First we decide whether we need to clean up.
- 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_ = 1;
- }
-
- // 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_ = 1;
- }
-
- 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_);
}
////////////////////////////////////////////////////////////////////////////////////////////////
-
-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,
- int delete_caching_strategy_utility)
-{
- ACE_UNUSED_ARG (cleanup_s);
- ACE_UNUSED_ARG (delete_cleanup_strategy);
- ACE_UNUSED_ARG (utility_s);
- ACE_UNUSED_ARG (delete_caching_strategy_utility);
-}
-
-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,
- int delete_caching_strategy_utility)
-{
- ACE_UNUSED_ARG (cleanup_s);
- ACE_UNUSED_ARG (delete_cleanup_strategy);
- ACE_UNUSED_ARG (utility_s);
- ACE_UNUSED_ARG (delete_caching_strategy_utility);
-
- return 0;
-}
-
-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)
-{
-}
-
-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)
-{
- ACE_UNUSED_ARG (container);
-
- return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-
ACE_ALLOC_HOOK_DEFINE(ACE_LRU_Caching_Strategy)
ACE_ALLOC_HOOK_DEFINE(ACE_LFU_Caching_Strategy)
ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Caching_Strategy)