mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
concrete pointer functions class added ... incomplete
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27834 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b3da05d398
commit
7df8c0e140
6 changed files with 503 additions and 62 deletions
|
@ -1,3 +1,12 @@
|
|||
2009-02-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSConcretePointerFunctions.h:
|
||||
* Source/NSConcretePointerFunctions.m:
|
||||
* Source/NSPointerFunctions.m:
|
||||
* Source/NSPointerArray.m:
|
||||
* Source/GNUmakefile:
|
||||
Partial implementation of concrete pointer functions class.
|
||||
|
||||
2009-02-09 Xavier Glattard <xavier.glattard@online.fr>
|
||||
|
||||
* Headers/Foundation/NSPredicate.h:
|
||||
|
|
|
@ -225,6 +225,7 @@ NSPathUtilities.m \
|
|||
NSPipe.m \
|
||||
NSPointerArray.m \
|
||||
NSPointerFunctions.m \
|
||||
NSConcretePointerFunctions.m \
|
||||
NSPort.m \
|
||||
NSPortCoder.m \
|
||||
NSPortMessage.m \
|
||||
|
|
57
Source/NSConcretePointerFunctions.h
Normal file
57
Source/NSConcretePointerFunctions.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
/**Interface for NSConcretePointerFunctions for GNUStep
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: 2009
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
*/
|
||||
|
||||
#import "Foundation/NSPointerFunctions.h"
|
||||
|
||||
@interface NSConcretePointerFunctions : NSPointerFunctions
|
||||
{
|
||||
@public
|
||||
NSUInteger _options;
|
||||
|
||||
void* (*_acquireFunction)(const void *item,
|
||||
NSUInteger (*size)(const void *item), BOOL shouldCopy);
|
||||
|
||||
NSString *(*_descriptionFunction)(const void *item);
|
||||
|
||||
NSUInteger (*_hashFunction)(const void *item,
|
||||
NSUInteger (*size)(const void *item));
|
||||
|
||||
BOOL (*_isEqualFunction)(const void *item1, const void *item2,
|
||||
NSUInteger (*size)(const void *item));
|
||||
|
||||
void (*_relinquishFunction)(const void *item,
|
||||
NSUInteger (*size)(const void *item));
|
||||
|
||||
NSUInteger (*_sizeFunction)(const void *item);
|
||||
|
||||
BOOL _shouldCopyIn;
|
||||
|
||||
BOOL _usesStrongWriteBarrier;
|
||||
|
||||
BOOL _usesWeakReadAndWriteBarriers;
|
||||
}
|
||||
|
||||
@end
|
||||
|
307
Source/NSConcretePointerFunctions.m
Normal file
307
Source/NSConcretePointerFunctions.m
Normal file
|
@ -0,0 +1,307 @@
|
|||
/**Implementation for NSConcretePointerFunctions for GNUStep
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Date: 2009
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
*/
|
||||
|
||||
#import "NSConcretePointerFunctions.h"
|
||||
|
||||
static void*
|
||||
acquireMallocMemory(const void *item,
|
||||
NSUInteger (*size)(const void *item), BOOL shouldCopy)
|
||||
{
|
||||
if (shouldCopy == YES)
|
||||
{
|
||||
NSUInteger len = (*size)(item);
|
||||
void *newItem = objc_malloc(len);
|
||||
|
||||
memcpy(newItem, item, len);
|
||||
item = newItem;
|
||||
}
|
||||
return (void*)item;
|
||||
}
|
||||
|
||||
static void*
|
||||
acquireRetainedObject(const void *item,
|
||||
NSUInteger (*size)(const void *item), BOOL shouldCopy)
|
||||
{
|
||||
if (shouldCopy == YES)
|
||||
{
|
||||
return [(NSObject*)item copy];
|
||||
}
|
||||
return [(NSObject*)item retain];
|
||||
}
|
||||
|
||||
static void*
|
||||
acquireExistingMemory(const void *item,
|
||||
NSUInteger (*size)(const void *item), BOOL shouldCopy)
|
||||
{
|
||||
return (void*)item;
|
||||
}
|
||||
|
||||
static NSUInteger
|
||||
hashDirect(const void *item, NSUInteger (*size)(const void *item))
|
||||
{
|
||||
return (NSUInteger)item;
|
||||
}
|
||||
|
||||
static NSUInteger
|
||||
hashObject(const void *item, NSUInteger (*size)(const void *item))
|
||||
{
|
||||
return [(NSObject*)item hash];
|
||||
}
|
||||
|
||||
static NSUInteger
|
||||
hashMemory(const void *item, NSUInteger (*size)(const void *item))
|
||||
{
|
||||
unsigned len = (*size)(item);
|
||||
NSUInteger hash = 0;
|
||||
|
||||
while (len-- > 0)
|
||||
{
|
||||
hash = (hash << 5) + hash + *(const uint8_t*)item++;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
static NSUInteger
|
||||
hashShifted(const void *item, NSUInteger (*size)(const void *item))
|
||||
{
|
||||
return ((NSUInteger)item) >> 2;
|
||||
}
|
||||
|
||||
static NSUInteger
|
||||
hashString(const void *item, NSUInteger (*size)(const void *item))
|
||||
{
|
||||
NSUInteger hash = 0;
|
||||
|
||||
while (*(const uint8_t*)item != 0)
|
||||
{
|
||||
hash = (hash << 5) + hash + *(const uint8_t*)item++;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
static void
|
||||
relinquishMallocMemory(const void *item,
|
||||
NSUInteger (*size)(const void *item))
|
||||
{
|
||||
objc_free((void*)item);
|
||||
}
|
||||
|
||||
static void
|
||||
relinquishRetainedMemory(const void *item,
|
||||
NSUInteger (*size)(const void *item))
|
||||
{
|
||||
#if !GS_WITH_GC
|
||||
[(NSObject*)item release];
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
relinquishZeroingWeakMemory(const void *item,
|
||||
NSUInteger (*size)(const void *item))
|
||||
{
|
||||
#if GS_WITH_GC
|
||||
GSAssignZeroingWeakPointer((void**)&item, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@implementation NSConcretePointerFunctions
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)zone
|
||||
{
|
||||
return (id) NSAllocateObject(self, 0, zone);
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
return NSCopyObject(self, 0, zone);
|
||||
}
|
||||
|
||||
- (id) initWithOptions: (NSPointerFunctionsOptions)options
|
||||
{
|
||||
_options = options;
|
||||
|
||||
/* First we look at the memory management options to see which function
|
||||
* should be used to relinquish contents of a container with these
|
||||
* options.
|
||||
*/
|
||||
_usesWeakReadAndWriteBarriers = YES;
|
||||
if (options & NSPointerFunctionsZeroingWeakMemory)
|
||||
{
|
||||
_relinquishFunction = relinquishZeroingWeakMemory;
|
||||
}
|
||||
else if (options & NSPointerFunctionsOpaqueMemory)
|
||||
{
|
||||
_relinquishFunction = 0;
|
||||
}
|
||||
else if (options & NSPointerFunctionsMallocMemory)
|
||||
{
|
||||
_relinquishFunction = relinquishMallocMemory;
|
||||
}
|
||||
else if (options & NSPointerFunctionsMachVirtualMemory)
|
||||
{
|
||||
_relinquishFunction = relinquishMallocMemory;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Only retained pointers need the array memory to be scanned,
|
||||
* so for these we set the usesStrongWriteBarrier flag to tell
|
||||
* containers to allocate scanned memory.
|
||||
*/
|
||||
_usesStrongWriteBarrier = YES;
|
||||
_usesWeakReadAndWriteBarriers = NO;
|
||||
_relinquishFunction = relinquishRetainedMemory;
|
||||
}
|
||||
|
||||
if (options & NSPointerFunctionsCopyIn)
|
||||
{
|
||||
_shouldCopyIn = YES;
|
||||
}
|
||||
|
||||
/* Now we look at the personality options to determine other functions.
|
||||
*/
|
||||
if (options & NSPointerFunctionsOpaquePersonality)
|
||||
{
|
||||
_acquireFunction = acquireExistingMemory;
|
||||
_hashFunction = hashShifted;
|
||||
}
|
||||
else if (options & NSPointerFunctionsObjectPointerPersonality)
|
||||
{
|
||||
_acquireFunction = acquireRetainedObject;
|
||||
_hashFunction = hashShifted;
|
||||
}
|
||||
else if (options & NSPointerFunctionsCStringPersonality)
|
||||
{
|
||||
_acquireFunction = acquireMallocMemory;
|
||||
_hashFunction = hashString;
|
||||
}
|
||||
else if (options & NSPointerFunctionsStructPersonality)
|
||||
{
|
||||
_acquireFunction = acquireMallocMemory;
|
||||
_hashFunction = hashMemory;
|
||||
}
|
||||
else if (options & NSPointerFunctionsIntegerPersonality)
|
||||
{
|
||||
_acquireFunction = acquireExistingMemory;
|
||||
_hashFunction = hashDirect;
|
||||
}
|
||||
else /* objects */
|
||||
{
|
||||
_acquireFunction = acquireRetainedObject;
|
||||
_hashFunction = hashObject;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void* (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item), BOOL shouldCopy)) acquireFunction
|
||||
{
|
||||
return _acquireFunction;
|
||||
}
|
||||
|
||||
- (NSString *(*)(const void *item)) descriptionFunction
|
||||
{
|
||||
return _descriptionFunction;
|
||||
}
|
||||
|
||||
- (NSUInteger (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item))) hashFunction
|
||||
{
|
||||
return _hashFunction;
|
||||
}
|
||||
|
||||
- (BOOL (*)(const void *item1, const void *item2,
|
||||
NSUInteger (*size)(const void *item))) isEqualFunction
|
||||
{
|
||||
return _isEqualFunction;
|
||||
}
|
||||
|
||||
- (void (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item))) relinquishFunction
|
||||
{
|
||||
return _relinquishFunction;
|
||||
}
|
||||
|
||||
- (void) setAcquireFunction: (void* (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item), BOOL shouldCopy))func
|
||||
{
|
||||
_acquireFunction = func;
|
||||
}
|
||||
|
||||
- (void) setDescriptionFunction: (NSString *(*)(const void *item))func
|
||||
{
|
||||
_descriptionFunction = func;
|
||||
}
|
||||
|
||||
- (void) setHashFunction: (NSUInteger (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item)))func
|
||||
{
|
||||
_hashFunction = func;
|
||||
}
|
||||
|
||||
- (void) setIsEqualFunction: (BOOL (*)(const void *item1, const void *item2,
|
||||
NSUInteger (*size)(const void *item)))func
|
||||
{
|
||||
_isEqualFunction = func;
|
||||
}
|
||||
|
||||
- (void) setRelinquishFunction: (void (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item))) func
|
||||
{
|
||||
_relinquishFunction = func;
|
||||
}
|
||||
|
||||
- (void) setSizeFunction: (NSUInteger (*)(const void *item))func
|
||||
{
|
||||
_sizeFunction = func;
|
||||
}
|
||||
|
||||
- (void) setUsesStrongWriteBarrier: (BOOL)flag
|
||||
{
|
||||
_usesStrongWriteBarrier = flag;
|
||||
}
|
||||
|
||||
- (void) setUsesWeakReadAndWriteBarriers: (BOOL)flag
|
||||
{
|
||||
_usesWeakReadAndWriteBarriers = flag;
|
||||
}
|
||||
|
||||
- (NSUInteger (*)(const void *item)) sizeFunction
|
||||
{
|
||||
return _sizeFunction;
|
||||
}
|
||||
|
||||
- (BOOL) usesStrongWriteBarrier
|
||||
{
|
||||
return _usesStrongWriteBarrier;
|
||||
}
|
||||
|
||||
- (BOOL) usesWeakReadAndWriteBarriers
|
||||
{
|
||||
return _usesStrongWriteBarrier;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -35,9 +35,34 @@
|
|||
#import "Foundation/NSKeyedArchiver.h"
|
||||
|
||||
#import "GSPrivate.h"
|
||||
#import "NSConcretePointerFunctions.h"
|
||||
|
||||
@class NSConcretePointerArray;
|
||||
|
||||
static Class abstractClass = Nil;
|
||||
static Class concreteClass = Nil;
|
||||
|
||||
|
||||
@implementation NSPointerArray
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
if (abstractClass == self)
|
||||
{
|
||||
return NSAllocateObject(concreteClass, 0, z);
|
||||
}
|
||||
return [super allocWithZone: z];
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (abstractClass == Nil)
|
||||
{
|
||||
abstractClass = [NSPointerArray class];
|
||||
concreteClass = [NSConcretePointerArray class];
|
||||
}
|
||||
}
|
||||
|
||||
+ (id) pointerArrayWithOptions: (NSPointerFunctionsOptions)options
|
||||
{
|
||||
return AUTORELEASE([[self alloc] initWithOptions: options]);
|
||||
|
@ -95,6 +120,30 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL) isEqual: (id)other
|
||||
{
|
||||
NSUInteger count;
|
||||
|
||||
if (other == self)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
if ([other isKindOfClass: abstractClass] == NO)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
if ([other hash] != [self hash])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
count = [self count];
|
||||
while (count-- > 0)
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) addPointer: (void*)pointer
|
||||
{
|
||||
[self insertPointer: pointer atIndex: [self count]];
|
||||
|
@ -154,17 +203,17 @@
|
|||
|
||||
@end
|
||||
|
||||
@interface GSPointerArray : NSPointerArray
|
||||
@interface NSConcretePointerArray : NSPointerArray
|
||||
{
|
||||
NSUInteger _count;
|
||||
void **_contents_array;
|
||||
unsigned _capacity;
|
||||
unsigned _grow_factor;
|
||||
NSPointerFunctions *_functions;
|
||||
NSConcretePointerFunctions *_functions;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSPointerArray
|
||||
@implementation NSConcretePointerArray
|
||||
|
||||
- (void) _raiseRangeExceptionWithIndex: (NSUInteger)index from: (SEL)sel
|
||||
{
|
||||
|
@ -192,6 +241,11 @@
|
|||
return RETAIN(self); // FIXME
|
||||
}
|
||||
|
||||
- (unsigned) count
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[self finalize];
|
||||
|
@ -224,6 +278,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (unsigned) hash
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
|
@ -257,14 +316,33 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (unsigned) count
|
||||
- (id) initWithOptions: (NSPointerFunctionsOptions)options
|
||||
{
|
||||
return _count;
|
||||
_functions = [[NSConcretePointerFunctions alloc] initWithOptions: options];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (unsigned) hash
|
||||
- (id) initWithPointerFunctions: (NSPointerFunctions*)functions
|
||||
{
|
||||
return _count;
|
||||
if ([functions class] == [NSConcretePointerFunctions class])
|
||||
{
|
||||
_functions = [functions copy];
|
||||
}
|
||||
else
|
||||
{
|
||||
_functions = [NSConcretePointerFunctions new];
|
||||
[_functions setAcquireFunction: [functions acquireFunction]];
|
||||
[_functions setDescriptionFunction: [functions descriptionFunction]];
|
||||
[_functions setHashFunction: [functions hashFunction]];
|
||||
[_functions setIsEqualFunction: [functions isEqualFunction]];
|
||||
[_functions setRelinquishFunction: [functions relinquishFunction]];
|
||||
[_functions setSizeFunction: [functions sizeFunction]];
|
||||
[_functions setUsesStrongWriteBarrier:
|
||||
[functions usesStrongWriteBarrier]];
|
||||
[_functions setUsesWeakReadAndWriteBarriers:
|
||||
[functions usesWeakReadAndWriteBarriers]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) insertPointer: (void*)pointer atIndex: (NSUInteger)index
|
||||
|
@ -292,5 +370,6 @@
|
|||
_contents_array[_count] = pointer;
|
||||
_count++;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -23,48 +23,29 @@
|
|||
|
||||
*/
|
||||
|
||||
#import "Foundation/NSPointerFunctions.h"
|
||||
|
||||
typedef struct {
|
||||
NSUInteger options;
|
||||
|
||||
void* (*acquireFunction)(const void *item,
|
||||
NSUInteger (*size)(const void *item), BOOL shouldCopy);
|
||||
|
||||
NSString *(*descriptionFunction)(const void *item);
|
||||
|
||||
NSUInteger (*hashFunction)(const void *item,
|
||||
NSUInteger (*size)(const void *item));
|
||||
|
||||
BOOL (*isEqualFunction)(const void *item1, const void *item2,
|
||||
NSUInteger (*size)(const void *item));
|
||||
|
||||
void (*relinquishFunction)(const void *item,
|
||||
NSUInteger (*size)(const void *item));
|
||||
|
||||
NSUInteger (*sizeFunction)(const void *item);
|
||||
|
||||
BOOL usesStrongWriteBarrier;
|
||||
|
||||
BOOL usesWeakReadAndWriteBarriers;
|
||||
} _internal;
|
||||
|
||||
#define _options ((_internal*)(self+1))->options
|
||||
#define _acquireFunction ((_internal*)(self+1))->acquireFunction
|
||||
#define _descriptionFunction ((_internal*)(self+1))->descriptionFunction
|
||||
#define _hashFunction ((_internal*)(self+1))->hashFunction
|
||||
#define _isEqualFunction ((_internal*)(self+1))->isEqualFunction
|
||||
#define _relinquishFunction ((_internal*)(self+1))->relinquishFunction
|
||||
#define _sizeFunction ((_internal*)(self+1))->sizeFunction
|
||||
#define _usesStrongWriteBarrier ((_internal*)(self+1))->usesStrongWriteBarrier
|
||||
#define _usesWeakReadAndWriteBarriers ((_internal*)(self+1))->usesWeakReadAndWriteBarriers
|
||||
#import "NSConcretePointerFunctions.h"
|
||||
|
||||
static Class abstractClass = Nil;
|
||||
static Class concreteClass = Nil;
|
||||
|
||||
@implementation NSPointerFunctions
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)zone
|
||||
{
|
||||
return (id) NSAllocateObject(self, sizeof(_internal), zone);
|
||||
if (self == abstractClass)
|
||||
{
|
||||
return (id) NSAllocateObject(concreteClass, 0, zone);
|
||||
}
|
||||
return [super allocWithZone: zone];
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (abstractClass == nil)
|
||||
{
|
||||
abstractClass = [NSPointerFunctions class];
|
||||
concreteClass = [NSConcretePointerFunctions class];
|
||||
}
|
||||
}
|
||||
|
||||
+ (id) pointerFunctionsWithOptions: (NSPointerFunctionsOptions)options
|
||||
|
@ -74,101 +55,108 @@ typedef struct {
|
|||
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
return NSCopyObject(self, sizeof(_internal), zone);
|
||||
return NSCopyObject(self, 0, zone);
|
||||
}
|
||||
|
||||
- (id) initWithOptions: (NSPointerFunctionsOptions)options
|
||||
{
|
||||
_options = options;
|
||||
return self;
|
||||
return [self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void* (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item), BOOL shouldCopy)) acquireFunction
|
||||
{
|
||||
return _acquireFunction;
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSString *(*)(const void *item)) descriptionFunction
|
||||
{
|
||||
return _descriptionFunction;
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSUInteger (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item))) hashFunction
|
||||
{
|
||||
return _hashFunction;
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (BOOL (*)(const void *item1, const void *item2,
|
||||
NSUInteger (*size)(const void *item))) isEqualFunction
|
||||
{
|
||||
return _isEqualFunction;
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item))) relinquishFunction
|
||||
{
|
||||
return _relinquishFunction;
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void) setAcquireFunction: (void* (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item), BOOL shouldCopy))func
|
||||
{
|
||||
_acquireFunction = func;
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void) setDescriptionFunction: (NSString *(*)(const void *item))func
|
||||
{
|
||||
_descriptionFunction = func;
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void) setHashFunction: (NSUInteger (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item)))func
|
||||
{
|
||||
_hashFunction = func;
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void) setIsEqualFunction: (BOOL (*)(const void *item1, const void *item2,
|
||||
NSUInteger (*size)(const void *item)))func
|
||||
{
|
||||
_isEqualFunction = func;
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void) setRelinquishFunction: (void (*)(const void *item,
|
||||
NSUInteger (*size)(const void *item))) func
|
||||
{
|
||||
_relinquishFunction = func;
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void) setSizeFunction: (NSUInteger (*)(const void *item))func
|
||||
{
|
||||
_sizeFunction = func;
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void) setUsesStrongWriteBarrier: (BOOL)flag
|
||||
{
|
||||
_usesStrongWriteBarrier = flag;
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (void) setUsesWeakReadAndWriteBarriers: (BOOL)flag
|
||||
{
|
||||
_usesWeakReadAndWriteBarriers = flag;
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
- (NSUInteger (*)(const void *item)) sizeFunction
|
||||
{
|
||||
return _sizeFunction;
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (BOOL) usesStrongWriteBarrier
|
||||
{
|
||||
return _usesStrongWriteBarrier;
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (BOOL) usesWeakReadAndWriteBarriers
|
||||
{
|
||||
return _usesStrongWriteBarrier;
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue