author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 03 May 2010 13:47:38 +0300 | |
changeset 102 | ef2a444a7410 |
parent 90 | 947f0dc9f7a8 |
child 177 | a232af6b0b1f |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32\include\nkern\nklib.h |
|
15 |
// |
|
16 |
// WARNING: This file contains some APIs which are internal and are subject |
|
17 |
// to change without notice. Such APIs should therefore not be used |
|
18 |
// outside the Kernel and Hardware Services package. |
|
19 |
// |
|
20 |
||
21 |
#ifndef __NKLIB_H__ |
|
22 |
#define __NKLIB_H__ |
|
23 |
#include <e32err.h> |
|
24 |
#include <nk_cpu.h> |
|
25 |
||
26 |
#ifndef __KERNEL_MODE__ |
|
27 |
#error Including kernel header in user code |
|
28 |
#endif |
|
29 |
||
30 |
#if defined(__GCC32__) |
|
31 |
||
32 |
||
33 |
||
34 |
||
35 |
/** |
|
36 |
@publishedPartner |
|
37 |
@released |
|
38 |
||
39 |
64-bit signed integer type. |
|
40 |
*/ |
|
41 |
typedef long long Int64; |
|
42 |
||
43 |
||
44 |
||
45 |
||
46 |
/** |
|
47 |
@publishedPartner |
|
48 |
@released |
|
49 |
||
50 |
64-bit unsigned integer type. |
|
51 |
*/ |
|
52 |
typedef unsigned long long Uint64; |
|
53 |
||
54 |
||
55 |
||
56 |
||
57 |
#elif defined(__VC32__) |
|
58 |
typedef __int64 Int64; |
|
59 |
typedef unsigned __int64 Uint64; |
|
60 |
#elif defined(__CW32__) |
|
61 |
#pragma longlong on |
|
62 |
typedef long long Int64; |
|
63 |
typedef unsigned long long Uint64; |
|
64 |
#endif |
|
65 |
||
66 |
||
67 |
||
68 |
||
69 |
/** |
|
70 |
@publishedPartner |
|
71 |
@released |
|
72 |
||
73 |
Defines a 64-bit time value. |
|
74 |
*/ |
|
75 |
typedef Int64 TTimeK; |
|
76 |
||
77 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
78 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
@internalComponent |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
81 |
union TUint64HL |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
82 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
83 |
TUint64 i64; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
TUint32 i32[2]; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
}; |
0 | 86 |
|
87 |
||
88 |
#if defined(__VC32__) || defined(__CW32__) |
|
89 |
extern "C" |
|
90 |
/** @internalComponent */ |
|
91 |
__NORETURN__ void abort(); |
|
92 |
#endif |
|
93 |
||
94 |
#ifndef __PLACEMENT_NEW_INLINE |
|
95 |
#define __PLACEMENT_NEW_INLINE |
|
96 |
// Global placement operator new |
|
97 |
/** @internalComponent */ |
|
98 |
inline TAny* operator new(TUint /*aSize*/, TAny* aBase) __NO_THROW |
|
99 |
{return aBase;} |
|
100 |
||
101 |
// Global placement operator delete |
|
102 |
/** @internalComponent */ |
|
103 |
inline void operator delete(TAny* /*aPtr*/, TAny* /*aBase*/) __NO_THROW |
|
104 |
{} |
|
105 |
#endif //__PLACEMENT_NEW_INLINE |
|
106 |
||
107 |
#ifndef __PLACEMENT_VEC_NEW_INLINE |
|
108 |
#define __PLACEMENT_VEC_NEW_INLINE |
|
109 |
// Global placement operator new[] |
|
110 |
/** @internalComponent */ |
|
111 |
inline TAny* operator new[](TUint /*aSize*/, TAny* aBase) __NO_THROW |
|
112 |
{return aBase;} |
|
113 |
||
114 |
// Global placement operator delete[] |
|
115 |
/** @internalComponent */ |
|
116 |
inline void operator delete[](TAny* /*aPtr*/, TAny* /*aBase*/) __NO_THROW |
|
117 |
{} |
|
118 |
#endif //__PLACEMENT_VEC_NEW_INLINE |
|
119 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
120 |
/****************************************************************************** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
121 |
* |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
122 |
* SIMPLE DOUBLY-LINKED CIRCULAR LIST |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
123 |
* |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
124 |
******************************************************************************/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
125 |
|
0 | 126 |
/** |
127 |
Macro to offset a SDblQueLink pointer back to the base of a class containing it |
|
128 |
@publishedPartner |
|
129 |
@released |
|
130 |
*/ |
|
131 |
#define _LOFF(p,T,f) ((T*)(((TUint8*)(p))-_FOFF(T,f))) |
|
132 |
||
133 |
#ifdef _DEBUG |
|
134 |
||
135 |
/** @internalComponent */ |
|
136 |
#define KILL_LINK_VALUE (SDblQueLink*)0xdfdfdfdf |
|
137 |
||
138 |
/** @internalComponent */ |
|
139 |
#define KILL_LINK(l) (l)->iNext=(l)->iPrev=KILL_LINK_VALUE |
|
140 |
||
141 |
#else |
|
142 |
||
143 |
#define KILL_LINK(l) |
|
144 |
||
145 |
#endif |
|
146 |
||
147 |
||
148 |
#ifdef __ARMCC__ |
|
149 |
#define FORCE_INLINE __forceinline |
|
150 |
#else |
|
151 |
#define FORCE_INLINE inline |
|
152 |
#endif |
|
153 |
||
154 |
||
155 |
/** |
|
156 |
@publishedPartner |
|
157 |
@released |
|
158 |
||
159 |
An object that forms part of a doubly linked list. |
|
160 |
||
161 |
SDblQueLink can also be embedded within another object so that that object |
|
162 |
can form part of the doubly linked list. |
|
163 |
||
164 |
@see SDblQue |
|
165 |
*/ |
|
166 |
struct SDblQueLink |
|
167 |
{ |
|
168 |
||
169 |
#ifdef _DEBUG |
|
170 |
/** |
|
171 |
Default constructor; only defined for debug builds. |
|
172 |
||
173 |
It initialises the link pointers. |
|
174 |
*/ |
|
175 |
FORCE_INLINE SDblQueLink() {iNext=iPrev=NULL;} |
|
176 |
#endif |
|
177 |
||
178 |
||
179 |
/** |
|
180 |
Removes this link item from the doubly linked list. |
|
181 |
||
182 |
@return A pointer to this link item. |
|
183 |
*/ |
|
184 |
FORCE_INLINE SDblQueLink* Deque() |
|
185 |
{ |
|
186 |
SDblQueLink* next = iNext; |
|
187 |
SDblQueLink* prev = iPrev; |
|
188 |
next->iPrev=prev; |
|
189 |
prev->iNext=next; |
|
190 |
KILL_LINK(this); |
|
191 |
return this; |
|
192 |
} |
|
193 |
||
194 |
||
195 |
/** |
|
196 |
Inserts this link item into the list so that it precedes the specified link item. |
|
197 |
||
198 |
@param aL A pointer to the link item which is to follow this link item. |
|
199 |
*/ |
|
200 |
FORCE_INLINE void InsertBefore(SDblQueLink* aL) |
|
201 |
{ |
|
202 |
SDblQueLink* prev = aL->iPrev; |
|
203 |
iNext=aL; |
|
204 |
iPrev=prev; |
|
205 |
prev->iNext=this; |
|
206 |
aL->iPrev=this; |
|
207 |
} |
|
208 |
||
209 |
||
210 |
/** |
|
211 |
Inserts this link item into the list so that it follows the specified link item. |
|
212 |
||
213 |
@param aL A pointer to the link item which is to precede this link item. |
|
214 |
*/ |
|
215 |
FORCE_INLINE void InsertAfter(SDblQueLink* aL) |
|
216 |
{ |
|
217 |
SDblQueLink* next = aL->iNext; |
|
218 |
iPrev=aL; |
|
219 |
iNext=next; |
|
220 |
next->iPrev=this; |
|
221 |
aL->iNext=this; |
|
222 |
} |
|
223 |
||
224 |
||
225 |
/** |
|
226 |
Tests whether this is the only link item in the list. |
|
227 |
||
228 |
@return True, if this is the only link item in the list; false, otherwise. |
|
229 |
*/ |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
230 |
FORCE_INLINE TBool Alone() const |
0 | 231 |
{ return (iNext==iPrev); } |
232 |
||
233 |
||
234 |
/** |
|
235 |
Pointer to the next link item in the list. |
|
236 |
*/ |
|
237 |
SDblQueLink* iNext; |
|
238 |
||
239 |
/** |
|
240 |
Pointer to the previous link item in the list. |
|
241 |
*/ |
|
242 |
SDblQueLink* iPrev; |
|
243 |
}; |
|
244 |
||
245 |
||
246 |
||
247 |
||
248 |
/** |
|
249 |
@publishedPartner |
|
250 |
@released |
|
251 |
||
252 |
Anchor for a doubly linked list of SDblQueLink items. |
|
253 |
||
254 |
@see SDblQueLink |
|
255 |
*/ |
|
256 |
struct SDblQue |
|
257 |
{ |
|
258 |
||
259 |
||
260 |
/** |
|
261 |
Default constructor. |
|
262 |
*/ |
|
263 |
FORCE_INLINE SDblQue() |
|
264 |
{ iA.iNext=iA.iPrev=&iA; } |
|
265 |
||
266 |
||
267 |
/** |
|
268 |
Moves link items from the specified list onto this list, and clears the specified list |
|
269 |
||
270 |
@param aQ The source linked list. This list must not be empty. |
|
271 |
*/ |
|
272 |
inline SDblQue(SDblQue* aQ, TInt) // move entries from aQ onto this queue and clear aQ - aQ must not be empty |
|
273 |
{ new (this) SDblQue(*aQ); iA.iNext->iPrev=&iA; iA.iPrev->iNext=&iA; new (aQ) SDblQue; } |
|
274 |
||
275 |
||
276 |
/** |
|
277 |
Tests whether this doubly linked list is empty. |
|
278 |
||
279 |
@return True, if the list is empty; false, otherwise. |
|
280 |
*/ |
|
281 |
FORCE_INLINE TBool IsEmpty() const |
|
282 |
{ return (iA.iNext==&iA); } |
|
283 |
||
284 |
||
285 |
/** |
|
286 |
Gets a pointer to the first item in this doubly linked list. |
|
287 |
||
288 |
@return A pointer to the first item. |
|
289 |
*/ |
|
290 |
FORCE_INLINE SDblQueLink* First() const |
|
291 |
{ return iA.iNext; } |
|
292 |
||
293 |
||
294 |
/** |
|
295 |
Gets a pointer to the last item in this doubly linked list. |
|
296 |
||
297 |
@return A pointer to the last item. |
|
298 |
*/ |
|
299 |
FORCE_INLINE SDblQueLink* Last() const |
|
300 |
{ return iA.iPrev; } |
|
301 |
||
302 |
||
303 |
/** |
|
304 |
Adds the specified link item onto the end of this doubly linked list. |
|
305 |
||
306 |
@param aL A pointer to the link item to be added. |
|
307 |
*/ |
|
308 |
FORCE_INLINE void Add(SDblQueLink* aL) |
|
309 |
{ |
|
310 |
SDblQueLink* prev = iA.iPrev; |
|
311 |
aL->iNext=&iA; |
|
312 |
aL->iPrev=prev; |
|
313 |
prev->iNext=aL; |
|
314 |
iA.iPrev=aL; |
|
315 |
} |
|
316 |
||
317 |
||
318 |
/** |
|
319 |
Adds the specified link item onto the front of this doubly linked list. |
|
320 |
||
321 |
@param aL A pointer to the link item to be added. |
|
322 |
*/ |
|
323 |
FORCE_INLINE void AddHead(SDblQueLink* aL) |
|
324 |
{ |
|
325 |
SDblQueLink* next = iA.iNext; |
|
326 |
aL->iNext=next; |
|
327 |
aL->iPrev=&iA; |
|
328 |
next->iPrev=aL; |
|
329 |
iA.iNext=aL; |
|
330 |
} |
|
331 |
||
332 |
||
333 |
/** |
|
334 |
Removes the last link item from the linked list and adds it to the front |
|
335 |
of the list. |
|
336 |
*/ |
|
337 |
inline void Rotate() |
|
338 |
{ SDblQueLink* pL=iA.iPrev; pL->Deque(); AddHead(pL); } |
|
339 |
||
340 |
||
341 |
/** |
|
342 |
Gets the first link item in the linked list. |
|
343 |
||
344 |
@return The first link item in the list; NULL, if the list is empty. |
|
345 |
*/ |
|
346 |
inline SDblQueLink* GetFirst() |
|
347 |
{ if (IsEmpty()) return NULL; else return First()->Deque(); } |
|
348 |
||
349 |
||
350 |
/** |
|
351 |
Gets the last link item in the linked list. |
|
352 |
||
353 |
@return The last link item in the list; NULL, if the list is empty. |
|
354 |
*/ |
|
355 |
inline SDblQueLink* GetLast() |
|
356 |
{ if (IsEmpty()) return NULL; else return Last()->Deque(); } |
|
357 |
||
358 |
||
359 |
/** |
|
360 |
Appends entries from the specified linked list onto this list, and clears |
|
361 |
the specified link list anchor. |
|
362 |
||
363 |
@param aQ The source linked list. |
|
364 |
*/ |
|
365 |
inline void MoveFrom(SDblQue* aQ) // append entries from aQ onto this queue and clear aQ |
|
366 |
{ if (!aQ->IsEmpty()) |
|
367 |
{iA.iPrev->iNext=aQ->iA.iNext; aQ->iA.iNext->iPrev=iA.iPrev; iA.iPrev=aQ->iA.iPrev; iA.iPrev->iNext=&iA; new (aQ) SDblQue; } |
|
368 |
} |
|
369 |
||
370 |
||
371 |
/** |
|
372 |
The anchor point for the doubly linked list. |
|
373 |
*/ |
|
374 |
SDblQueLink iA; |
|
375 |
}; |
|
376 |
||
377 |
||
378 |
||
379 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
380 |
/****************************************************************************** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
381 |
* |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
382 |
* ITERABLE DOUBLY-LINKED CIRCULAR LIST |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
383 |
* |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
384 |
******************************************************************************/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
385 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
386 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
387 |
@internalComponent |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
388 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
389 |
An object that forms part of an iterable doubly linked list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
390 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
391 |
SIterDQLink can also be embedded within another object so that that object |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
392 |
can form part of the doubly linked list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
393 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
394 |
@see SIterDQ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
395 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
396 |
struct SIterDQ; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
397 |
struct SIterDQIterator; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
398 |
struct SIterDQLink |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
399 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
400 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
401 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
402 |
Default constructor; only defined for debug builds. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
403 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
404 |
It initialises the link pointers. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
405 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
406 |
FORCE_INLINE SIterDQLink() {iNext=iPrev=0;} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
407 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
408 |
enum |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
409 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
410 |
ENonAddressMask=3u, |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
411 |
EIterator=1u, |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
412 |
EAnchor=2u, |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
413 |
}; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
414 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
415 |
FORCE_INLINE SIterDQLink* Next() const |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
416 |
{ return (SIterDQLink*)(iNext & ~ENonAddressMask); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
417 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
418 |
FORCE_INLINE SIterDQLink* Prev() const |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
419 |
{ return (SIterDQLink*)(iPrev & ~ENonAddressMask); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
420 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
421 |
FORCE_INLINE TBool IsObject() const |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
422 |
{ return !(iNext & ENonAddressMask); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
423 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
424 |
FORCE_INLINE TBool IsIterator() const |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
425 |
{ return iNext & EIterator; } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
426 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
427 |
FORCE_INLINE TBool IsAnchor() const |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
428 |
{ return iNext & EAnchor; } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
429 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
430 |
FORCE_INLINE void SetNext(SIterDQLink* aNext) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
431 |
{ iNext = (iNext & ENonAddressMask) | (TUintPtr(aNext) & ~ENonAddressMask); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
432 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
433 |
FORCE_INLINE void SetPrev(SIterDQLink* aPrev) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
434 |
{ iPrev = (iPrev & ENonAddressMask) | (TUintPtr(aPrev) & ~ENonAddressMask); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
435 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
436 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
437 |
Removes this link item from the doubly linked list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
438 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
439 |
@return A pointer to this link item. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
440 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
441 |
FORCE_INLINE SIterDQLink* Deque() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
442 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
443 |
SIterDQLink* next = Next(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
444 |
SIterDQLink* prev = Prev(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
445 |
next->SetPrev(prev); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
446 |
prev->SetNext(next); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
447 |
#ifdef _DEBUG |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
448 |
SetNext((SIterDQLink*)4); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
449 |
SetPrev((SIterDQLink*)4); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
450 |
#endif |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
451 |
return this; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
452 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
453 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
454 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
455 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
456 |
Inserts this link item into the list so that it precedes the specified link item. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
457 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
458 |
@param aL A pointer to the link item which is to follow this link item. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
459 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
460 |
FORCE_INLINE void InsertBefore(SIterDQLink* aL) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
461 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
462 |
SIterDQLink* prev = aL->Prev(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
463 |
SetNext(aL); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
464 |
SetPrev(prev); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
465 |
prev->SetNext(this); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
466 |
aL->SetPrev(this); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
467 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
468 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
469 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
470 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
471 |
Inserts this link item into the list so that it follows the specified link item. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
472 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
473 |
@param aL A pointer to the link item which is to precede this link item. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
474 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
475 |
FORCE_INLINE void InsertAfter(SIterDQLink* aL) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
476 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
477 |
SIterDQLink* next = aL->Next(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
478 |
SetPrev(aL); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
479 |
SetNext(next); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
480 |
next->SetPrev(this); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
481 |
aL->SetNext(this); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
482 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
483 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
484 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
485 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
486 |
Tests whether this is the only link item in the list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
487 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
488 |
@return True, if this is the only link item in the list; false, otherwise. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
489 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
490 |
FORCE_INLINE TBool Alone() const |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
491 |
{ return (iNext==iPrev); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
492 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
493 |
private: |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
494 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
495 |
Bits 2-31 = Address of the next link item in the list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
496 |
Bit 0 = 1 for iterator, 0 for object |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
497 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
498 |
TUintPtr iNext; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
499 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
500 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
501 |
Bits 2-31 = Address of the previous link item in the list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
502 |
Bit 0 = 1 for iterator, 0 for object |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
503 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
504 |
TUintPtr iPrev; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
505 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
506 |
friend struct SIterDQ; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
507 |
friend struct SIterDQIterator; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
508 |
}; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
509 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
510 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
511 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
512 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
513 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
514 |
@internalComponent |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
515 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
516 |
Anchor for an iterable circular doubly linked list of SIterDQLink items. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
517 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
518 |
@see SIterDQLink |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
519 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
520 |
struct SIterDQ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
521 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
522 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
523 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
524 |
Default constructor. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
525 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
526 |
FORCE_INLINE SIterDQ() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
527 |
{ iA.iNext = iA.iPrev = TUintPtr(&iA)|SIterDQLink::EAnchor; } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
528 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
529 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
530 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
531 |
Moves link items from the specified list onto this list, and clears the specified list |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
532 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
533 |
@param aQ The source linked list. This list must not be empty. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
534 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
535 |
inline SIterDQ(SIterDQ* aQ, TInt) // move entries from aQ onto this queue and clear aQ - aQ must not be empty |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
536 |
{ iA.iNext=aQ->iA.iNext; iA.iPrev=aQ->iA.iPrev; First()->SetPrev(&iA); Last()->SetNext(&iA); new (aQ) SIterDQ; } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
537 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
538 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
539 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
540 |
Tests whether this doubly linked list is empty. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
541 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
542 |
@return True, if the list is empty; false, otherwise. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
543 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
544 |
FORCE_INLINE TBool IsEmpty() const |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
545 |
{ return (iA.iNext &~ SIterDQLink::ENonAddressMask) == TUintPtr(&iA); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
546 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
547 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
548 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
549 |
Gets a pointer to the first item in this doubly linked list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
550 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
551 |
@return A pointer to the first item. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
552 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
553 |
FORCE_INLINE SIterDQLink* First() const |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
554 |
{ return iA.Next(); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
555 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
556 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
557 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
558 |
Gets a pointer to the last item in this doubly linked list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
559 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
560 |
@return A pointer to the last item. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
561 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
562 |
FORCE_INLINE SIterDQLink* Last() const |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
563 |
{ return iA.Prev(); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
564 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
565 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
566 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
567 |
Adds the specified link item onto the end of this doubly linked list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
568 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
569 |
@param aL A pointer to the link item to be added. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
570 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
571 |
FORCE_INLINE void Add(SIterDQLink* aL) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
572 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
573 |
aL->InsertBefore(&iA); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
574 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
575 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
576 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
577 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
578 |
Adds the specified link item onto the front of this doubly linked list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
579 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
580 |
@param aL A pointer to the link item to be added. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
581 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
582 |
FORCE_INLINE void AddHead(SIterDQLink* aL) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
583 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
584 |
aL->InsertAfter(&iA); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
585 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
586 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
587 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
588 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
589 |
Gets the first link item in the linked list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
590 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
591 |
@return The first link item in the list; NULL, if the list is empty. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
592 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
593 |
inline SIterDQLink* GetFirst() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
594 |
{ if (IsEmpty()) return NULL; else return First()->Deque(); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
595 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
596 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
597 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
598 |
Gets the last link item in the linked list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
599 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
600 |
@return The last link item in the list; NULL, if the list is empty. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
601 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
602 |
inline SIterDQLink* GetLast() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
603 |
{ if (IsEmpty()) return NULL; else return Last()->Deque(); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
604 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
605 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
606 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
607 |
Appends entries from the specified linked list onto this list, and clears |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
608 |
the specified link list anchor. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
609 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
610 |
@param aQ The source linked list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
611 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
612 |
inline void MoveFrom(SIterDQ* aQ) // append entries from aQ onto this queue and clear aQ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
613 |
{ if (!aQ->IsEmpty()) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
614 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
615 |
SIterDQLink* last = Last(); // last current |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
616 |
SIterDQLink* fx = aQ->First(); // first extra |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
617 |
SIterDQLink* lx = aQ->Last(); // last extra |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
618 |
last->SetNext(fx); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
619 |
fx->SetPrev(last); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
620 |
iA.SetPrev(lx); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
621 |
lx->SetNext(&iA); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
622 |
new (aQ) SIterDQ; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
623 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
624 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
625 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
626 |
private: |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
627 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
628 |
The anchor point for the doubly linked list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
629 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
630 |
SIterDQLink iA; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
631 |
}; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
632 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
633 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
634 |
#ifdef __VC32__ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
635 |
#pragma warning( disable : 4127 ) // conditional expression is constant |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
636 |
#endif |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
637 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
638 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
639 |
@internalComponent |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
640 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
641 |
Iterator for an iterable circular doubly linked list of SIterDQLink items. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
642 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
643 |
@see SIterDQLink |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
644 |
@see SIterDQ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
645 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
646 |
struct SIterDQIterator : public SIterDQLink |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
647 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
648 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
649 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
650 |
Default constructor. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
651 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
652 |
Iterator starts out not attached to any queue |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
653 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
654 |
FORCE_INLINE SIterDQIterator() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
655 |
{ iNext = iPrev = SIterDQLink::EIterator; } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
656 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
657 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
658 |
Destructor ensures iterator detached before destruction |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
659 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
660 |
FORCE_INLINE ~SIterDQIterator() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
661 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
662 |
#ifdef _DEBUG |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
663 |
if (iNext != SIterDQLink::EIterator) { __crash(); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
664 |
#endif |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
665 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
666 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
667 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
668 |
Detach the iterator if it is currently attached to a queue |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
669 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
670 |
FORCE_INLINE void Detach() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
671 |
{ if (Next()) {Deque(); SetNext(0);} } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
672 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
673 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
674 |
Attach the iterator to a queue at the beginning. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
675 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
676 |
FORCE_INLINE void Attach(SIterDQ* aQ) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
677 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
678 |
#ifdef _DEBUG |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
679 |
if (iNext != SIterDQLink::EIterator) { __crash(); } |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
680 |
#endif |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
681 |
aQ->AddHead(this); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
682 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
683 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
684 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
685 |
Step the iterator over the next object. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
686 |
Return KErrNone if we stepped over an object. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
687 |
Return KErrEof if we reached the end of the list. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
688 |
Return KErrGeneral if we stepped over aMaxSteps other iterators. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
689 |
In first case aObj is set to point to the object stepped over. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
690 |
In other cases aObj is set to NULL. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
691 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
692 |
TInt Step(SIterDQLink*& aObj, TInt aMaxSteps=0); // 0 means use default value |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
693 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
694 |
}; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
695 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
696 |
#ifdef __VC32__ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
697 |
#pragma warning( default : 4127 ) // conditional expression is constant |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
698 |
#endif |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
699 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
700 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
701 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
702 |
/****************************************************************************** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
703 |
* |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
704 |
* ORDERED DOUBLY-LINKED CIRCULAR LIST |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
705 |
* |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
706 |
******************************************************************************/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
707 |
|
0 | 708 |
/** |
709 |
@publishedPartner |
|
710 |
@released |
|
711 |
||
712 |
An object that forms part of a doubly linked list arranged |
|
713 |
in descending key order. |
|
714 |
||
715 |
@see SOrdQue |
|
716 |
*/ |
|
717 |
struct SOrdQueLink : public SDblQueLink |
|
718 |
{ |
|
719 |
||
720 |
||
721 |
/** |
|
722 |
The key value used to order the link item. |
|
723 |
*/ |
|
724 |
TInt iKey; |
|
725 |
}; |
|
726 |
||
727 |
||
728 |
/** |
|
729 |
@publishedPartner |
|
730 |
@released |
|
731 |
||
732 |
Anchor for a doubly linked list of SOrdQueLink items. |
|
733 |
||
734 |
The items in this linked list are in descending key order. |
|
735 |
||
736 |
@see SOrdQueLink |
|
737 |
*/ |
|
738 |
struct SOrdQue : public SDblQue |
|
739 |
{ |
|
740 |
||
741 |
||
742 |
/** |
|
743 |
Adds the specified link item into this doubly linked list so that |
|
744 |
the list remains in descending key order. |
|
745 |
||
746 |
@param aL A pointer to the link item to be added. |
|
747 |
*/ |
|
748 |
inline void Add(SOrdQueLink* aL) |
|
749 |
{ |
|
750 |
SOrdQueLink* pQ=(SOrdQueLink*)iA.iNext; |
|
751 |
TInt k=aL->iKey; |
|
752 |
while(pQ!=&iA && (pQ->iKey>=k)) pQ=(SOrdQueLink*)pQ->iNext; |
|
753 |
aL->InsertBefore(pQ); |
|
754 |
} |
|
755 |
}; |
|
756 |
||
757 |
||
758 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
759 |
/****************************************************************************** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
760 |
* |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
761 |
* DELTA-ORDERED DOUBLY-LINKED CIRCULAR LIST |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
762 |
* |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
763 |
******************************************************************************/ |
0 | 764 |
|
765 |
/** |
|
766 |
@publishedPartner |
|
767 |
@released |
|
768 |
||
769 |
An object that forms part of a doubly linked list arranged |
|
770 |
in 'delta' order. |
|
771 |
||
772 |
The item represents some value that is an increment, or delta, |
|
773 |
on the value represented by a preceding element. |
|
774 |
||
775 |
@see SDeltaQue |
|
776 |
*/ |
|
777 |
struct SDeltaQueLink : public SDblQueLink |
|
778 |
{ |
|
779 |
/** |
|
780 |
The delta value. |
|
781 |
*/ |
|
782 |
TInt iDelta; |
|
783 |
}; |
|
784 |
||
785 |
||
786 |
||
787 |
||
788 |
/** |
|
789 |
@publishedPartner |
|
790 |
@released |
|
791 |
||
792 |
Anchor for a doubly linked list of SDeltaQueLink items. |
|
793 |
||
794 |
An item in this linked list represents a value that is an increment, |
|
795 |
or a delta, on the value represented by a preceding element. |
|
796 |
The list is ordered so that the head of the queue represents a nominal zero point. |
|
797 |
||
798 |
@see SDeltaQueLink |
|
799 |
*/ |
|
800 |
struct SDeltaQue : public SDblQue |
|
801 |
{ |
|
802 |
||
803 |
||
804 |
/** |
|
805 |
Gets the delta value of the first link item in the list. |
|
806 |
||
807 |
@return The delta value. |
|
808 |
*/ |
|
809 |
inline TInt FirstDelta() const |
|
810 |
{return ((SDeltaQueLink*)First())->iDelta;} |
|
811 |
||
812 |
||
813 |
/** |
|
814 |
Decrements the delta value of the first item in the list by the specified value. |
|
815 |
||
816 |
@param aCount The amount by which the delta value is to be reduced. |
|
817 |
||
818 |
@return True, if the resulting delta value is negative or zero; |
|
819 |
false, if the value is positive. |
|
820 |
*/ |
|
821 |
inline TBool CountDown(TInt aCount) |
|
822 |
{SDeltaQueLink& l=*(SDeltaQueLink*)First(); return((l.iDelta-=aCount)<=0);} |
|
823 |
||
824 |
||
825 |
/** |
|
826 |
Adds the specified list item, having the specified 'distance' from |
|
827 |
the nominal zero point, into the list. |
|
828 |
||
829 |
The item is added into the list, the adjacent delta values are adjusted, |
|
830 |
and a suitable delta value assigned to the new item so that |
|
831 |
the new item is at the specified 'distance' from the nominal zero point. |
|
832 |
||
833 |
@param aL The item to be inserted. |
|
834 |
@param aDelta The 'distance' of the item from the nominal zero point. |
|
835 |
*/ |
|
836 |
inline void Add(SDeltaQueLink* aL, TInt aDelta) |
|
837 |
{ |
|
838 |
SDeltaQueLink* pQ=(SDeltaQueLink*)iA.iNext; |
|
839 |
while(pQ!=&iA && aDelta>=pQ->iDelta) |
|
840 |
{ aDelta-=pQ->iDelta; pQ=(SDeltaQueLink*)pQ->iNext; } |
|
841 |
aL->iDelta=aDelta; |
|
842 |
aL->InsertBefore(pQ); |
|
843 |
if (pQ!=&iA) pQ->iDelta-=aDelta; |
|
844 |
} |
|
845 |
||
846 |
||
847 |
/** |
|
848 |
Removes the specified link item from the list. |
|
849 |
||
850 |
The delta value of the item following the removed item is adjusted |
|
851 |
so that its 'distance' from the nominal zero point remains the same. |
|
852 |
||
853 |
@param aL The list item to be removed. |
|
854 |
||
855 |
@return A pointer to the item removed from the queue. |
|
856 |
*/ |
|
857 |
inline SDeltaQueLink* Remove(SDeltaQueLink* aL) |
|
858 |
{ |
|
859 |
if (aL->iNext!=&iA) |
|
860 |
{ |
|
861 |
SDeltaQueLink& next=*(SDeltaQueLink*)aL->iNext; |
|
862 |
next.iDelta+=aL->iDelta; |
|
863 |
} |
|
864 |
return (SDeltaQueLink*)aL->Deque(); |
|
865 |
} |
|
866 |
||
867 |
||
868 |
/** |
|
869 |
Removes the first item from the linked list if its delta value |
|
870 |
is zero or negative. |
|
871 |
||
872 |
@return A pointer to the item removed from the linked list. |
|
873 |
This is NULL, if the first element has a positive delta value, |
|
874 |
and has not been removed from the list. |
|
875 |
*/ |
|
876 |
inline SDeltaQueLink* RemoveFirst() |
|
877 |
{ |
|
878 |
SDeltaQueLink& l=*(SDeltaQueLink*)First(); |
|
879 |
if (l.iDelta<=0) |
|
880 |
return Remove(&l); |
|
881 |
return NULL; |
|
882 |
} |
|
883 |
}; |
|
884 |
||
885 |
||
886 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
887 |
/****************************************************************************** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
888 |
* |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
889 |
* O(1) PRIORITY ORDERED LIST |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
890 |
* |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
891 |
******************************************************************************/ |
0 | 892 |
|
893 |
/** |
|
894 |
@publishedPartner |
|
895 |
@released |
|
896 |
||
897 |
An object that forms part of a TPriList, priority ordered lists. |
|
898 |
||
899 |
@see TPriListBase |
|
900 |
@see TPriList |
|
901 |
*/ |
|
902 |
class TPriListLink : public SDblQueLink |
|
903 |
{ |
|
904 |
public: |
|
905 |
||
906 |
||
907 |
/** |
|
908 |
Default constructor. |
|
909 |
||
910 |
Sets the priority value to zero. |
|
911 |
*/ |
|
912 |
inline TPriListLink() : iPriority(0) {} |
|
913 |
||
914 |
||
915 |
/** |
|
916 |
Constructor. |
|
917 |
||
918 |
Sets the priority to the specified value. |
|
919 |
||
920 |
@param aPriority The priority value. |
|
921 |
*/ |
|
922 |
inline TPriListLink(TInt aPriority) : iPriority((TUint8)aPriority) {} |
|
923 |
||
924 |
||
925 |
/** |
|
926 |
Tests whether this is a solitary link item. |
|
927 |
||
928 |
@return True, if this is a solitary link item; false, otherwise. |
|
929 |
*/ |
|
930 |
inline TBool Alone() const |
|
931 |
{ return (iNext==(SDblQueLink*)this); } |
|
932 |
public: |
|
933 |
||
934 |
/** |
|
935 |
The priority value. |
|
936 |
*/ |
|
937 |
TUint8 iPriority; |
|
938 |
||
939 |
/** |
|
940 |
Reserved for future use. |
|
941 |
*/ |
|
942 |
TUint8 iSpare1; |
|
943 |
||
944 |
||
945 |
/** |
|
946 |
Reserved for future use. |
|
947 |
*/ |
|
948 |
TUint8 iSpare2; |
|
949 |
||
950 |
||
951 |
/** |
|
952 |
Reserved for future use. |
|
953 |
*/ |
|
954 |
TUint8 iSpare3; |
|
955 |
}; |
|
956 |
||
957 |
||
958 |
||
959 |
||
960 |
/** |
|
961 |
@publishedPartner |
|
962 |
@released |
|
963 |
||
964 |
Base class for a TPriList, priority ordered lists. |
|
965 |
||
966 |
@see TPriListLink |
|
967 |
@see TPriList |
|
968 |
*/ |
|
969 |
class TPriListBase |
|
970 |
{ |
|
971 |
public: |
|
972 |
IMPORT_C TPriListBase(TInt aNumPriorities); |
|
973 |
IMPORT_C TInt HighestPriority(); |
|
974 |
IMPORT_C TPriListLink* First(); |
|
975 |
IMPORT_C void Add(TPriListLink* aLink); |
|
976 |
IMPORT_C void AddHead(TPriListLink* aLink); |
|
977 |
IMPORT_C void Remove(TPriListLink* aLink); |
|
978 |
IMPORT_C void ChangePriority(TPriListLink* aLink, TInt aNewPriority); |
|
979 |
||
980 |
/** |
|
981 |
Tests whether there are any non-empty lists. |
|
982 |
||
983 |
@return True, if there are non-empty lists; false, if all lists are empty. |
|
984 |
*/ |
|
985 |
inline TBool NonEmpty() const |
|
986 |
{ return iPresent[0]|iPresent[1]; } |
|
987 |
||
988 |
/** |
|
989 |
Tests whether there are any non-empty lists. |
|
990 |
||
991 |
@return True, if all lists are empty |
|
992 |
*/ |
|
993 |
inline TBool IsEmpty() const |
|
994 |
{ return !iPresent[0] && !iPresent[1]; } |
|
995 |
||
996 |
/** |
|
997 |
Tests whether any linked list with priority greater than p is non-empty. |
|
998 |
||
999 |
@param p The priority value (0-63). |
|
1000 |
||
1001 |
@return True, if any list with priority greater than p is non-empty; false, otherwise. |
|
1002 |
*/ |
|
1003 |
inline TBool operator>(TInt p) const |
|
1004 |
{ return ((p<32) ? (iPresent[1] | (iPresent[0]>>p)>>1) : (iPresent[1]>>(p-32))>>1 ); } |
|
1005 |
public: |
|
1006 |
||
1007 |
/** |
|
1008 |
64-bit mask to indicate which list is non-empty. |
|
1009 |
||
1010 |
Bit n in the mask is set if and only if the linked list for priority n is non-empty. |
|
1011 |
*/ |
|
1012 |
union |
|
1013 |
{ |
|
1014 |
TUint iPresent[2]; |
|
1015 |
TUint64 iPresent64; |
|
1016 |
}; |
|
1017 |
||
1018 |
/** |
|
1019 |
Pointer to the first linked list. |
|
1020 |
*/ |
|
1021 |
SDblQueLink* iQueue[1]; |
|
1022 |
}; |
|
1023 |
||
1024 |
||
1025 |
||
1026 |
||
1027 |
template<class T, int n> |
|
1028 |
/** |
|
1029 |
@publishedPartner |
|
1030 |
@released |
|
1031 |
||
1032 |
Anchor for a collection of doubly linked lists, where each list |
|
1033 |
corresponds to a priority value. |
|
1034 |
||
1035 |
The lists are ordered by priority value, but items within |
|
1036 |
a list are in chronological order. |
|
1037 |
||
1038 |
The number of lists is defined by the template integer parameter, |
|
1039 |
and each item in each list is of a class type defined by the template class parameter. |
|
1040 |
The number of lists must be between 1 and 64 inclusive. |
|
1041 |
||
1042 |
@see TPriListLink |
|
1043 |
*/ |
|
1044 |
class TPriList : public TPriListBase |
|
1045 |
{ |
|
1046 |
public: |
|
1047 |
/** |
|
1048 |
Constructor. |
|
1049 |
*/ |
|
1050 |
inline TPriList() : TPriListBase(n) {} |
|
1051 |
||
1052 |
||
1053 |
/** |
|
1054 |
Finds the highest priority item present on a priority list. |
|
1055 |
If multiple items at the same priority are present, return the first to be |
|
1056 |
added in chronological order. |
|
1057 |
||
1058 |
@return a pointer to the item or NULL if the list is empty. |
|
1059 |
*/ |
|
1060 |
inline T* First() { return (T*)TPriListBase::First(); } |
|
1061 |
private: |
|
1062 |
SDblQueLink* iExtraQueues[n-1]; |
|
1063 |
}; |
|
1064 |
||
1065 |
||
1066 |
||
1067 |
/** Base for variant interface block |
|
1068 |
@internalTechnology |
|
1069 |
@prototype |
|
1070 |
*/ |
|
1071 |
struct SInterfaceBlockBase |
|
1072 |
{ |
|
1073 |
TUint32 iVer; // version number |
|
1074 |
TUint32 iSize; // size in bytes |
|
1075 |
}; |
|
1076 |
#endif |