pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch #5690] Clean up case code


From: John Darrington
Subject: Re: [patch #5690] Clean up case code
Date: Wed, 31 Jan 2007 06:22:41 +0900
User-agent: Mutt/1.5.9i

On Tue, Jan 30, 2007 at 06:34:09AM -0800, Ben Pfaff wrote:
        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.  
        
Does this mean that random case access is now as efficient as
sequential access?  Based upon previous discussions, that would seem
to be a rather fundamental axiom.  

        Trust me,         it's an improvement.
Good!
     
        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.

Maybe data_model would be better --- in the MVC paradigm the datasheet
is the thing which views the data whereas the data-model is the
description of how the data presents itself.


 I'm not particularly concerned about efficiency of writing to
 individual cases.  We're talking about interactive editing of a
 data sheet, right?  It only has to be fast enough that an
 interactive user won't notice a delay.  That's a pretty loose
 requirement.

That was my thinking too.

     
     #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 
     address@hidden
     http://benpfaff.org
     
     
     _______________________________________________
     pspp-dev mailing list
     address@hidden
     http://lists.gnu.org/mailman/listinfo/pspp-dev

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]