Node<Key, Val>* DeleteInternal(Node<Key, Val>* h, Key key){ if (h == NULL) return NULL; if (Comp()(key, h->key)){ if (!IsRED(h->left) && h->left != NULL && !IsRED(h->left->left)){ h = MoveREDLeft(h); } h->left = DeleteInternal(h->left, key); } else { if (IsRED(h->left)){ h = RotateRight(h); } if ((key == h->key) && (h->right == NULL)){ return NULL; } if (!IsRED(h->right) && h->right != NULL && !IsRED(h->right->left)){ h = MoveREDRight(h); } if (key == h->key){ Node<Key, Val>* min_node = GetMin(h->right); h->key = min_node->key; h->val = min_node->val; h->right = DeleteMin(h->right); } else { h->right = DeleteInternal(h->right, key); } } return FixUp(h); }
void CModelPool::Destroy() { // Pool Pool.clear (); // Registry while(!Registry.empty()){ REGISTRY_IT it = Registry.begin(); dxRender_Visual* V=(dxRender_Visual*)it->first; #ifdef _DEBUG Msg ("ModelPool: Destroy object: '%s'",*V->dbg_name); #endif DeleteInternal (V,TRUE); } // Base/Reference xr_vector<ModelDef>::iterator I = Models.begin(); xr_vector<ModelDef>::iterator E = Models.end(); for (; I!=E; I++) { I->model->Release(); xr_delete(I->model); } Models.clear(); // cleanup motions container g_pMotionsContainer->clean(false); }
void Delete(Key key){ root_ = DeleteInternal(root_, key); if (root_ != NULL){ root_->color = kBLACK; } --num_; }
void CZipArchive::DeleteFiles(CWordArray &aIndexes) { if (IsClosed()) { TRACE(_T("ZipArchive is closed.\n")); return; } if (m_storage.IsSpanMode()) { TRACE(_T("You cannot delete files from the disk spannig archive.\n")); return; } if (m_iFileOpened) { TRACE(_T("You cannot delete files if there is a file opened.\n")); return; } // sorting the index table using qsort int uSize = aIndexes.GetSize(); if (!uSize) return; qsort((void*)&aIndexes[0], uSize, sizeof(WORD), CompareWords); m_centralDir.RemoveFromDisk(); m_info.Init(); // remove in a reverse order for (int i = uSize - 1; i >= 0; i--) DeleteInternal(aIndexes[i]); m_info.m_pBuffer.Release(); }
void CModelPool::Delete (dxRender_Visual* &V, BOOL bDiscard) { if (NULL==V) return; if (g_bRendering){ VERIFY (!bDiscard); ModelsToDelete.push_back(V); } else { DeleteInternal (V,bDiscard); } V = NULL; }
bool CZipArchive::DeleteFile(WORD uIndex) { if (m_storage.IsSpanMode()) { TRACE(_T("You cannot delete files from the disk spannig archive.\n")); return false; } if (m_iFileOpened) { TRACE(_T("You cannot delete files if there is a file opened.\n")); return false; } if (!m_centralDir.IsValidIndex(uIndex)) return false; m_info.Init(); m_centralDir.RemoveFromDisk(); DeleteInternal(uIndex); m_info.m_pBuffer.Release(); return true; }
void CModelPool::DeleteQueue () { for (u32 it=0; it<ModelsToDelete.size(); it++) DeleteInternal(ModelsToDelete[it]); ModelsToDelete.clear (); }