f970f8e2fd81d08901048b2070054dd71ed7f1f1 angie Tue Apr 9 11:47:57 2013 -0700 Use localmem for annoRow storage, instead of many independent malloc & free calls. refs #6152 diff --git src/inc/annoRow.h src/inc/annoRow.h index 4cc75dc..3782c29 100644 --- src/inc/annoRow.h +++ src/inc/annoRow.h @@ -1,50 +1,43 @@ /* annoRow -- basic data interchange unit of annoGratorQuery framework. */ #ifndef ANNOROW_H #define ANNOROW_H #include "common.h" +#include "localmem.h" enum annoRowType { arUnknown, arWords, arWig, arVcf }; -// stub in order to avoid problems with circular .h references: -struct annoStreamer; - struct annoRow /* Representation of a row from a database table or file. The chrom, start and end * facilitate intersection by position. If type is arWords, then data is an array * of strings corresponding to columns in the autoSql definition provided by the * source of the annoRow. If type is arWig, then data is an array of floats. * rightJoinFail is true if this row failed a filter marked as rightJoin, meaning it * can knock out the primary row (see annoFilter.h). */ { struct annoRow *next; char *chrom; uint start; uint end; void *data; boolean rightJoinFail; }; struct annoRow *annoRowFromStringArray(char *chrom, uint start, uint end, boolean rightJoinFail, - char **wordsIn, int numCols); + char **wordsIn, int numCols, struct lm *lm); /* Allocate & return an annoRow with data cloned from wordsIn. */ struct annoRow *annoRowWigNew(char *chrom, uint start, uint end, boolean rightJoinFail, - float *values); + float *values, struct lm *lm); /* Allocate & return an annoRowWig, with clone of values; length of values is (end-start). */ -struct annoRow *annoRowClone(struct annoRow *rowIn, struct annoStreamer *source); -/* Allocate & return a single annoRow cloned from rowIn. - * numCols is used only if rowIn->type is arWords. */ - -void annoRowFree(struct annoRow **pRow, struct annoStreamer *source); -/* Free a single annoRow. */ - -void annoRowFreeList(struct annoRow **pList, struct annoStreamer *source); -/* Free a list of annoRows. */ +struct annoRow *annoRowClone(struct annoRow *rowIn, enum annoRowType rowType, int numCols, + struct lm *lm); +/* Allocate & return a single annoRow cloned from rowIn. If rowIn is NULL, return NULL. + * If type is arWig, numCols is ignored. */ int annoRowCmp(const void *va, const void *vb); /* Compare two annoRows' {chrom, start, end}. */ #endif//ndef ANNOROW_H