diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-F15B9BDF-EDF8-5684-A0FC-C0A08F9C1F22.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-F15B9BDF-EDF8-5684-A0FC-C0A08F9C1F22.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,123 @@ + + + + + +linkedlist: +Using the Linked List classes +

The following examples show the use of the linked list classes:

    +
  • Singly linked list example

  • +
  • Doubly linked list example

  • +
  • Delta queue example

  • +
+
Singly linked +list example

This example application demonstrates the use of singly +linked lists. The templated TSglQue class is used to create +a singly linked list.

Download

Click on the following +link to download the example: sgllist.zip

Click: browse to view the example.

Description

The +example creates a singly linked list of objects of the TDigit class. +This list represents a long number. An object of class CLongNumber owns +the list. The user can edit this list using the functions defined in the CLongNumber class. +The following edit operations are possible:

    +
  • Insert an object of +the TDigit class at the start of the singly linked list

  • +
  • Insert an object of +the TDigit class at the end of the singly linked list

  • +
  • Remove an object of +the TDigit class from the end of the singly linked list

  • +

The user can perform any of these operations by pressing keys specified +in the menu. CLongNumber is an active object class and handles +the key press events in the CLongNumber::RunL() function.The CLongNumber::ReadFunc() function +displays a menu and waits for an asynchronous key press event.

An +object of the templated TSglQueIter class is used to traverse +this linked list. The sum of all digits of the number represented by the linked +list is displayed to the user.

An object of the CAdder class +is used to traverse the CLongNumber::iNumber list and print +the sum of all digits of the number represented by this list. The CAdder::Add() function +gets this sum.

Related APIs

    +
  • CAdder

  • +
  • CLongNumber

  • +
  • TDigit

  • +
  • TSglQueIter

  • +

Design and implementation

Figure 1 shows the classes +in the example.

+ Figure 1. Classes in the singly linked list example + + +

Class summary

    +
  • TSglQue

  • +
  • TSglQueIter

  • +

Build

The +Symbian OS build process describes how to build this example.

For +the emulator, the example builds an executable called sgllist.exe in +the epoc32\release\winscw\<udeb or urel>\ folder.

See +also:

Using +Singly Linked Lists

+
Doubly linked +list example

This example application demonstrates the use of doubly +linked lists. The templated TDblQue class is used create +a doubly linked list.

Download

Click on the following +link to download the example: dbllist.zip

Click: browse to view the example code

Description

The +example creates a doubly linked list of objects of the TLetter class. +This list represents a character string. An object of class CMyStringReverse owns +this string. The user can edit this string using the functions defined in +the CMyStringReverse class. The following edit operations +are possible:

    +
  • Insert a character at +the start of the list

  • +
  • Insert a character at +the end of the list

  • +

The user can perform either of these operations by pressing keys +specified in the menu. CMyStringReverse is an active object +class and handles key press events in the CMyStringReverse::RunL() function. +The CMyStringReverse::ReadFunc() function displays a menu +and waits for an asynchronous key press event.

The CMyStringReverse class +has a doubly linked list iterator, iIteratorString. The iIteratorString object +iterates through the list iString from start to end to print +the string reversed.

Design and implementation

Figure +2 shows the classes in the example.

+ Figure 2. Classes in the doubly linked list example + +

Class summary

    +
  • TDblQue - A templated class that provides the behaviour +for managing a doubly linked list.

  • +

Build

The +Symbian OS build process describes how to build this example.

For +the emulator, the example builds an executable called dbllist.exe in +the epoc32\release\winscw\<udeb or urel>\ folder.

See +also

Using +Doubly Linked Lists

Example code

+
Delta queue +example

This example application demonstrates the use of the delta +queue. The templated TDeltaQue class is used create a delta +queue.

Download

Click on the following link to download +the example: deltaque.zip

Click: browse to view the example code.

Description

The +example creates an object of the CTimerEntry class. This +is a CTimer derived class. An object of this class generates +timer events by using the CTimer::After() function. The +data member of this class, iQueue is a delta list. The offset +value of each node in this list is the tick count after each timer event. +The CTimerEntry::Arbitrator() function decides the action +to be performed for each event generated by the timer. It either adds tick +counts to the list or removes elements from the list based on the state of +the queue.

Related APIs

    +
  • CTimer - Base class for a timer active object.

  • +
  • CTimer::After()

  • +

Design and implementation

Figure 3 shows the classes +of the example.

+ Figure 3. Classes of the delta queue example + +

Class summary

    +
  • TDeltaQue

  • +
  • CTimer - Base class for a timer active object.

  • +

Build

The +Symbian OS build process describes how to build this example.

For +the emulator, the example builds an executable called deltaque.exe in +the epoc32\release\winscw\<udeb or urel>\ folder.

+
\ No newline at end of file