25c8c6fbc1b49012dcde16119ddb1be663ede442 angie Fri Jun 1 11:43:04 2012 -0700 Refactoring for #6152: there's nothing formatter-specific about annoFormatterOption,so move it out into independent annoOption. diff --git src/inc/annoFormatter.h src/inc/annoFormatter.h index 51b3b85..d228382 100644 --- src/inc/annoFormatter.h +++ src/inc/annoFormatter.h @@ -1,62 +1,54 @@ /* annoFormatter -- aggregates, formats and writes output from multiple sources */ #ifndef ANNOFORMATTER_H #define ANNOFORMATTER_H +#include "annoOption.h" #include "annoRow.h" #include "annoStreamer.h" -#include "options.h" // The real work of aggregating and formatting data is left to // subclass 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 annoFormatterOption -/* A named and typed option and its value. */ - { - struct annoFormatterOption *next; - struct optionSpec spec; - void *value; - }; - struct annoFormatter /* Generic interface to aggregate data fields from multiple sources and write * output. */ { struct annoFormatter *next; // Public methods - struct annoFormatterOption *(*getOptions)(struct annoFormatter *self); - void (*setOptions)(struct annoFormatter *self, struct annoFormatterOption *options); + struct annoOption *(*getOptions)(struct annoFormatter *self); + void (*setOptions)(struct annoFormatter *self, struct annoOption *options); /* Get and set output options */ void (*initialize)(struct annoFormatter *self, struct annoGratorQuery *query); /* Initialize output (header, etc) and set query pointer */ void (*formatOne)(struct annoFormatter *self, struct annoRow *primaryRow, struct slRef *gratorRowList); /* Aggregate all sources' data for a single primarySource item into output. */ void (*close)(struct annoFormatter **pSelf); /* End of input; finish output, close connection/handle and free self. */ // Private members -- callers are on the honor system to access these using only methods above. - struct annoFormatterOption *options; + struct annoOption *options; struct annoGratorQuery *query; }; // ---------------------- annoFormatter default methods ----------------------- -struct annoFormatterOption *annoFormatterGetOptions(struct annoFormatter *self); +struct annoOption *annoFormatterGetOptions(struct annoFormatter *self); /* Return supported options and current settings. Callers can modify and free when done. */ -void annoFormatterSetOptions(struct annoFormatter *self, struct annoFormatterOption *newOptions); +void annoFormatterSetOptions(struct annoFormatter *self, struct annoOption *newOptions); /* Free old options and use clone of newOptions. */ void annoFormatterFree(struct annoFormatter **pSelf); /* Free self. This should be called at the end of subclass close methods, after * subclass-specific connections are closed and resources are freed. */ #endif//ndef ANNOFORMATTER_H