25 #import "CoreDataHeaders.h"
26 #import "GSPersistentStore.h"
28 @interface NSManagedObjectID (GSCoreDataInternal)
30 + (void) willBecomeMultiThreaded: (NSNotification *) notif;
44 [[NSNotificationCenter defaultCenter]
46 selector: @selector(willBecomeMultiThreaded:)
47 name: NSWillBecomeMultiThreadedNotification
54 TEST_RELEASE(_persistentStore);
55 TEST_RELEASE(_entity);
76 return (_persistentStore == nil);
85 return _persistentStore;
95 if (_persistentStore == nil)
102 objectForKey: NSStoreUUIDKey];
104 return [NSURL URLWithString: [NSString stringWithFormat:
105 @"%@/%@/%llX", UUID, [_entity name], _value]];
118 if ([_entity isEqual: [otherID
entity]] == NO)
139 - (BOOL) isEqual: (
id) otherObject
143 return [
self isEqualToManagedObjectID: otherObject];
153 - (id) copyWithZone: (NSZone *) zone
156 _initWithEntity: _entity
157 persistentStore: _persistentStore
163 @implementation NSManagedObjectID (GSCoreDataPrivate)
171 static unsigned long long nextTemporaryID = 0;
176 static NSRecursiveLock * lock = nil;
178 - (id) _initWithEntity: (NSEntityDescription *) entity
180 if ((
self = [super init]))
182 ASSIGN(_entity, entity);
189 _value = nextTemporaryID;
196 _value = nextTemporaryID;
203 - (id) _initWithEntity: (NSEntityDescription *) entity
205 value: (
unsigned long long) value
207 if ((
self = [super init]))
209 ASSIGN(_entity, entity);
210 ASSIGN(_persistentStore, persistentStore);
217 - (
unsigned long long) _value
224 @implementation NSManagedObjectID (GSCoreDataInternal)
231 + (void) willBecomeMultiThreaded: (NSNotification *) notif
233 lock = [NSRecursiveLock new];
235 [[NSNotificationCenter defaultCenter] removeObserver: self];