sl@0: // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\euser\us_que.cpp sl@0: // sl@0: // sl@0: sl@0: #include "us_std.h" sl@0: sl@0: EXPORT_C void TSglQueLink::Enque(TSglQueLink* aLink) sl@0: // sl@0: // Enque this after aLink. sl@0: // sl@0: { sl@0: sl@0: iNext=aLink->iNext; sl@0: aLink->iNext=this; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueLinkBase::Enque(TDblQueLinkBase* aLink) sl@0: /** sl@0: Inserts this link object after the specified link object. sl@0: sl@0: The specified link object must already be in the doubly linked list. sl@0: sl@0: The function cannot be used to insert a list element into the beginning or sl@0: end of a doubly linked list; this is handled by the TDblQue::AddFirst() sl@0: and TDblQue::AddLast() functions. sl@0: sl@0: @param aLink A pointer to the link object embedded within the list element sl@0: to which this link object is to be connected. It must not be NULL. sl@0: sl@0: @see TDblQue sl@0: */ sl@0: { sl@0: sl@0: iNext=aLink->iNext; sl@0: iPrev=aLink; sl@0: aLink->iNext->iPrev=this; sl@0: aLink->iNext=this; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueLinkBase::AddBefore(TDblQueLinkBase* aLink) sl@0: /** sl@0: Inserts this link object before the specified link object. sl@0: sl@0: The specified link object must already be in the doubly linked list. sl@0: sl@0: The function cannot be used to insert a list element into the beginning or sl@0: end of a doubly linked list; this is handled by the TDblQue::AddFirst() sl@0: and TDblQue::AddLast() functions. sl@0: sl@0: @param aLink A pointer to the link object embedded within the list element sl@0: to which this link object is to be connected. It must not be NULL. sl@0: sl@0: @see TDblQue sl@0: */ sl@0: { sl@0: sl@0: iNext=aLink; sl@0: iPrev=aLink->iPrev; sl@0: aLink->iPrev->iNext=this; sl@0: aLink->iPrev=this; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueLink::Deque() sl@0: /** sl@0: Removes this link object from the doubly linked list. sl@0: sl@0: In effect, this removes the list element that acts as host to this link object sl@0: from the doubly linked list. sl@0: sl@0: The link object can be any in the doubly linked list. sl@0: sl@0: It is safe to use this method on an object which has already been removed from the list. sl@0: sl@0: @post iNext member is set to NULL sl@0: */ sl@0: { sl@0: sl@0: if (iNext) sl@0: { sl@0: iPrev->iNext=iNext; sl@0: iNext->iPrev=iPrev; sl@0: iNext=NULL; sl@0: } sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TSglQueBase::TSglQueBase() sl@0: : iHead(NULL),iLast((TSglQueLink*)&iHead),iOffset(0) sl@0: /** sl@0: Default constructor. sl@0: sl@0: It sets: sl@0: sl@0: 1. iHead to Null. sl@0: sl@0: 2. iLast to point to the head of queue. sl@0: sl@0: 3. iOffset to zero. sl@0: sl@0: @see iHead sl@0: @see iLast sl@0: @see iOffset sl@0: */ sl@0: {} sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TSglQueBase::TSglQueBase(TInt aOffset) sl@0: : iHead(NULL),iLast((TSglQueLink*)&iHead),iOffset(aOffset) sl@0: /** sl@0: Constructor with specified offset. sl@0: sl@0: It sets: sl@0: sl@0: 1. iHead to Null sl@0: sl@0: 2. iLast to point to the head of queue. sl@0: sl@0: 3. iOffset to the specified value. sl@0: sl@0: @param aOffset The offset of a link object within an element. sl@0: sl@0: @panic USER 75, if aOffset is not divisible by four sl@0: sl@0: @see iHead sl@0: @see iLast sl@0: @see iOffset sl@0: */ sl@0: { sl@0: sl@0: __ASSERT_ALWAYS(iOffset%4==0,Panic(ESQueOffsetNotAligned)); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TBool TSglQueBase::IsEmpty() const sl@0: /** sl@0: Tests whether the singly linked list is empty, i.e. has no list elements. sl@0: sl@0: @return True, if the singly linked list is empty; false, otherwise. sl@0: */ sl@0: { sl@0: sl@0: return(iHead==NULL); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TSglQueBase::SetOffset(TInt aOffset) sl@0: /** sl@0: Sets the offset of the link object from the start of a singly linked sl@0: list element. sl@0: sl@0: @param aOffset The offset of the link object from the start of a singly linked sl@0: list element. sl@0: sl@0: @panic USER 75, if aOffset is not divisible by four. sl@0: sl@0: @see TSglQue sl@0: */ sl@0: { sl@0: sl@0: __ASSERT_ALWAYS(iOffset%4==0,Panic(ESQueOffsetNotAligned)); sl@0: iOffset=aOffset; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TSglQueBase::Reset() sl@0: /** sl@0: Empties the singly linked list. sl@0: sl@0: After a call to this function, there are no elements queued from the header; sl@0: the elements are orphaned. Special care must be taken when list elements are sl@0: CBase derived objects, i.e. are allocated on the heap. sl@0: */ sl@0: { sl@0: sl@0: iHead=NULL; sl@0: iLast=(TSglQueLink*)&iHead; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TSglQueBase::DoAddFirst(TAny* aPtr) sl@0: /** sl@0: Implements the insertion of a list element at the front of the singly linked sl@0: list. sl@0: sl@0: This function is called by TSglQue::AddFirst(). sl@0: sl@0: @param aPtr An untyped pointer to the element to be inserted. sl@0: sl@0: @see TSglQue::AddFirst sl@0: */ sl@0: { sl@0: sl@0: TSglQueLink* pL=PtrAdd((TSglQueLink*)aPtr,iOffset); sl@0: pL->Enque((TSglQueLink*)&iHead); sl@0: if (iLast==(TSglQueLink*)(&iHead)) sl@0: iLast=pL; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TSglQueBase::DoAddLast(TAny* aPtr) sl@0: /** sl@0: Implements the insertion of a list element at the back of the singly linked sl@0: list. sl@0: sl@0: This function is called by TSglQue::AddLast(). sl@0: sl@0: @param aPtr An untyped pointer to the element to be inserted. sl@0: sl@0: @see TSglQue::AddLast sl@0: */ sl@0: { sl@0: sl@0: TSglQueLink* pL=PtrAdd((TSglQueLink*)aPtr,iOffset); sl@0: pL->Enque(iLast); sl@0: iLast=pL; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TSglQueBase::DoRemove(TAny* aPtr) sl@0: /** sl@0: Implements the removal of a list element from the singly linked list. sl@0: sl@0: This function is called by TSglQue::Remove(). sl@0: sl@0: @param aPtr An untyped pointer to the element to be removed. sl@0: sl@0: @see TSglQue::Remove sl@0: */ sl@0: { sl@0: sl@0: TSglQueLink* pP=(TSglQueLink*)(&iHead); sl@0: TSglQueLink* pL=PtrAdd((TSglQueLink*)aPtr,iOffset); sl@0: TSglQueLink* pN=pP->iNext; sl@0: while (pN) sl@0: { sl@0: if (pN==pL) sl@0: { sl@0: pP->iNext=pN->iNext; sl@0: if (iLast==pL) sl@0: { sl@0: iLast=pP; sl@0: if (iLast==NULL) sl@0: iLast=(TSglQueLink*)(&iHead); sl@0: } sl@0: return; sl@0: } sl@0: pP=pN; sl@0: pN=pP->iNext; sl@0: } sl@0: Panic(ESQueLinkNotQueued); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: #pragma warning( disable : 4705 ) // statement has no effect sl@0: EXPORT_C TDblQueBase::TDblQueBase() sl@0: : iOffset(0) sl@0: /** sl@0: Default constructor. sl@0: sl@0: It sets: sl@0: sl@0: 1. iHead to point to this object in both the forwards and backwards direction. sl@0: sl@0: 2. iOffset to zero. sl@0: sl@0: @see iHead sl@0: @see iOffset sl@0: */ sl@0: { sl@0: sl@0: iHead.iNext=iHead.iPrev=(&iHead); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TDblQueBase::TDblQueBase(TInt aOffset) sl@0: : iOffset(aOffset) sl@0: /** sl@0: Constructor with specified offset. sl@0: sl@0: It sets: sl@0: sl@0: 1. iHead to point to this object in both the forwards and backwards direction. sl@0: sl@0: 2. iOffset to the specified value. sl@0: sl@0: @param aOffset The offset of a link object within an element. sl@0: sl@0: @panic USER 78, if aOffset is not divisible by four sl@0: sl@0: @see iHead sl@0: @see iOffset sl@0: */ sl@0: { sl@0: sl@0: __ASSERT_ALWAYS(iOffset%4==0,Panic(ETQueOffsetNotAligned)); sl@0: iHead.iNext=iHead.iPrev=(&iHead); sl@0: } sl@0: #pragma warning( default : 4705 ) sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TBool TDblQueBase::IsEmpty() const sl@0: /** sl@0: Tests whether the doubly linked list is empty, i.e. has no list elements. sl@0: sl@0: @return True, if the doubly linked list is empty; false, otherwise. sl@0: */ sl@0: { sl@0: sl@0: return((const TDblQueLinkBase*)iHead.iNext==(&iHead)); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueBase::SetOffset(TInt aOffset) sl@0: /** sl@0: Sets the offset of the link object from the start of a doubly linked list element. sl@0: sl@0: @param aOffset The offset of the link object from the start of a doubly linked sl@0: list element. sl@0: sl@0: @panic USER 78, if aOffset is not divisible by four. sl@0: sl@0: @see TDblQue sl@0: */ sl@0: { sl@0: sl@0: __ASSERT_ALWAYS(iOffset%4==0,Panic(ETQueOffsetNotAligned)); sl@0: iOffset=aOffset; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueBase::Reset() sl@0: /** sl@0: Empties the doubly linked list. sl@0: sl@0: After a call to this function, there are no elements queued from the header; sl@0: the elements are orphaned. Special care must be taken when list elements are sl@0: CBase derived objects, i.e. are allocated on the heap. sl@0: */ sl@0: { sl@0: sl@0: iHead.iNext=iHead.iPrev=(&iHead); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueBase::DoAddFirst(TAny* aPtr) sl@0: /** sl@0: Implements the insertion of the specified list element at the front of the sl@0: doubly linked list. sl@0: sl@0: This function is called by TDblQue::AddFirst(). sl@0: sl@0: @param aPtr An untyped pointer to the element to be inserted. sl@0: sl@0: @see TDblQue::AddFirst sl@0: */ sl@0: { sl@0: sl@0: PtrAdd((TDblQueLinkBase*)aPtr,iOffset)->Enque(&iHead); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueBase::DoAddLast(TAny* aPtr) sl@0: /** sl@0: Implements the insertion of the specified list element at the back of the sl@0: doubly linked list. sl@0: sl@0: This function is called by TDblQue::AddLast(). sl@0: sl@0: @param aPtr An untyped pointer to the element to be inserted. sl@0: sl@0: @see TDblQue::AddLast*/ sl@0: { sl@0: sl@0: PtrAdd((TDblQueLinkBase*)aPtr,iOffset)->Enque(iHead.iPrev); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueBase::DoAddPriority(TAny* aPtr) sl@0: /** sl@0: Implements the insertion of the specified list element in priority order. sl@0: sl@0: This function is called by TPriQue::Add(). sl@0: sl@0: @param aPtr An untyped pointer to the element to be inserted. sl@0: sl@0: @see TPriQue::Add sl@0: */ sl@0: { sl@0: sl@0: TPriQueLink* pN=(TPriQueLink*)iHead.iNext; sl@0: TPriQueLink* pI=PtrAdd((TPriQueLink*)aPtr,iOffset); sl@0: TInt p=pI->iPriority; sl@0: while (pN!=(TPriQueLink*)&iHead && p<=pN->iPriority) sl@0: pN=(TPriQueLink*)pN->iNext; sl@0: pI->Enque(pN->iPrev); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TDeltaQueBase::TDeltaQueBase() sl@0: : iFirstDelta(NULL) sl@0: /** sl@0: Default constructor. sl@0: sl@0: It sets iFirstDelta to NULL. sl@0: sl@0: @see TDeltaQueBase::iFirstDelta sl@0: */ sl@0: { sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TDeltaQueBase::TDeltaQueBase(TInt aOffset) sl@0: : TDblQueBase(aOffset),iFirstDelta(NULL) sl@0: /** sl@0: Constructor with specified offset. sl@0: sl@0: It sets: sl@0: sl@0: 1. iFirstDelta to NULL sl@0: sl@0: 2. TDblQueBase::iOffset to the specified value, through a call to the sl@0: base class constructor. sl@0: sl@0: @param aOffset The offset of a link object within an element. sl@0: sl@0: @see TDeltaQueBase::iFirstDelta sl@0: @see TDblQueBase::iOffset sl@0: */ sl@0: { sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDeltaQueBase::Reset() sl@0: /** sl@0: Empties the doubly linked list, and resets the first delta pointer. sl@0: */ sl@0: { sl@0: sl@0: TDblQueBase::Reset(); sl@0: iFirstDelta=NULL; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TBool TDeltaQueBase::FirstDelta(TInt& aValue) sl@0: /** sl@0: Gets the delta value of the first list element. sl@0: sl@0: @param aValue On return, contsins the delta value of the first element. sl@0: Note that this remains unchanged if there is no first element. sl@0: sl@0: @return True, if there is a first element; false, otherwise. sl@0: */ sl@0: { sl@0: if (iFirstDelta) sl@0: { sl@0: aValue=*iFirstDelta; sl@0: return(ETrue); sl@0: } sl@0: return(EFalse); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TBool TDeltaQueBase::CountDown() sl@0: /** sl@0: Decrements the delta value of the first element by one, and returns true if sl@0: the result is negative or zero. sl@0: sl@0: @return True, if the resulting delta value is negative or zero; false, if sl@0: the value is positive, or there is no first element. sl@0: */ sl@0: { sl@0: sl@0: return(CountDown(1)); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TBool TDeltaQueBase::CountDown(TInt aValue) sl@0: /** sl@0: Decrements the delta value of the first element by the specified value, and sl@0: returns true if the result is negative or zero. sl@0: sl@0: @param aValue The amount by which the delta value is to be reduced. sl@0: sl@0: @return True, if the resulting delta value is negative or zero; false, if the sl@0: value is positive, or there is no first element. sl@0: */ sl@0: { sl@0: sl@0: if (iFirstDelta) sl@0: { sl@0: (*iFirstDelta)-=aValue; sl@0: if (*iFirstDelta<=0) sl@0: return(ETrue); sl@0: } sl@0: return(EFalse); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDeltaQueBase::DoAddDelta(TAny* aPtr,TInt aDelta) sl@0: /** sl@0: Implements the addition of the specified list element into the list. sl@0: sl@0: This function is called by TDeltaQue::Add(). sl@0: sl@0: @param aPtr Pointer to the list element to be inserted. sl@0: @param aDelta The 'distance' from the nominal zero point. sl@0: sl@0: @see TDeltaQue::Add sl@0: */ sl@0: { sl@0: sl@0: TDeltaQueLink* pD=(TDeltaQueLink*)iHead.iNext; sl@0: TDeltaQueLink* pI=PtrAdd((TDeltaQueLink*)aPtr,iOffset); sl@0: while (pD!=(TDeltaQueLink*)&iHead && aDelta>=pD->iDelta) sl@0: { sl@0: aDelta-=pD->iDelta; sl@0: pD=(TDeltaQueLink*)pD->iNext; sl@0: } sl@0: pI->iDelta=aDelta; sl@0: pI->Enque(pD->iPrev); sl@0: if (pI->iNext!=&iHead) sl@0: pD->iDelta-=aDelta; sl@0: iFirstDelta=(&((TDeltaQueLink*)iHead.iNext)->iDelta); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDeltaQueBase::DoRemove(TAny* aPtr) sl@0: /** sl@0: Implements the removal of the specified list element from the list. sl@0: sl@0: This function is called by TDeltaQue::Remove(). sl@0: sl@0: @param aPtr Pointer to the list element to be removed. sl@0: sl@0: @see TDeltaQue::Remove sl@0: */ sl@0: { sl@0: sl@0: TDeltaQueLink* pI=PtrAdd((TDeltaQueLink*)aPtr,iOffset); sl@0: TDeltaQueLink* pN=(TDeltaQueLink*)pI->iNext; sl@0: if (pN!=(TDeltaQueLink*)&iHead) sl@0: pN->iDelta+=pI->iDelta; sl@0: ((TDblQueLink*)pI)->Deque(); sl@0: iFirstDelta=(iHead.iNext!=(&iHead) ? &((TDeltaQueLink*)iHead.iNext)->iDelta : NULL); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TAny* TDeltaQueBase::DoRemoveFirst() sl@0: /** sl@0: Implements the removal of the first list element from the linked list if its sl@0: delta value is zero or negative. sl@0: sl@0: This function is called by TDeltaQue::RemoveFirst(). sl@0: sl@0: @return A pointer to the element removed from the linked list. This is NULL, sl@0: if the first element has a positive delta value. sl@0: sl@0: @see TDeltaQue::RemoveFirst sl@0: */ sl@0: { sl@0: sl@0: TDeltaQueLink* pN=(TDeltaQueLink*)iHead.iNext; sl@0: if (pN!=(TDeltaQueLink*)&iHead && pN->iDelta<=0) sl@0: { sl@0: pN=PtrSub(pN,iOffset); sl@0: DoRemove(pN); sl@0: return(pN); sl@0: } sl@0: return(NULL); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TSglQueIterBase::TSglQueIterBase(TSglQueBase& aQue) sl@0: // sl@0: // Cosntructor. sl@0: // sl@0: : iOffset(aQue.iOffset),iHead((TSglQueLink*)&aQue.iHead),iNext(aQue.iHead) sl@0: {} sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TSglQueIterBase::SetToFirst() sl@0: /** sl@0: Sets the iterator to point to the first element in the singly linked list. sl@0: sl@0: The function can be called to re-set the pointer at any time during the iterator's sl@0: existence. sl@0: sl@0: The function can be called even if the list has no elements. sl@0: */ sl@0: { sl@0: sl@0: iNext=iHead->iNext; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TSglQueIterBase::DoSet(TAny* aLink) sl@0: // sl@0: // Start the iterator at aLink. sl@0: // sl@0: { sl@0: sl@0: iNext=PtrAdd((TSglQueLink*)aLink,iOffset); sl@0: } sl@0: sl@0: EXPORT_C TAny* TSglQueIterBase::DoPostInc() sl@0: // sl@0: // Return the current pointer and increment. sl@0: // sl@0: { sl@0: sl@0: TAny* pN=iNext; sl@0: if (pN==NULL) sl@0: return NULL; sl@0: iNext=iNext->iNext; sl@0: return(PtrSub(pN,iOffset)); sl@0: } sl@0: sl@0: EXPORT_C TAny* TSglQueIterBase::DoCurrent() sl@0: // sl@0: // Return the current pointer. sl@0: // sl@0: { sl@0: sl@0: return(iNext==NULL ? NULL : PtrSub((TAny*)iNext,iOffset)); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TDblQueIterBase::TDblQueIterBase(TDblQueBase& aQue) sl@0: : iOffset(aQue.iOffset),iHead(&aQue.iHead),iNext(aQue.iHead.iNext) sl@0: /** sl@0: Constructs the iterator for the specified doubly linked list. sl@0: sl@0: @param aQue A reference to a doubly linked list header. sl@0: */ sl@0: {} sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueIterBase::SetToFirst() sl@0: /** sl@0: Sets the iterator to point to the first element in the doubly linked list. sl@0: sl@0: The function can be called to re-set the pointer at any time during the sl@0: iterator's existence. sl@0: sl@0: The function can be called even if the list has no elements. sl@0: */ sl@0: { sl@0: sl@0: iNext=iHead->iNext; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueIterBase::SetToLast() sl@0: /** sl@0: Sets the iterator to point to the last element in the doubly linked list. The sl@0: function can be called to re-set the pointer at any time during the sl@0: iterator's existence. sl@0: sl@0: The function can be called even if the list has no elements. sl@0: */ sl@0: { sl@0: sl@0: iNext=iHead->iPrev; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueIterBase::DoSet(TAny* aLink) sl@0: /** sl@0: Sets the iterator to point to a specific element in the list. sl@0: sl@0: The function is an implementation for TDblQueIter::Set(). sl@0: sl@0: @param aLink A pointer to the current list element. sl@0: sl@0: @see TDblQueIter::Set sl@0: */ sl@0: { sl@0: sl@0: iNext=PtrAdd((TDblQueLinkBase*)aLink,iOffset); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TAny* TDblQueIterBase::DoPostInc() sl@0: /** sl@0: Gets the current item and then moves to the next item. sl@0: sl@0: The function is an implementation for TDblQueIter::operator++(). sl@0: sl@0: @return A pointer to the current list element. sl@0: sl@0: @see TDblQueIter::operator++ sl@0: */ sl@0: { sl@0: sl@0: if (iNext==iHead) sl@0: return(NULL); sl@0: __ASSERT_DEBUG((iNext->iNext!=NULL)&&(iNext->iPrev!=NULL),Panic(ETQueLinkHasBeenRemoved)); sl@0: TAny* p=PtrSub(iNext,iOffset); sl@0: iNext=iNext->iNext; sl@0: return(p); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TAny* TDblQueIterBase::DoPostDec() sl@0: /** sl@0: Gets the current item and then moves to the previous item. sl@0: sl@0: The function is an implementation for TDblQueIter::operator--(). sl@0: sl@0: @return A pointer to the current list element. sl@0: sl@0: @see TDblQueIter::operator-- sl@0: */ sl@0: { sl@0: sl@0: if (iNext==iHead) sl@0: return(NULL); sl@0: __ASSERT_DEBUG((iNext->iNext!=NULL)&&(iNext->iPrev!=NULL),Panic(ETQueLinkHasBeenRemoved)); sl@0: TAny* p=PtrSub(iNext,iOffset); sl@0: iNext=iNext->iPrev; sl@0: return(p); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C TAny* TDblQueIterBase::DoCurrent() sl@0: /** sl@0: Gets the current item in the queue. sl@0: sl@0: The function is an implementation for TDblQueIter::operator T*(). sl@0: sl@0: @return A pointer to the current list element. sl@0: sl@0: @see TDblQueIter::operator T* sl@0: */ sl@0: { sl@0: sl@0: if (iNext==iHead) sl@0: return(NULL); sl@0: __ASSERT_DEBUG((iNext->iNext!=NULL)&&(iNext->iPrev!=NULL),Panic(ETQueLinkHasBeenRemoved)); sl@0: return(PtrSub(iNext,iOffset)); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void TDblQueBase::__DbgTestEmpty() const sl@0: /** sl@0: Tests whether the queue is empty. sl@0: sl@0: The function is implemented as an __ASSERT_DEBUG. sl@0: sl@0: @panic USER 79, if the assertion fails. sl@0: */ sl@0: { sl@0: sl@0: __ASSERT_DEBUG((((TDblQueLink*)iHead.iNext)!=&iHead)&&(((TDblQueLink*)iHead.iPrev)!=&iHead),Panic(ETQueQueueEmpty)); sl@0: } sl@0: