by rgerhards » Wed Mar 12, 2008 2:36 pm
I agree, except for SkipNext, for which I think I now have a better solution. Let me introduce the new call:
seek(uid, mode, numrecs)
uid is a unique ID from where to start, ignored in all modes except UID (see below)
mode - how the seek should be performed
BOS - seek from begin stream
EOS - seek from end of stream
UID - seek from position uid (which MUST be a *valid* uid!)
numrecs
number of records to seek from this position. Use 0 to seek to the actual position, a positive value to seek the the record numrecs records forward or a negative value to seek to a position numrecs backward.
On return, uid contains the uid of the record seeked to. It is undefined if an error occured. If no error ocucrred, the next call to ReadNext() will read the record whom's uid has been returned.
Sample:
To Read the last record of a stream, do a
seek(0, EOS, 0)
ReadNext
For the first record, similarly:
seek(0, BOS, 0)
ReadNext
To skip the next, say, 49 records from the current position, you first need to know the current uid. You may have obtained it by a previous ReadNext call. Then, do
seek(uidCURR, UID, 50)
ReadNext
Note that we seeked 50 records, because the next read will return that 50th record, so we actually skipped 49.
Can we agree on that interface?
Rainer