Example #1
0
template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>::close (void)
{
  while (this->waterlevel_ > 0)
    this->FLUSH_i ();

  if (this->hash_)
    {

      ACE_DES_FREE_TEMPLATE3(this->hash_, this->allocator_->free,
                             JAWS_Cache_Hash,
                             KEY, HASH_FUNC, EQ_FUNC);



      this->hash_ = 0;
    }

  if (this->heap_)
    {

      ACE_DES_FREE_TEMPLATE4(this->heap_, this->allocator_->free,
                             JAWS_Cache_List,
                             KEY, FACTORY, HASH_FUNC, EQ_FUNC);



      this->heap_ = 0;
    }

  return 0;
}
template <class EXT_ID, class FACT, class H_FN, class E_FN> int
JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::remove (void *item)
{
  if (item == 0)
    return 0;

  this->remove_i ((Cache_List_Item *) item);
  this->item_->int_id_->heap_item (0);


  ACE_DES_FREE_TEMPLATE4(this->item_, this->allocator_->free,
                         JAWS_Cache_List_Item,
                         EXT_ID, FACT, H_FN, E_FN);



  this->item_ = 0;

  return 0;
}
Example #3
0
JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::~JAWS_Cache_Heap (void)
{
  if (this->heap_ != 0)
    {
      for (size_t i = 0; i < this->maxsize_; i++)
        {
          if (this->heap_[i])
            {
              ACE_DES_FREE_TEMPLATE4(this->heap_[i], this->allocator_->free,
                                     JAWS_Cache_Heap_Item,
                                     EXT_ID, FACT, H_FN, E_FN);

              this->heap_[i] = 0;
            }
        }
      this->allocator_->free (this->heap_);
      this->heap_ = 0;
    }

  this->allocator_ = 0;
}
Example #4
0
template <class EXT_ID, class FACT, class H_FN, class E_FN> int
JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::remove (EXT_ID &ext_id,
                                               JAWS_Cache_Object *&int_id)
{
  if (this->is_empty ())
    return -1;

  Cache_Heap_Item *item = this->heap_[0];
  item->int_id_->heap_item (0);

  this->remove_i ();

  ext_id = item->ext_id_;
  int_id = item->int_id_;

  ACE_DES_FREE_TEMPLATE4(item, this->allocator_->free,
                         JAWS_Cache_Heap_Item,
                         EXT_ID, FACT, H_FN, E_FN);

  item = 0;
  return 0;
}
Example #5
0
template <class EXT_ID, class FACT, class H_FN, class E_FN> int
JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::remove (void *item)
{
  if (item == 0)
    return 0;

  Cache_Heap_Item *real_item = (Cache_Heap_Item *) item;

  // Make sure the item is where it thinks it is.
  if (this->heap_[real_item->heap_idx_] != real_item)
    return -1;

  real_item->int_id_->heap_item (0);
  this->remove_i (real_item->heap_idx_);

  ACE_DES_FREE_TEMPLATE4(real_item, this->allocator_->free,
                         JAWS_Cache_Heap_Item,
                         EXT_ID, FACT, H_FN, E_FN);

  real_item = 0;

  return 0;
}