cfe9afe019db302a08e0cc40ae19e7541540f2d7 angie Wed Jan 7 12:12:11 2015 -0800 Added annoStreamer{Get,Set}Name so that we're not stuck with awfully long filenames etc. diff --git src/inc/annoStreamer.h src/inc/annoStreamer.h index d6ba052..7401bfb 100644 --- src/inc/annoStreamer.h +++ src/inc/annoStreamer.h @@ -13,30 +13,34 @@ // 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 asObj!) */ + char *(*getName)(struct annoStreamer *self); + void (*setName)(struct annoStreamer *self, char *name); + /* Get and set name (short identifier, unique among streamers in a query). */ + 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). */ void (*setFilters)(struct annoStreamer *self, struct annoFilter *newFilters); 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}. @@ -61,30 +65,36 @@ struct annoStreamRows /* An annoStreamer and (possibly NULL) list of rows it generated. */ { struct annoStreamer *streamer; // annoStreamer interface for metadata about row data struct annoRow *rowList; // row data }; // ---------------------- 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. */ +char *annoStreamerGetName(struct annoStreamer *self); +/* Returns cloned name of streamer; free when done. */ + +void annoStreamerSetName(struct annoStreamer *self, char *name); +/* Sets streamer name to clone of name. */ + 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. */ void annoStreamerSetFilters(struct annoStreamer *self, struct annoFilter *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