Core Plot (iOS and tvOS)
Cocoa plotting framework for macOS, iOS, and tvOS
|
An annotated NSData type. More...
#import <CPTNumericData.h>
Public Class Methods | |
Factory Methods | |
(nonnull instancetype) | + numericDataWithData:dataType:shape: |
Creates and returns a new CPTNumericData instance. More... | |
(nonnull instancetype) | + numericDataWithData:dataTypeString:shape: |
Creates and returns a new CPTNumericData instance. More... | |
(nonnull instancetype) | + numericDataWithArray:dataType:shape: |
Creates and returns a new CPTNumericData instance. More... | |
(nonnull instancetype) | + numericDataWithArray:dataTypeString:shape: |
Creates and returns a new CPTNumericData instance. More... | |
(nonnull instancetype) | + numericDataWithData:dataType:shape:dataOrder: |
Creates and returns a new CPTNumericData instance. More... | |
(nonnull instancetype) | + numericDataWithData:dataTypeString:shape:dataOrder: |
Creates and returns a new CPTNumericData instance. More... | |
(nonnull instancetype) | + numericDataWithArray:dataType:shape:dataOrder: |
Creates and returns a new CPTNumericData instance. More... | |
(nonnull instancetype) | + numericDataWithArray:dataTypeString:shape:dataOrder: |
Creates and returns a new CPTNumericData instance. More... | |
Public Class Methods inherited from NSObject | |
(id) | + alloc |
(Class) | + class |
(void) | + initialize |
(void) | + load |
(id) | + new |
Public Class Methods inherited from <NSSecureCoding> | |
(BOOL) | + supportsSecureCoding: |
Public Instance Methods | |
Initialization | |
(nonnull instancetype) | - initWithData:dataType:shape: |
Initializes a newly allocated CPTNumericData object with the provided data. More... | |
(nonnull instancetype) | - initWithData:dataTypeString:shape: |
Initializes a newly allocated CPTNumericData object with the provided data. More... | |
(nonnull instancetype) | - initWithArray:dataType:shape: |
Initializes a newly allocated CPTNumericData object with the provided data. More... | |
(nonnull instancetype) | - initWithArray:dataTypeString:shape: |
Initializes a newly allocated CPTNumericData object with the provided data. More... | |
(nonnull instancetype) | - initWithData:dataType:shape:dataOrder: |
Initializes a newly allocated CPTNumericData object with the provided data. This is the designated initializer. More... | |
(nonnull instancetype) | - initWithData:dataTypeString:shape:dataOrder: |
Initializes a newly allocated CPTNumericData object with the provided data. More... | |
(nonnull instancetype) | - initWithArray:dataType:shape:dataOrder: |
Initializes a newly allocated CPTNumericData object with the provided data. More... | |
(nonnull instancetype) | - initWithArray:dataTypeString:shape:dataOrder: |
Initializes a newly allocated CPTNumericData object with the provided data. More... | |
(nullable instancetype) | - initWithCoder: |
Returns an object initialized from data in a given unarchiver. More... | |
Samples | |
(NSUInteger) | - sampleIndex: |
Gets the offset of a given sample in the data buffer. More... | |
(nullable const void *) | - samplePointer: |
Gets a pointer to a given sample in the data buffer. More... | |
(nullable const void *) | - samplePointerAtIndex: |
Gets a pointer to a given sample in the data buffer. More... | |
(nullable NSNumber *) | - sampleValue: |
Gets the value of a given sample in the data buffer. More... | |
(nullable NSNumber *) | - sampleValueAtIndex: |
Gets the value of a given sample in the data buffer. More... | |
(nonnull CPTNumberArray *) | - sampleArray |
Gets an array data samples from the receiver. More... | |
Type Conversion | |
(nonnull CPTNumericData *) | - dataByConvertingToDataType: |
Copies the current numeric data and converts the data to a new data type. More... | |
(nonnull CPTNumericData *) | - dataByConvertingToType:sampleBytes:byteOrder: |
Copies the current numeric data and converts the data to a new data type. More... | |
Data Conversion Utilities | |
(void) | - convertData:dataType:toData:dataType: |
Copies a data buffer and converts the data to a new data type without changing the byte order. More... | |
(void) | - swapByteOrderForData:sampleSize: |
Swaps the byte order for each sample stored in a data buffer. More... | |
Public Instance Methods inherited from NSObject | |
(Class) | - classForCoder |
(id) | - copy |
(void) | - dealloc |
(void) | - finalize |
(id) | - init |
(id) | - mutableCopy |
Public Instance Methods inherited from <NSObject> | |
(NSString *) | - description |
(NSUInteger) | - hash |
(BOOL) | - isEqual: |
Public Instance Methods inherited from <NSCopying> | |
(id) | - copyWithZone: |
Public Instance Methods inherited from <NSMutableCopying> | |
(id) | - mutableCopyWithZone: |
Public Instance Methods inherited from <NSCoding> | |
(id) | - initWithCoder: |
(void) | - encodeWithCoder: |
Properties | |
Data Buffer | |
NSData * | data |
The data buffer. More... | |
const void * | bytes |
Returns a pointer to the data buffer’s contents. More... | |
NSUInteger | length |
Returns the number of bytes contained in the data buffer. More... | |
Data Format | |
CPTNumericDataType | dataType |
The type of data stored in the data buffer. More... | |
CPTDataTypeFormat | dataTypeFormat |
The format of the data stored in the data buffer. More... | |
size_t | sampleBytes |
The number of bytes in a single sample of data. More... | |
CFByteOrder | byteOrder |
The byte order used to store each sample in the data buffer. More... | |
Dimensions | |
CPTNumberArray * | shape |
The shape of the data buffer array. More... | |
NSUInteger | numberOfDimensions |
The number dimensions in the data buffer array. More... | |
NSUInteger | numberOfSamples |
The number of samples of dataType stored in the data buffer. More... | |
CPTDataOrder | dataOrder |
The order that numbers are stored in a multi-dimensional data array. More... | |
An annotated NSData type.
CPTNumericData combines a data buffer with information about the data (shape, data type, size, etc.). The data is assumed to be an array of one or more dimensions of a single type of numeric data. Each numeric value in the array, which can be more than one byte in size, is referred to as a “sample”. The structure of this object is similar to the NumPy ndarray
object.
The supported data types are:
float
and double
floating point numbersfloat complex
and double complex
floating point complex numbersAll integer and floating point types can be represented using big endian or little endian byte order. Complex and decimal types support only the the host system’s native byte order.
- (void) convertData: | (nonnull NSData *) | sourceData | |
dataType: | (nonnull CPTNumericDataType *) | sourceDataType | |
toData: | (nonnull NSMutableData *) | destData | |
dataType: | (nonnull CPTNumericDataType *) | destDataType | |
Copies a data buffer and converts the data to a new data type without changing the byte order.
The data is assumed to be in host byte order and no byte order conversion is performed.
sourceData | The source data buffer. |
sourceDataType | The data type of the source. |
destData | The destination data buffer. |
destDataType | The new data type. |
Provided by category CPTNumericData(TypeConversion).
- (nonnull CPTNumericData *) dataByConvertingToDataType: | (CPTNumericDataType) | newDataType |
Copies the current numeric data and converts the data to a new data type.
newDataType | The new data type. |
Provided by category CPTNumericData(TypeConversion).
- (nonnull CPTNumericData *) dataByConvertingToType: | (CPTDataTypeFormat) | newDataType | |
sampleBytes: | (size_t) | newSampleBytes | |
byteOrder: | (CFByteOrder) | newByteOrder | |
Copies the current numeric data and converts the data to a new data type.
newDataType | The new data type format. |
newSampleBytes | The number of bytes used to store each sample. |
newByteOrder | The new byte order. |
Provided by category CPTNumericData(TypeConversion).
- (nonnull instancetype) initWithArray: | (nonnull CPTNumberArray *) | newData | |
dataType: | (CPTNumericDataType) | newDataType | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
Initializes a newly allocated CPTNumericData object with the provided data.
Objects in newData should be instances of NSNumber, NSDecimalNumber, NSString, or NSNull. Numbers and strings will be converted to newDataType
and stored in the receiver. Any instances of NSNull will be treated as “not a number” (NaN
) values for floating point types and zero (0
) for integer types.
newData | An array of numbers. |
newDataType | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in CPTDataOrderRowsFirst. |
- (nonnull instancetype) initWithArray: | (nonnull CPTNumberArray *) | newData | |
dataType: | (CPTNumericDataType) | newDataType | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
dataOrder: | (CPTDataOrder) | order | |
Initializes a newly allocated CPTNumericData object with the provided data.
Objects in newData should be instances of NSNumber, NSDecimalNumber, NSString, or NSNull. Numbers and strings will be converted to newDataType
and stored in the receiver. Any instances of NSNull will be treated as “not a number” (NaN
) values for floating point types and zero (0
) for integer types.
newData | An array of numbers. |
newDataType | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. |
order | The data order for a multi-dimensional data array (row-major or column-major). |
- (nonnull instancetype) initWithArray: | (nonnull CPTNumberArray *) | newData | |
dataTypeString: | (nonnull NSString *) | newDataTypeString | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
Initializes a newly allocated CPTNumericData object with the provided data.
Objects in newData should be instances of NSNumber, NSDecimalNumber, NSString, or NSNull. Numbers and strings will be converted to newDataTypeString and stored in the receiver. Any instances of NSNull will be treated as “not a number” (NaN
) values for floating point types and zero (0
) for integer types.
newData | An array of numbers. |
newDataTypeString | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in CPTDataOrderRowsFirst. |
- (nonnull instancetype) initWithArray: | (nonnull CPTNumberArray *) | newData | |
dataTypeString: | (nonnull NSString *) | newDataTypeString | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
dataOrder: | (CPTDataOrder) | order | |
Initializes a newly allocated CPTNumericData object with the provided data.
Objects in newData should be instances of NSNumber, NSDecimalNumber, NSString, or NSNull. Numbers and strings will be converted to newDataTypeString and stored in the receiver. Any instances of NSNull will be treated as “not a number” (NaN
) values for floating point types and zero (0
) for integer types.
newData | An array of numbers. |
newDataTypeString | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. |
order | The data order for a multi-dimensional data array (row-major or column-major). |
- (nullable instancetype) initWithCoder: | (nonnull NSCoder *) | decoder |
Returns an object initialized from data in a given unarchiver.
decoder | An unarchiver object. |
- (nonnull instancetype) initWithData: | (nonnull NSData *) | newData | |
dataType: | (CPTNumericDataType) | newDataType | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
Initializes a newly allocated CPTNumericData object with the provided data.
newData | The data buffer. |
newDataType | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in CPTDataOrderRowsFirst. |
- (nonnull instancetype) initWithData: | (nonnull NSData *) | newData | |
dataType: | (CPTNumericDataType) | newDataType | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
dataOrder: | (CPTDataOrder) | order | |
Initializes a newly allocated CPTNumericData object with the provided data. This is the designated initializer.
newData | The data buffer. |
newDataType | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. |
order | The data order for a multi-dimensional data array (row-major or column-major). |
- (nonnull instancetype) initWithData: | (nonnull NSData *) | newData | |
dataTypeString: | (nonnull NSString *) | newDataTypeString | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
Initializes a newly allocated CPTNumericData object with the provided data.
newData | The data buffer. |
newDataTypeString | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in CPTDataOrderRowsFirst. |
- (nonnull instancetype) initWithData: | (nonnull NSData *) | newData | |
dataTypeString: | (nonnull NSString *) | newDataTypeString | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
dataOrder: | (CPTDataOrder) | order | |
Initializes a newly allocated CPTNumericData object with the provided data.
newData | The data buffer. |
newDataTypeString | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. |
order | The data order for a multi-dimensional data array (row-major or column-major). |
+ (nonnull instancetype) numericDataWithArray: | (nonnull CPTNumberArray *) | newData | |
dataType: | (CPTNumericDataType) | newDataType | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
Creates and returns a new CPTNumericData instance.
Objects in newData should be instances of NSNumber, NSDecimalNumber, NSString, or NSNull. Numbers and strings will be converted to newDataType
and stored in the receiver. Any instances of NSNull will be treated as “not a number” (NaN
) values for floating point types and zero (0
) for integer types.
newData | An array of numbers. |
newDataType | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in CPTDataOrderRowsFirst. |
+ (nonnull instancetype) numericDataWithArray: | (nonnull CPTNumberArray *) | newData | |
dataType: | (CPTNumericDataType) | newDataType | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
dataOrder: | (CPTDataOrder) | order | |
Creates and returns a new CPTNumericData instance.
Objects in newData should be instances of NSNumber, NSDecimalNumber, NSString, or NSNull. Numbers and strings will be converted to newDataType
and stored in the receiver. Any instances of NSNull will be treated as “not a number” (NaN
) values for floating point types and zero (0
) for integer types.
newData | An array of numbers. |
newDataType | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. |
order | The data order for a multi-dimensional data array (row-major or column-major). |
+ (nonnull instancetype) numericDataWithArray: | (nonnull CPTNumberArray *) | newData | |
dataTypeString: | (nonnull NSString *) | newDataTypeString | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
Creates and returns a new CPTNumericData instance.
Objects in newData should be instances of NSNumber, NSDecimalNumber, NSString, or NSNull. Numbers and strings will be converted to newDataTypeString and stored in the receiver. Any instances of NSNull will be treated as “not a number” (NaN
) values for floating point types and zero (0
) for integer types.
newData | An array of numbers. |
newDataTypeString | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in CPTDataOrderRowsFirst. |
+ (nonnull instancetype) numericDataWithArray: | (nonnull CPTNumberArray *) | newData | |
dataTypeString: | (nonnull NSString *) | newDataTypeString | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
dataOrder: | (CPTDataOrder) | order | |
Creates and returns a new CPTNumericData instance.
Objects in newData should be instances of NSNumber, NSDecimalNumber, NSString, or NSNull. Numbers and strings will be converted to newDataTypeString and stored in the receiver. Any instances of NSNull will be treated as “not a number” (NaN
) values for floating point types and zero (0
) for integer types.
newData | An array of numbers. |
newDataTypeString | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. |
order | The data order for a multi-dimensional data array (row-major or column-major). |
+ (nonnull instancetype) numericDataWithData: | (nonnull NSData *) | newData | |
dataType: | (CPTNumericDataType) | newDataType | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
Creates and returns a new CPTNumericData instance.
newData | The data buffer. |
newDataType | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in CPTDataOrderRowsFirst. |
+ (nonnull instancetype) numericDataWithData: | (nonnull NSData *) | newData | |
dataType: | (CPTNumericDataType) | newDataType | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
dataOrder: | (CPTDataOrder) | order | |
Creates and returns a new CPTNumericData instance.
newData | The data buffer. |
newDataType | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. |
order | The data order for a multi-dimensional data array (row-major or column-major). |
+ (nonnull instancetype) numericDataWithData: | (nonnull NSData *) | newData | |
dataTypeString: | (nonnull NSString *) | newDataTypeString | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
Creates and returns a new CPTNumericData instance.
newData | The data buffer. |
newDataTypeString | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in CPTDataOrderRowsFirst. |
+ (nonnull instancetype) numericDataWithData: | (nonnull NSData *) | newData | |
dataTypeString: | (nonnull NSString *) | newDataTypeString | |
shape: | (nullable CPTNumberArray *) | shapeArray | |
dataOrder: | (CPTDataOrder) | order | |
Creates and returns a new CPTNumericData instance.
newData | The data buffer. |
newDataTypeString | The type of data stored in the buffer. |
shapeArray | The shape of the data buffer array. |
order | The data order for a multi-dimensional data array (row-major or column-major). |
- (nonnull CPTNumberArray *) sampleArray |
- (NSUInteger) sampleIndex: | (NSUInteger) | idx | |
, | ... | ||
Gets the offset of a given sample in the data buffer.
idx | The zero-based indices into a multi-dimensional sample array. Each index should of type NSUInteger and the number of indices (including idx ) should match the numberOfDimensions. |
- (nullable const void *) samplePointer: | (NSUInteger) | sample |
Gets a pointer to a given sample in the data buffer.
sample | The zero-based index into the sample array. The array is treated as if it only has one dimension. |
NULL
if the sample index is out of bounds. - (nullable const void *) samplePointerAtIndex: | (NSUInteger) | idx | |
, | ... | ||
Gets a pointer to a given sample in the data buffer.
idx | The zero-based indices into a multi-dimensional sample array. Each index should of type NSUInteger and the number of indices (including idx ) should match the numberOfDimensions. |
NULL
if any of the sample indices are out of bounds. - (NSNumber *) sampleValue: | (NSUInteger) | sample |
- (NSNumber *) sampleValueAtIndex: | (NSUInteger) | idx | |
, | ... | ||
Gets the value of a given sample in the data buffer.
idx | The zero-based indices into a multi-dimensional sample array. Each index should of type NSUInteger and the number of indices (including idx ) should match the numberOfDimensions. |
- (void) swapByteOrderForData: | (nonnull NSMutableData *) | sourceData | |
sampleSize: | (size_t) | sampleSize | |
Swaps the byte order for each sample stored in a data buffer.
sourceData | The data buffer. |
sampleSize | The number of bytes in each sample stored in sourceData. |
Provided by category CPTNumericData(TypeConversion).
|
readnonatomicassign |
The byte order used to store each sample in the data buffer.
|
readnonatomicassign |
Returns a pointer to the data buffer’s contents.
|
readnonatomiccopy |
The data buffer.
|
readnonatomicassign |
The order that numbers are stored in a multi-dimensional data array.
|
readnonatomicassign |
The type of data stored in the data buffer.
|
readnonatomicassign |
The format of the data stored in the data buffer.
|
readnonatomicassign |
Returns the number of bytes contained in the data buffer.
|
readnonatomicassign |
The number dimensions in the data buffer array.
|
readnonatomicassign |
The number of samples of dataType stored in the data buffer.
|
readnonatomicassign |
The number of bytes in a single sample of data.
|
readnonatomiccopy |
The shape of the data buffer array.
The shape describes the dimensions of the sample array stored in the data buffer. Each entry in the shape array represents the size of the corresponding array dimension and should be an unsigned integer encoded in an instance of NSNumber.