|
Re: [patch #5690] Clean up case code: msg#00074statistics.pspp.devel
John Darrington <john@xxxxxxxxxxxxxxx> writes: > I can see two alternative ways to overcome this, but neither are > particularly nice: > > 1. Copy the case locally, write to it, and replace it into the > flexifile. This wouldn't be very efficient if we're dealing with > very large cases. > > 2. Introduce some kind of special case for use in flexifiles which > allows writing. 3. Fix the flexifile implementation. This is what I'm doing right now. Progress is slow because I have little time, but it'll eventually be ready. The new flexifile has "get case" and "put case" operations for reading and writing arbitrary cases. Here's the current header file. It uses a casereader instead of a casefile because casefiles have gone away in my source tree. Currently I'm calling it a "datasheet" instead of a flexifile because that seems to be a better name given that my reworked source tree has no need for casefiles or multiple implementations of casefiles or casefile factories. Trust me, it's an improvement. Maybe "datasheet" is too close to a name used in the GUI code. In that case I'm open to other names; I could even go back to flexifile if you prefer. #ifndef DATA_DATASHEET_H #define DATA_DATASHEET_H 1 #include <data/case.h> #include <data/value.h> struct casereader; /* A datasheet is a 2-d array of data that may be stored in memory or on disk. It efficiently supports data storage and retrieval, as well as adding, removing, and rearranging both rows and columns. */ struct datasheet *datasheet_create (struct casereader *); void datasheet_destroy (struct datasheet *); struct casereader *datasheet_make_reader (struct datasheet *); casenumber datasheet_get_case_count (const struct datasheet *); size_t datasheet_get_value_count (const struct datasheet *); /* Columns. */ void datasheet_insert_values (struct datasheet *, const union value[], size_t cnt, size_t before); void datasheet_delete_values (struct datasheet *, size_t start, size_t cnt); void datasheet_move_values (struct datasheet *, size_t old_start, size_t new_start, size_t cnt); void datasheet_reorder_values (struct datasheet *, size_t *ordering, size_t cnt); /* Rows. */ bool datasheet_get_case (struct datasheet *, casenumber, struct ccase *); bool datasheet_put_case (struct datasheet *, casenumber, struct ccase *); void datasheet_insert_cases (struct datasheet *, casenumber before, struct ccase *, casenumber cnt); void datasheet_delete_cases (struct datasheet *, casenumber first, casenumber cnt); #endif /* data/datasheet.h */ -- Ben Pfaff blp@xxxxxxxxxxxxxxx http://benpfaff.org |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [patch #5690] Clean up case code: 00074, John Darrington |
|---|---|
| Next by Date: | Re: [patch #5690] Clean up case code: 00074, Ben Pfaff |
| Previous by Thread: | Re: [patch #5690] Clean up case codei: 00074, John Darrington |
| Next by Thread: | Re: [patch #5690] Clean up case code: 00074, Ben Pfaff |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |