www.delorie.com/gnu/docs/avl/libavl_21.html   search  
 
Buy GNU books!


GNU libavl 2.0.1

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.10.2 Manipulators

These functions manipulate valid traversers.

 
void *tbl_t_next (struct tbl_traverser *);
void *tbl_t_prev (struct tbl_traverser *);
void *tbl_t_cur (struct tbl_traverser *);
void *tbl_t_replace (struct tbl_traverser *, void *);
This code is included in @refalso{15

Each of these functions takes a valid traverser, here called trav, as its first argument, and returns a data item. All but tbl_t_replace() can also return a null pointer that represents the null item. All arguments to these functions must be non-null pointers.

Seen from the outside, the traverser treats the table as a circular arrangement of items:

trav-circ

items, with the null item at the top of the circle and the least-valued item just clockwise of it, then the next-lowest-valued item, and so on until the greatest-valued item is just counterclockwise of the null item. Moving clockwise in the circle is equivalent, under our traverser, to moving to the next item with tbl_t_next(). Moving counterclockwise is equivalent to moving to the previous item with tbl_t_prev().

An equivalent view is that the traverser treats the table as a linear arrangement of nodes:

trav-line

From this perspective, nodes are arranged from least to greatest in left to right order, and the null node lies in the middle as a connection between the least and greatest nodes. Moving to the next node is the same as moving to the right and moving to the previous node is motion to the left, except where the null node is concerned.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003