home *** CD-ROM | disk | FTP | other *** search
- //
- // Database.h
- // Copyright (c) 1990 by Jiro Nakamura
- // All rights reserved
- //
- //
- // RCS Information
- // Revision Number-> $Revision: 1.7 $
- // Last Revised-> $Date: 90/01/08 02:51:11 $
- //
-
- #import <objc/Object.h>
- #import "cass.h"
- #import "eventStructure.h"
-
-
- @interface EventDatabase : Object
- {
- struct eventStructure database[MAX_EVENTS];
-
- // Database file
- char dataFile[128];
- }
- + new;
- + newAt: (char *) filename;
- - free;
-
-
- // Method: (int) readRecord: (RecordPointer) here
- // Arguments: (RecordPointer) here -> the RecordPointer in the queue to
- // read from
- // Description: Reads the record directly from the queue with <here> as
- // the index.
- // Return Value: Error code. 0 if no error.
- - (int) readRecord: (RecordPointer) here;
-
-
- // Method: (int) writeRecord: (RecordPointer) here
- // Arguments: (RecordPointer) here -> the RecordPointer in the queue to
- // write to
- // Description: Writes the record directly into the queue with <here>
- // as the index. Note that this is not an insert, so
- // the next and previous pointers from the last read from
- // this event should be preserved
- // or new pointers should be made and changed appopriately.
- // Return Value: Error code.
- - (int) writeRecord : (RecordPointer) here;
-
-
- /* Higher level methods that deal somewhat abstractly with the database */
-
- // Method: (int) firstRecord
- // Arguments: None.
- // Description: reads the first record. Equivalent to:
- // [database readRecord:0];
- // [database readRecord: [database next]];
- // Returns with the first record read into its internals
- // Return Value: Error code.
- - (int) firstRecord;
-
-
- // Method: (RecordPointer) insertRecord
- // Arguments: None, event to be inserted must be already in object
- // Description: Inserts itself into the queue.
- // Requires method -> (int) compareRecords::
- // insertRecord is equivalent to insertRecordFrom: 1
- // Return Value: The particular RecordPointer that it inserted itself into.
- - (RecordPointer) insertRecord;
-
-
- // Method: (RecordPointer) insertRecordFrom: (RecordPointer) here
- // Arguments: (RecordPointer) here -> start inserting from <here>
- // Description: Same as insertRecord except that the search for empty
- // recordss starts from <here>, so that if you KNOW where an
- // deleted RecordPointer is, then you can use this method to
- // speed things up somewhat.
- // ReturnValue: The particular RecordPointer that it inserted itself into.
- - (RecordPointer) insertRecordFrom: (RecordPointer) here;
-
-
- // Method: deleteRecord: (RecordPointer) here
- // Arguments: (RecordPointer) here -> the event to delete
- // Description: Delete the event <here>
- // Return Value: <self>
- - deleteRecord : (RecordPointer) here;
-
-
- // Method: setDefaults
- // Arguments: none
- // Description: Used to set up the default values of the variables.
- // Return Value: <self>
- - setDefaults;
-
- // Method: (int) indexCompare: (id) first : (id) second
- - (int) indexCompare: (id) first with: (id) second;
-
-
- /* Accessors & Modifiers*/
- /* See heading above for description of these variables */
- - (RecordPointer) present;
- - (RecordPointer) previous;
- - (RecordPointer) next;
- - (const char *) dataFile;
-
- - setPresent: (RecordPointer) here;
- - setNext: (RecordPointer) here;
- - setPrevious: (RecordPointer) here;
- - setDataFile: (char *) filename;
- @end
-
-
-