nothing is missing here; there is no formal objc interface for arrays of c-scalar types.
A simple way (as mentioned above) is to use std::vectorand then serialize / deserialize using a mechanism such as CF / NS-Data.
std::vector objc, :
struct t_MONDoubleArray_data;
@interface MONDoubleArray : NSObject < NSCoding, NSCopying, NSMutableCopying >
{
t_MONDoubleArray_data* data;
}
- (double)doubleAtIndex;
- (void)setDoubleAtiIndex:(double)index;
- (NSUInteger)count;
@end
struct t_MONDoubleArray_data {
std::vector<double> array;
};
@implementation MONDoubleBuffer
- (id)init
{
self = [super init];
if (0 != self) {
array = new t_MONDoubleArray_data;
if (0 == array) {
[self release];
return 0;
}
}
return self;
}
- (void)dealloc
{
delete array;
[super dealloc];
}
- (NSData *)dataRepresentationOfDoubleData { }
- (void)setDoubleDataFromDataRepresentation:(NSData *)data { }
@end
objc .
CF/NS_MutableArray , ( ):
@interface MONFloatBuffer : NSObject
{
NSMutableArray * floats;
}
@end
@implementation MONFloatBuffer
- (id)init
{
self = [super init];
if (0 != self) {
CFAllocatorRef allocator = 0;
CFIndex capacity = 0;
const CFArrayCallBacks callBacks = { 0 , 0 , 0 , 0 , 0 };
floats = (NSMutableArray*)CFArrayCreateMutable(allocator, capacity, &callBacks);
}
return self;
}
@end
, . ... NSPointerArray ... - , . . , .