69f8f2e39762a07c31e33a52d71dc58b331f4a0d angie Mon Jun 23 10:20:19 2014 -0700 Removed getFilters method from annoStreamer because it's not needed andit requires annoFilterCloneList, which I'm going to get rid of next because it requires too much knowledge about the contents of the filters. Also adding addFilters method for incrementally building up filters. diff --git src/inc/annoStreamer.h src/inc/annoStreamer.h index 0b2836a..d6ba052 100644 --- src/inc/annoStreamer.h +++ src/inc/annoStreamer.h @@ -11,42 +11,42 @@ // implementations. The purpose of this module is to provide an // interface for communication with other components of the // annoGratorQuery framework, and simple methods shared by all // subclasses. struct annoStreamer /* Generic interface to configure a data source's filters and output data, and then * retrieve data, which must be sorted by genomic position. Subclasses of this * will do all the actual work. */ { struct annoStreamer *next; // Public methods struct asObject *(*getAutoSqlObject)(struct annoStreamer *self); void (*setAutoSqlObject)(struct annoStreamer *self, struct asObject *asObj); - /* Get and set autoSql representation (do not modify or free!) */ + /* Get and set autoSql representation (do not modify or free asObj!) */ void (*setRegion)(struct annoStreamer *self, char *chrom, uint rStart, uint rEnd); /* Set genomic region for query; if chrom is NULL, region is whole genome. * This must be called on all annoGrator components in query, not a subset. */ char *(*getHeader)(struct annoStreamer *self); /* Get the file header as a string (possibly NULL, possibly multi-line). */ - struct annoFilter *(*getFilters)(struct annoStreamer *self); void (*setFilters)(struct annoStreamer *self, struct annoFilter *newFilters); - /* Get and set filters */ + void (*addFilters)(struct annoStreamer *self, struct annoFilter *newFilters); + /* Set/add filters. Memory management of filters is up to caller. */ struct annoRow *(*nextRow)(struct annoStreamer *self, char *minChrom, uint minEnd, struct lm *lm); /* Get the next item from this source. If minChrom is non-NULL, optionally use * that as a hint to skip items that precede {minChrom, minEnd}. * Use localmem lm to store returned annoRow. */ void (*close)(struct annoStreamer **pSelf); /* Close connection to source and free self. */ // Public members -- callers are on the honor system to access these read-only. struct annoAssembly *assembly; // Genome assembly that provides coords for annotations struct asObject *asObj; // Annotation data definition char *name; // Short identifier, e.g. name of file or database table struct annoFilter *filters; // Filters to constrain output @@ -66,35 +66,36 @@ }; // ---------------------- annoStreamer default methods ----------------------- struct asObject *annoStreamerGetAutoSqlObject(struct annoStreamer *self); /* Return parsed autoSql definition of this streamer's data type. */ void annoStreamerSetAutoSqlObject(struct annoStreamer *self, struct asObject *asObj); /* Use new asObj and update internal state derived from asObj. */ void annoStreamerSetRegion(struct annoStreamer *self, char *chrom, uint rStart, uint rEnd); /* Set genomic region for query; if chrom is NULL, position is genome. * Many subclasses should make their own setRegion method that calls this and * configures their data connection to change to the new position. */ -struct annoFilter *annoStreamerGetFilters(struct annoStreamer *self); -/* Return supported filters with current settings. Callers can modify and free when done. */ - void annoStreamerSetFilters(struct annoStreamer *self, struct annoFilter *newFilters); -/* Free old filters and use clone of newFilters. */ +/* Replace any existing filters with newFilters. It is up to calling code to + * free old filters and allocate newFilters. */ + +void annoStreamerAddFilters(struct annoStreamer *self, struct annoFilter *newFilters); +/* Add newFilter(s). It is up to calling code to allocate newFilters. */ void annoStreamerInit(struct annoStreamer *self, struct annoAssembly *assembly, struct asObject *asObj, char *name); /* Initialize a newly allocated annoStreamer with default annoStreamer methods and * default filters and columns based on asObj. * In general, subclasses' constructors will call this first; override nextRow, close, * and probably setRegion; and then initialize their private data. */ void annoStreamerFree(struct annoStreamer **pSelf); /* Free self. This should be called at the end of subclass close methods, after * subclass-specific connections are closed and resources are freed. */ boolean annoStreamerFindBed3Columns(struct annoStreamer *self, int *retChromIx, int *retStartIx, int *retEndIx, char **retChromField, char **retStartField, char **retEndField);