home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / store / protocols.h < prev   
Text File  |  1993-02-18  |  4KB  |  105 lines

  1. /*
  2. protocols.h
  3. Copyright 1991,NeXT Computer,Inc.
  4. */
  5.  
  6. #import    <objc/objc.h>
  7.  
  8. @class IXStore;
  9.  
  10. #define IX_STOREUSERERRBASE    (9000)
  11. #define IX_STOREMACHERRBASE    IX_STOREUSERERRBASE + (100)
  12. #define IX_STOREUNIXERRBASE    IX_STOREUSERERRBASE + (300)
  13.  
  14. typedef enum IXStoreErrorType    {
  15.     IX_NoError = IX_STOREUSERERRBASE, 
  16.     IX_InternalError, 
  17.     IX_ArgumentError, 
  18.     IX_QueryEvalError, 
  19.     IX_QueryTypeError, 
  20.     IX_QueryAttrError, 
  21.     IX_QueryImplError, 
  22.     IX_QueryYaccError, 
  23.     IX_MemoryError, 
  24.     IX_LockedError, 
  25.     IX_MachineError, 
  26.     IX_VersionError, 
  27.     IX_DamagedError, 
  28.     IX_DuplicateError, 
  29.     IX_NotFoundError, 
  30.     IX_TooLargeError, 
  31.     IX_UnixErrorBase = IX_STOREUNIXERRBASE, 
  32.     IX_MachErrorBase = IX_STOREMACHERRBASE
  33. } IXStoreErrorType;
  34.  
  35. // An object that conforms to this protocol is a store client.  It is a pseudo 
  36. // persistent object, meaning that the run time representation of the object 
  37. // may be freed, and later reconsituted by activation from persistent data in a 
  38. // store.  Every store client has a bootstrap handle; this is the handle of a 
  39. // block from which all other blocks managed by the store client are reachable.
  40.  
  41. @protocol IXBlockAndStoreAccess
  42.  
  43. // Frees a store client of the receiving class from the designated bootstrap 
  44. // handle in the designated store.  This may involve instantiating the store 
  45. // client from the designated handle and store, then sending it freeFromStore.
  46.  
  47. + freeFromBlock:(unsigned)aHandle inStore:(IXStore *)aStore;
  48.  
  49. // Frees the run time representation of a store client, and frees all blocks 
  50. // allocated by the store client from the store.
  51.  
  52. - freeFromStore;
  53.  
  54. // Finds the bootstrap handle and store of a store client.  This is enough 
  55. // information to later reconsitute another run time representation of the 
  56. // store client.
  57.  
  58. - getBlock:(unsigned *)aHandle andStore:(IXStore **)aStore;
  59.  
  60. // Creates a store client of the receiving class in the designated store, 
  61. // allocating at least the bootstrap handle, and initializes the run time 
  62. // representation.
  63.  
  64. - initInStore:(IXStore *)aStore;
  65.  
  66. // Reconstitutes and initializes a run time representation of a store client of 
  67. // the receving class from the designated bootstrap handle and store.
  68.  
  69. - initFromBlock:(unsigned)aHandle inStore:(IXStore *)aStore;
  70.  
  71. @end
  72.  
  73. // An object that conforms to this protocol uses an IXStoreDirectory to 
  74. // bootstrap from an object name and a file name, rather than from a bootstrap 
  75. // handle.  By convention, the IXStoreDirectory is bootstrapped from the 
  76. // distinguished block handle, 1.
  77.  
  78. @protocol IXNameAndFileAccess <IXBlockAndStoreAccess>
  79.  
  80. // Performs + freeFromBlock:inStore: for the designated object in the 
  81. // designated file.
  82.  
  83. + freeFromName:(const char *)aName inFile:(const char *)aFile;
  84.  
  85. // Returns the object name and file name of a store client.  This is enough 
  86. // information to later reconsitute another run time representation of the 
  87. // store client.
  88.  
  89. - getName:(const char **)aName andFile:(const char **)aFile;
  90.  
  91. // Creates a store client of the receiving class in the designated file, 
  92. // allocating at least the bootstrap handle, and initializes the run time 
  93. // representation.  Creates the IXStoreDirectory, if necessary.
  94.  
  95. - initWithName:(const char *)aName inFile:(const char *)aFile;
  96.  
  97. // Reconstitutes and initializes a run time representation of a store client of 
  98. // the receving class from the designated object name and file name.
  99.  
  100. - initFromName:(const char *)aName inFile:(const char *)aFile 
  101.     forWriting:(BOOL)writingFlag;
  102.  
  103. @end
  104.  
  105.