void CObBinTree::GetArray( CObArray& array ) { array.SetSize( 0 ); WalkTree( StoreInArray, (LPVOID)&array, TV_INORDER ); ASSERT( array.GetSize()==GetCount() ); }
void CDiagramEntityContainer::Reorder( const CUIntArray &order ) { if (order.GetSize() != GetSize()) return; CObArray temp; temp.SetSize( order.GetSize() ); for (int i = 0; i < order.GetSize(); i++) temp[order[i]] = m_objs[i]; m_objs.Copy( temp ); SetModified( TRUE); }
// ************************************************************************** // OnOpenDocument () // // Description: // Open document event handler. // // Parameters: // none // // Returns: // BOOL - TRUE if success. // ************************************************************************** BOOL CKDocument::OnOpenDocument (LPCTSTR lpszPathName) { // Perform default processing: if (!CDocument::OnOpenDocument (lpszPathName)) return (FALSE); // Must do some additional work if we have a server object: if (m_pServerHead) { // Update status bar text to indicate we are loading project: CKStatusBarText cText (IDS_LOADING_PROJECT); // Update all views so the user can see progress: UpdateAllViews (NULL, HINT_LOAD_PROJECT, m_pServerHead); // Build a list of servers to load to pass along to a worker thread // for processing: CObArray cServerList; // Catch memory exceptions that could get thrown by object array: try { // Allocate memory for array of server objects: cServerList.SetSize (m_cdwServers); // Create a CKServer pointer and set it to first server in linked list: CKServer *pServer = m_pServerHead; // Loop over servers in linked list: for (DWORD dw = 0; dw < m_cdwServers; dw++) { // Put pointer to server in object array: ASSERT (pServer); cServerList [dw] = (CObArray *)pServer; // Get next server in linked list: pServer = pServer->GetNext (); } ASSERT (pServer == NULL); // list and count in sync ? } catch (CMemoryException *e) { // If memory exception thrown, delet exception object and return FALSE // to indicate failure. e->Delete (); return (FALSE); } // Fill a structre to pass along to worker thread. Structure will // contain a pointer to out list of servers and task specification // (start multiple servers). WORKERTHREADARG tArg; tArg.eTask = WORKERTHREADARG::START_MULTIPLE_SERVER; tArg.pvObjectA = (void *)&cServerList; // Run the worker thread to start all server connections: RunWorkerThread (&tArg); } // If we make it here, all went OK, so return TRUE: return (TRUE); }
void CuDlgParameterInstallationExtra::RefreshParameter() { try { int nTopIndex = m_cListCtrl.GetTopIndex(); m_cListCtrl.HideProperty(FALSE); m_cListCtrl.DeleteAllItems(); while (!m_listParameter.IsEmpty()) delete m_listParameter.RemoveHead(); if (theApp.m_ingresVariable.QueryEnvironment (m_listParameter, FALSE, TRUE)) { // // Sort the parameter: CaEnvironmentParameter* pParam = NULL; CObArray a; int i, indx, nCount = 0; if (!m_listParameter.IsEmpty()) { a.SetSize(m_listParameter.GetCount()); POSITION pos = m_listParameter.GetHeadPosition(); while (pos != NULL) { pParam = (CaEnvironmentParameter*)m_listParameter.GetNext(pos); if (pParam->GetName().CompareNoCase(_T("II_NUM_OF_PROCESSORS"))==0) pParam->LoadDescription(IDS_II_NUM_OF_PROCESSORS); else if (pParam->GetName().CompareNoCase(_T("II_MAX_SEM_LOOPS"))==0) pParam->LoadDescription(IDS_II_MAX_SEM_LOOPS); a[nCount] = pParam; nCount++; } if (a.GetSize() > 1) IVM_DichotomySort(a, CompareSubItem, (LPARAM)&m_sortparam, NULL); } else return; for (i=0; i< a.GetSize(); i++) { pParam = (CaEnvironmentParameter*)a[i]; nCount = m_cListCtrl.GetItemCount(); indx = m_cListCtrl.InsertItem (nCount, pParam->GetName(), IM_ENV_SYSTEM); if (indx != -1) { m_cListCtrl.SetItemText (indx, 1, pParam->GetValue()); m_cListCtrl.SetItemText (indx, 2, pParam->GetDescription()); m_cListCtrl.SetItemData (indx, (DWORD_PTR)pParam); } } if (nTopIndex != -1) { CRect r; m_cListCtrl.GetItemRect (0, r, LVIR_BOUNDS); m_cListCtrl.Scroll (CSize(0, nTopIndex*r.Height())); } } } catch (...) { AfxMessageBox (_T("System error (CuDlgParameterInstallationExtra::RefreshParameter): \nRefresh parameter failed")); } }