ListStepper Class Reference

This class it used to step along two lists, choosing matching pairs. This really comes into play when you have different numbers of items in the two lists, and you want to step along them without missing out any items. E.g. List A contains 4 items, list B contains 2 items this would produce the following pairs: A B 0 0 1 0 2 1 3 1 E.g. List A contains 3 List B contains 5 A B 0 0 0 1 1 2 1 3 2 4. More...

#include <nodebldr.h>

List of all members.

Public Member Functions

 ListStepper ()
void Init (UINT32 NumInStart, UINT32 NumInEnd, UINT32 Start)
void GetNext (INT32 *pNextInStart, INT32 *pNextInEnd)

Private Attributes

UINT32 Min
UINT32 Max
UINT32 NextInStart
UINT32 NextInEnd
UINT32 Inc
UINT32pNextInMin
UINT32pNextInMax


Detailed Description

This class it used to step along two lists, choosing matching pairs. This really comes into play when you have different numbers of items in the two lists, and you want to step along them without missing out any items. E.g. List A contains 4 items, list B contains 2 items this would produce the following pairs: A B 0 0 1 0 2 1 3 1 E.g. List A contains 3 List B contains 5 A B 0 0 0 1 1 2 1 3 2 4.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/11/94

Definition at line 698 of file nodebldr.h.


Constructor & Destructor Documentation

ListStepper::ListStepper  )  [inline]
 

Definition at line 701 of file nodebldr.h.


Member Function Documentation

void ListStepper::GetNext INT32 *  pNextInStart,
INT32 *  pNextInEnd
 

Definition at line 182 of file nodebldr.cpp.

00183 {
00184     if ((*pNextInMax) < Max)
00185     {
00186         *pNextInStart = NextInStart;
00187         *pNextInEnd   = NextInEnd;
00188 
00189         Inc += Min;
00190         if (Inc >= Max)
00191         {
00192             Inc -= Max;
00193             (*pNextInMin)++;
00194         }
00195         (*pNextInMax)++;
00196     }
00197     else
00198     {
00199         *pNextInStart = -1;
00200         *pNextInEnd   = -1;
00201     }
00202 }

void ListStepper::Init UINT32  NumInStart,
UINT32  NumInEnd,
UINT32  Start
 

Definition at line 163 of file nodebldr.cpp.

00164 {
00165     if (NumInStart > NumInEnd)
00166     {
00167         Min = NumInEnd;   pNextInMin = &NextInEnd;
00168         Max = NumInStart; pNextInMax = &NextInStart;
00169     }
00170     else
00171     {
00172         Min = NumInStart; pNextInMin = &NextInStart;
00173         Max = NumInEnd;   pNextInMax = &NextInEnd;
00174     }
00175 
00176     NextInStart = NextInEnd = Inc = 0;
00177 
00178     for (INT32 dummy;Start > 0;Start--)
00179         GetNext(&dummy,&dummy);
00180 }


Member Data Documentation

UINT32 ListStepper::Inc [private]
 

Definition at line 711 of file nodebldr.h.

UINT32 ListStepper::Max [private]
 

Definition at line 708 of file nodebldr.h.

UINT32 ListStepper::Min [private]
 

Definition at line 707 of file nodebldr.h.

UINT32 ListStepper::NextInEnd [private]
 

Definition at line 710 of file nodebldr.h.

UINT32 ListStepper::NextInStart [private]
 

Definition at line 709 of file nodebldr.h.

UINT32* ListStepper::pNextInMax [private]
 

Definition at line 713 of file nodebldr.h.

UINT32* ListStepper::pNextInMin [private]
 

Definition at line 712 of file nodebldr.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:56:02 2007 for Camelot by  doxygen 1.4.4