DoubleVector
Objective-C
@interface DoubleVector : NSObject
Swift
class DoubleVector : NSObject
Utility class to wrap a std::vector<double>
-
Create DoubleVector and initialize with the contents of an NSData object
Declaration
Objective-C
- (nonnull instancetype)initWithData:(nonnull NSData *)data;
Swift
init(data: Data)
Parameters
data
NSData containing raw double array
-
Create DoubleVector and initialize with the contents of another DoubleVector object
Declaration
Objective-C
- (nonnull instancetype)initWithVector:(nonnull DoubleVector *)src;
Swift
init(vector src: DoubleVector)
Parameters
src
DoubleVector containing data to copy
-
Create DoubleVector from raw C array
Declaration
Objective-C
- (nonnull instancetype)initWithNativeArray:(nonnull double *)array elements:(int)elements;
Swift
init(nativeArray array: UnsafeMutablePointer<Double>, elements: Int32)
Parameters
array
The raw C array @elements elements The number of elements in the array
-
Length of the vector
Declaration
Objective-C
@property (readonly) size_t length;
Swift
var length: Int { get }
-
Raw C array
Declaration
Objective-C
@property (readonly) double *_Nonnull nativeArray;
Swift
var nativeArray: UnsafeMutablePointer<Double> { get }
-
NSData object containing the raw double data
Declaration
Objective-C
@property (readonly) NSData *_Nonnull data;
Swift
var data: Data { get }
-
Return array element
Declaration
Objective-C
- (double)get:(NSInteger)index;
Swift
func get(_ index: Int) -> Double
Parameters
index
Index of the array element to return