Class CGCursorIndex
can be used to create or use index by column for
cursor objects. To create or load index you should
use cursor's constructor. You is responsible for synchronization between
saved cursors/indexes. Synchronization between opened cursor/indexes will
done automatically.
Methods
CGCursorIndex(CGCursor *pCursor, int iColumn, bool (_cdecl *pCallback)(long, long) = 0);
CGCursorIndex(CGCursor *pCursor, const char *szFileName);
Constructor creates (first variant) or loads from file (second variant) the index
for the CGCursor
object. During execution
time cursor object is not related with any file. No synchronization
will file will be done automatically. You should use save
method
to save modified cursor for future usage.
Parameters
pCursor | Reference to cursor object, for which index object should be created. Index registers itself in cursor object for synchronization. |
iColumn | Index of the column, which should be indexed. |
pCallback | Callback function, which can be used to tracking indexing process.
Function should have following formbool _cdecl IndexCallback(long lCurrentRow, long lTotalRows) Function should return false to terminate indexing process. |
szFileName | Name of file with previously saved index |
void save(const char *szFileName);
Method saves current state of the index to specified file. Method can throw cursor exception.
void go(int iIndexRow);
Method fetches row, which corresponds to specified index row in the associated
cursor object. Row index should greater than zero. Method can throw cursor exception.
int seekForAbsRow(int iAbsRow)
Method return index row (position of row in index) for specified row index in the associated cursor object.