Update contrib.
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\euser\cbase\ub_tque.cpp
19 #include <e32std_private.h>
24 // Class TTickCountQue
29 Constructs an empty list header
31 TTickCountQue::TTickCountQue()
41 Adds the specified list element.
43 The element is added into the list in order of its tick count.
45 @param aRef The list element to be inserted.
47 void TTickCountQue::Add(TTickCountQueLink& aRef)
49 TTickCountQueLink* currentLink = (TTickCountQueLink*)(iHead.iNext);
50 TTickCountQueLink* addLink = &aRef;
52 while ( (currentLink != (TTickCountQueLink*)&iHead) &&
53 (((TInt)(addLink->iTickCount - currentLink->iTickCount)) >= 0)
56 currentLink = (TTickCountQueLink*)currentLink->iNext;
59 addLink->Enque(currentLink->iPrev);
69 Removes the first list element from the linked list if its tick count
70 is prior to the current tick count.
72 @param aTickCount The current tick count.
74 @return A pointer to the element removed from the linked list. This is NULL
75 if the first element has yet to expire or the queue is empty.
77 TTickCountQueLink* TTickCountQue::RemoveFirst(TUint aTickCount)
79 TTickCountQueLink* firstLink = (TTickCountQueLink*)iHead.iNext;
81 if (((TInt)(firstLink->iTickCount - aTickCount)) <= 0)
96 Removes the first list element from the linked list, if any.
98 @return A pointer to the element removed from the linked list. This is NULL,
99 if the queue is empty.
101 TTickCountQueLink* TTickCountQue::RemoveFirst()
103 TTickCountQueLink* firstLink = (TTickCountQueLink*)iHead.iNext;
105 if (firstLink != (TTickCountQueLink*)&iHead)
121 Gets a pointer to the first list element in the doubly linked list.
123 @return A pointer to the first list element in the doubly linked list. If
124 the list is empty, this pointer is not necessarily NULL and must not
125 be assumed to point to a valid object.
127 TTickCountQueLink* TTickCountQue::First() const
132 return((TTickCountQueLink*)iHead.iNext);