/*========================================================================== * * Copyright (C) 1995 - 2000 Microsoft Corporation. All Rights Reserved. * * File: OrderedArray.inl * Content: COrderedArray methods * * History: * Date By Reason * ====== == ====== * 12-12-2001 simonpow Created ***************************************************************************/ template BOOL COrderedArray::AddElements(const COrderedArray& array) { //ensure array isn't passed to itself DNASSERT(this!=&array); if (!m_data.AllocAtLeast(m_dwTopFreeSlot+array.GetNumElements())) return FALSE; m_data.SetExistingElements(m_dwTopFreeSlot, const_cast&>(array).GetAllElements(), array.GetNumElements()); m_dwTopFreeSlot+=array.GetNumElements(); return TRUE; } template BOOL COrderedArray::InsertElement(DWORD dwIndex, const T& elem) { DNASSERT(dwIndex<=m_dwTopFreeSlot); if (dwIndex==m_dwTopFreeSlot) return m_data.SetElement(m_dwTopFreeSlot++, elem); //move all the elements above index up one and insert the new element if (!m_data.MoveElements(dwIndex, m_dwTopFreeSlot-dwIndex, dwIndex+1, FALSE)) return FALSE; m_data.SetExistingElement(dwIndex, elem); m_dwTopFreeSlot++; return true; } template BOOL COrderedArray::InsertElements(DWORD dwIndex, const T * pElems, DWORD dwNumElem) { //ensure hole isn't created DNASSERT(dwIndex<=m_dwTopFreeSlot); //ensure pointer passed isn't into this arrays contents DNASSERT(!(pElems>=m_data.GetAllElements() && pElems BOOL COrderedArray::RemoveElementByValue(const T& elem) { for (DWORD dwLoop=0; dwLoop BOOL COrderedArray::FindElement(const T& elem, DWORD * pdwIndex) const { for (DWORD dwLoop=0; dwLoop