torcs - 1.2.0

Main Page   Modules   Compound List   File List   Compound Members   File Members   Related Pages  

Ring Lists Management.


Detailed Description

The ring lists are linked lists without end, the tail is linked to the head.


The list pointer is on the tail, so the access to the head is list->next.
The first field of the elements is always next.


Files

file  ringlist.cpp
 Ring list management.


Functions

void GfRlstInit (tRingListHead *head)
 Initialize the ring list head.

void GfRlstAddFirst (tRingListHead *head, tRingList *elt)
 Add an element in first position of a double link ring list.

void GfRlstAddLast (tRingListHead *head, tRingList *elt)
 Add an element in last position of a double link ring list.

tRingListGfRlstUnlinkFirst (tRingListHead *head)
 Unlink the first element of a ring list.

tRingListGfRlstUnlinkLast (tRingListHead *head)
 Unlink the last element of a ring list.

tRingListGfRlstUnlinkElt (tRingList *elt)
 Unlink an element of a double link ring list.

tRingListGfRlstGetFirst (tRingListHead *head)
 Get the first element of a ring list without unlinking it.

tRingListGfRlstGetLast (tRingListHead *head)
 Get the last element of a ring list without unlinking it.

tRingListGfRlstGetNext (tRingListHead *head, tRingList *elt)
 Get the next element of a ring list without unlinking it.

tRingListGfRlstGetPrev (tRingListHead *head, tRingList *elt)
 Get the previous element of a ring list without unlinking it.

void GfRlstSeekElt (tRingListHead *head, tRingList *elt)
 Set the head before the specified element.


Function Documentation

void GfRlstAddFirst tRingListHead *    head,
tRingList   elt
 

Add an element in first position of a double link ring list.

Parameters:
head List where the element is inserted
elt Element to instert

void GfRlstAddLast tRingListHead *    head,
tRingList   elt
 

Add an element in last position of a double link ring list.

Parameters:
head List where the element is inserted
elt Element to instert

tRingList* GfRlstGetFirst tRingListHead *    head
 

Get the first element of a ring list without unlinking it.

Parameters:
head Current ring list
Returns:
The first element (or NULL if empty)

tRingList* GfRlstGetLast tRingListHead *    head
 

Get the last element of a ring list without unlinking it.

Parameters:
head Current ring list
Returns:
The last element (or NULL if empty)

tRingList* GfRlstGetNext tRingListHead *    head,
tRingList   elt
 

Get the next element of a ring list without unlinking it.

Parameters:
head Current ring list
elt Element to get the next one
Returns:
The next element (or NULL if elt is last)

tRingList* GfRlstGetPrev tRingListHead *    head,
tRingList   elt
 

Get the previous element of a ring list without unlinking it.

Parameters:
head Current ring list
elt Element to get the previous one
Returns:
The previous element (or NULL if elt is last)

void GfRlstInit tRingListHead *    head
 

Initialize the ring list head.

Parameters:
head Ring list to initialize.
Returns:
None
Warning:
Using uninitialized list leads to unpredictable behaviour.

void GfRlstSeekElt tRingListHead *    head,
tRingList   elt
 

Set the head before the specified element.

Parameters:
head Current ring list
elt Element to become the first of the list
Returns:
0 ... Ok
-1 .. Error

tRingList* GfRlstUnlinkElt tRingList   elt
 

Unlink an element of a double link ring list.

Parameters:
elt Element to unlink
Returns:
Unlinked element

tRingList* GfRlstUnlinkFirst tRingListHead *    head
 

Unlink the first element of a ring list.

Parameters:
head List where the element is to be unlinked
Returns:
Unlinked element

tRingList* GfRlstUnlinkLast tRingListHead *    head
 

Unlink the last element of a ring list.

Parameters:
head List where the element is to be unlinked
Returns:
Unlinked element


Generated at Fri Apr 4 00:30:03 2003 for torcs by doxygen 1.3-rc1 written by Dimitri van Heesch, © 1997-1999
TORCS © Eric Espié 1999, 2002.