home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / EODEV.Z / EOGlobalID.h < prev    next >
Encoding:
Text File  |  1996-09-11  |  1.7 KB  |  51 lines

  1. // EOGlobalID.h
  2. // Copyright (c) 1995, NeXT Software, Inc. All rights reserved. 
  3. //
  4. // The EOGlobalID is a compact universal ID for a persistent object
  5. // and is the key used for uniquing.  A EOGlobalID should be suitable
  6. // for identifying objects between editing contexts both within
  7. // an application and across application instances (such as when performing
  8. // distributed change notification).
  9. //
  10. #import <Foundation/Foundation.h>
  11. #import <EOControl/EODefines.h>
  12.  
  13. // When a newly inserted object becomes persistent, the global ID is changed
  14. // from a temporary one to a more permanent one. Whenever a swap is made the
  15. // following notification needs to be published so that anyone holding the
  16. // original TemporaryGlobalID can change it for the new one. The userInfo
  17. // dictionary contains a mapping of old globalIDs to the new ones.
  18. //
  19. EOCONTROL_EXTERN NSString *EOGlobalIDChangedNotification;
  20.  
  21. // Abstract class for all ids
  22. @interface EOGlobalID : NSObject <NSCopying>
  23. - (BOOL)isEqual:other;
  24. - (unsigned)hash;
  25.  
  26. - (BOOL)isTemporary;
  27.     // NO by default 
  28. @end
  29.  
  30. // EOTemporaryGlobalID is used by the editing context whenever an object
  31. // is inserted with a nil GlobalID
  32. //
  33. @interface EOTemporaryGlobalID : EOGlobalID <NSCoding>
  34. {
  35.    unsigned _uintValue;
  36.    unsigned _refCount;
  37. }
  38.  
  39. - init;
  40.     // automatically assignes a new sequence number
  41.  
  42. - (BOOL)isTemporary;
  43.     // Always YES
  44.  
  45. - (void)encodeWithCoder:(NSCoder *)aCoder;
  46. - (id)initWithCoder:(NSCoder *)aDecoder;
  47.     // TemporaryGlobalIDs are not globally unique when archived -- they are unique
  48.     // only to one instance of a single process.  Passing them between processes
  49.     // generally won't work unless only one of the processes ever allocates ids
  50. @end
  51.