home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Scheduling / Cassandra / Source / future / convert / EventDatabase.h < prev    next >
Encoding:
Text File  |  1990-06-10  |  3.3 KB  |  112 lines

  1. //
  2. // Database.h
  3. // Copyright (c) 1990 by Jiro Nakamura 
  4. // All rights reserved
  5. //
  6. //
  7. // RCS Information
  8. // Revision Number->    $Revision: 1.7 $
  9. // Last Revised->    $Date: 90/01/08 02:51:11 $
  10. //
  11.  
  12. #import <objc/Object.h>
  13. #import "cass.h"
  14. #import "eventStructure.h"
  15.  
  16.  
  17. @interface EventDatabase : Object
  18. {
  19.     struct eventStructure database[MAX_EVENTS];
  20.  
  21.     // Database file
  22.     char dataFile[128];
  23. }
  24. + new;
  25. + newAt: (char *) filename;
  26. - free;
  27.  
  28.  
  29. // Method:        (int) readRecord: (RecordPointer) here
  30. // Arguments:        (RecordPointer) here  -> the RecordPointer in the queue to 
  31. //            read from
  32. // Description:        Reads the record directly from the queue with <here> as
  33. //            the index.
  34. // Return Value:    Error code. 0 if no error.
  35. - (int) readRecord: (RecordPointer) here;    
  36.  
  37.  
  38. // Method:        (int) writeRecord: (RecordPointer) here
  39. // Arguments:        (RecordPointer) here  -> the RecordPointer in the queue to 
  40. //            write to
  41. // Description:        Writes the record directly into the queue with <here> 
  42. //            as the index. Note that this is not an insert, so 
  43. //            the next and previous pointers from the last read from 
  44. //            this event should be preserved
  45. //            or new pointers should be made and changed appopriately.
  46. // Return Value:    Error code.
  47. - (int) writeRecord : (RecordPointer) here;     
  48.  
  49.  
  50. /* Higher level methods that deal somewhat abstractly with the database */        
  51.  
  52. // Method:        (int) firstRecord
  53. // Arguments:        None.
  54. // Description:        reads the first record. Equivalent to:
  55. //                [database readRecord:0];
  56. //                [database readRecord:  [database next]];
  57. //             Returns with the first record read into its internals
  58. // Return Value:    Error code.
  59. - (int) firstRecord;            
  60.  
  61.  
  62. // Method:        (RecordPointer) insertRecord
  63. // Arguments:        None, event to be inserted must be already in object
  64. // Description:        Inserts itself into the queue. 
  65. //            Requires method -> (int) compareRecords::
  66. //            insertRecord is equivalent to insertRecordFrom: 1
  67. // Return Value:    The particular RecordPointer that it inserted itself into.
  68. - (RecordPointer) insertRecord;    
  69.  
  70.  
  71. // Method:        (RecordPointer) insertRecordFrom: (RecordPointer) here
  72. // Arguments:        (RecordPointer) here   -> start inserting from <here>
  73. // Description:        Same as insertRecord except that the search for empty 
  74. //            recordss starts from <here>, so that if you KNOW where an
  75. //            deleted RecordPointer is, then you can use this method to
  76. //             speed things up somewhat.
  77. // ReturnValue:    The particular RecordPointer that it inserted itself into.
  78. - (RecordPointer) insertRecordFrom: (RecordPointer) here;
  79.  
  80.  
  81. // Method:        deleteRecord: (RecordPointer) here
  82. // Arguments:        (RecordPointer) here   -> the event to delete
  83. // Description:        Delete the event <here>
  84. // Return Value:    <self>
  85. - deleteRecord : (RecordPointer) here;    
  86.  
  87.  
  88. // Method:        setDefaults
  89. // Arguments:        none
  90. // Description:        Used to set up the default values of the variables.
  91. // Return Value:    <self>
  92. - setDefaults;
  93.  
  94. // Method:        (int) indexCompare: (id) first : (id) second
  95. - (int) indexCompare: (id) first   with: (id) second;
  96.  
  97.  
  98. /*  Accessors & Modifiers*/
  99. /* See heading above for description of these variables */
  100. - (RecordPointer) present;    
  101. - (RecordPointer) previous;
  102. - (RecordPointer) next;
  103. - (const char *)  dataFile;
  104.  
  105. - setPresent: (RecordPointer) here;
  106. - setNext: (RecordPointer) here;
  107. - setPrevious: (RecordPointer) here;
  108. - setDataFile: (char *) filename;
  109. @end
  110.  
  111.  
  112.