home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer) / NeXT_Developer-3.3.iso / NextDeveloper / Examples / IndexingKit / Ledger / GlobalThings.m < prev    next >
Encoding:
Text File  |  1993-01-25  |  925 b   |  47 lines

  1. /*
  2.  * Stores the serial number used during the lifetime of the store.
  3.  *
  4.  * Author: Kris Younger, NeXT Systems Engineering
  5.  * You may freely copy, distribute and reuse the code in this example.  
  6.  * NeXT disclaims any warranty of any kind, expressed or implied, as to 
  7.  * its fitness for any particular use.
  8.  */
  9. #import "GlobalThings.h"
  10.  
  11. @implementation GlobalThings
  12. - init
  13. {
  14.     currentSerial = 1;
  15.     return self;
  16. }
  17. - (const char *)identification
  18. {
  19.     return GLOBALVARIDENT;
  20. }
  21. /* implement IXRecordTranscription protocol for faster serialization. */
  22. - (unsigned int)handle { return runTimeHandle; }
  23.  
  24. - source: aSource didReadRecord:(unsigned)record
  25. {
  26.     return self;
  27. }
  28.  
  29. - source:aSource willWriteRecord:(unsigned)record
  30. {
  31.     if (runTimeHandle == 0) runTimeHandle = record;
  32.     return self;
  33. }
  34.  
  35. - (int)currentSerial
  36. {
  37.     return currentSerial;
  38. }
  39.  
  40. - (int)consumeSerial
  41. {
  42.     currentSerial += 1;
  43.     return currentSerial;
  44. }
  45.  
  46. @end
  47.