Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Using TDblQue<class T>


Constructing the list header

To manage a doubly linked list of CAnyClass objects, create a TDblQue object:

TDblQue<CAnyClass> queHeader(_FOFF(CAnyClass,link));

In this code fragment, queHeader is the header for a doubly linked list of CAnyClass elements. The offset of the link object from the beginning of CAnyClass is calculated using the _FOFF macro.

The CAnyClass class contains a declaration for the link object at a suitable point.

class CAnyClass : CBase
 {
 //... class members
 TDblQueLink link;
 //... class members
 };

The offset value is normally set on construction of the doubly linked list header using the appropriate constructor. Alternatively, the default constructor may be used and then followed by a call to SetOffset():

TDblQue<CAnyClass> queHeader;
...
queHeader.SetOffset(_FOFF(CAnyClass,iLink));

If this technique is used, then the offset value must be set before any elements are added to the list.


See also

TDblQue

TDblQueLink

Using TDblQueLink