#include <sxindex.h>
Public Member Functions |
|
sxIndex () | |
sxIndex (int s, int x, int e, sxIterator *i) | |
void | write (string filename) |
void | read (string filename) |
off_t | find (unsigned long i) |
sxIndex builds an index for quick retreival of sxRecords. This is especially important in large files. To build an index, there needs to be a unique integer value that represents a series of numeric punches across columns for every sxRecord. In a voting system, this might be a voter id, etc.
sx360::sxIndex::sxIndex | ( | |
) | [inline] |
sx360::sxIndex::sxIndex | ( | int | s, | |
int | x, | |||
int | e, | |||
sxIterator * | i | |||
) | [inline] |
Constructor to build a an index.
Parameters:
s = the card where the index starts
x = the column in each record where the index starts
e = the ending column where the record ends
i = the sxIterator that will traverse the records
such as:
sxIndex idx( 1, 1, 5, i );
will create an index starting on card 1, column 1, ending on column 5, using the iterator assumed here to be 'i'.
void sx360::sxIndex::write | ( | string | filename | ) | [inline] |
Writes the index to the file in filename
void sx360::sxIndex::read | ( | string | filename | ) | [inline] |
Reads the index file from filename
off_t sx360::sxIndex::find | ( | unsigned long | i | ) | [inline] |
Returns the 0 based index of the record specified or -1 if not found.