f8d9f22ac79fba7f0ceb26e1e737b0b1c116490f kent Wed Feb 4 23:07:26 2015 -0800 Added functions to index a field. diff --git src/inc/fieldedTable.h src/inc/fieldedTable.h index c212ce3..e4a8606 100644 --- src/inc/fieldedTable.h +++ src/inc/fieldedTable.h @@ -28,17 +28,23 @@ struct fieldedTable *fieldedTableNew(char *name, char **fields, int fieldCount); /* Create a new empty fieldedTable with given name, often a file name. */ void fieldedTableFree(struct fieldedTable **pTable); /* Free up memory resources associated with table. */ struct fieldedRow *fieldedTableAdd(struct fieldedTable *table, char **row, int rowSize, int id); /* Create a new row and add it to table. Return row. */ struct fieldedTable *fieldedTableFromTabFile(char *fileName, char *url, char *requiredFields[], int requiredCount); /* Read table from tab-separated file with a #header line that defines the fields. Ensures * all requiredFields (if any) are present. The url is just used for error reporting and * should be the same as fileName for most purposes. This is used by edwSubmit though which * first copies to a local file, and we want to report errors from the url. */ +struct hash *fieldedTableIndex(struct fieldedTable *table, char *field); +/* Return hash of fieldedRows keyed by values of given field */ + +struct hash *fieldedTableUniqueIndex(struct fieldedTable *table, char *field); +/* Return hash of fieldedRows keyed by values of given field, which must be unique. */ + #endif /* FIELDEDTABLE_H */