Functions | |
| cpl_error_code | cpl_array_copy_data (cpl_array *array, const double *data) |
| Copy buffer of numerical data to a numerical array. | |
| cpl_error_code | cpl_array_copy_data_double (cpl_array *array, const double *data) |
| Copy existing data to a double array. | |
| cpl_error_code | cpl_array_copy_data_float (cpl_array *array, const float *data) |
| Copy existing data to a float array. | |
| cpl_error_code | cpl_array_copy_data_int (cpl_array *array, const int *data) |
| Copy existing data to an integer array. | |
| cpl_error_code | cpl_array_copy_data_string (cpl_array *array, const char **data) |
| Copy existing data to a string array. | |
| int | cpl_array_count_invalid (const cpl_array *array) |
| Count number of invalid elements in an array. | |
| void | cpl_array_delete (cpl_array *array) |
| Delete an array. | |
| cpl_array * | cpl_array_duplicate (const cpl_array *array) |
| Make a copy of an array. | |
| cpl_error_code | cpl_array_fill_window (cpl_array *array, int start, int count, double value) |
| Write the same value within a numerical array segment. | |
| cpl_error_code | cpl_array_fill_window_double (cpl_array *array, int start, int count, double value) |
| Write the same value within a double array segment. | |
| cpl_error_code | cpl_array_fill_window_float (cpl_array *array, int start, int count, float value) |
| Write the same value within a float array segment. | |
| cpl_error_code | cpl_array_fill_window_int (cpl_array *array, int start, int count, int value) |
| Write the same value within an integer array segment. | |
| cpl_error_code | cpl_array_fill_window_invalid (cpl_array *array, int start, int count) |
| Set an array segment to NULL. | |
| cpl_error_code | cpl_array_fill_window_string (cpl_array *array, int start, int count, const char *value) |
| Write a string to a string array segment. | |
| double | cpl_array_get (const cpl_array *array, int indx, int *null) |
| Read a value from a numerical array. | |
| double * | cpl_array_get_data_double (cpl_array *array) |
Get a pointer to double array data. | |
| const double * | cpl_array_get_data_double_const (const cpl_array *array) |
| Get a pointer to constant double array data. | |
| float * | cpl_array_get_data_float (cpl_array *array) |
Get a pointer to float array data. | |
| const float * | cpl_array_get_data_float_const (const cpl_array *array) |
| Get a pointer to constant float array data. | |
| int * | cpl_array_get_data_int (cpl_array *array) |
Get a pointer to integer array data. | |
| const int * | cpl_array_get_data_int_const (const cpl_array *array) |
Get a pointer to constant integer array data. | |
| char ** | cpl_array_get_data_string (cpl_array *array) |
| Get a pointer to string array data. | |
| const char ** | cpl_array_get_data_string_const (const cpl_array *array) |
| Get a pointer to constant string array data. | |
| double | cpl_array_get_double (const cpl_array *array, int indx, int *null) |
| Read a value from a double array. | |
| float | cpl_array_get_float (const cpl_array *array, int indx, int *null) |
| Read a value from a float array. | |
| int | cpl_array_get_int (const cpl_array *array, int indx, int *null) |
| Read a value from an integer array. | |
| int | cpl_array_get_size (const cpl_array *array) |
| Get the length of an array. | |
| const char * | cpl_array_get_string (const cpl_array *array, int indx) |
| Read a value from a string array. | |
| cpl_type | cpl_array_get_type (const cpl_array *array) |
| Get the type of an array. | |
| int | cpl_array_has_invalid (const cpl_array *array) |
| Check if an array contains at least one invalid element. | |
| int | cpl_array_has_valid (const cpl_array *array) |
| Check if an array contains at least one valid value. | |
| cpl_array * | cpl_array_new (int length, cpl_type type) |
| Create a new array of given type. | |
| cpl_error_code | cpl_array_set (cpl_array *array, int indx, double value) |
| Write a value to a numerical array element. | |
| cpl_error_code | cpl_array_set_double (cpl_array *array, int indx, double value) |
| Write a value to a double array element. | |
| cpl_error_code | cpl_array_set_float (cpl_array *array, int indx, float value) |
| Write a value to a float array element. | |
| cpl_error_code | cpl_array_set_int (cpl_array *array, int indx, int value) |
| Write a value to an integer array element. | |
| cpl_error_code | cpl_array_set_invalid (cpl_array *array, int indx) |
| Invalidate an array element. | |
| cpl_error_code | cpl_array_set_string (cpl_array *array, int indx, const char *string) |
| Write a character string to a string array element. | |
| void * | cpl_array_unwrap (cpl_array *array) |
| Delete an array, without losing the data buffer. | |
| cpl_array * | cpl_array_wrap_double (double *data, int length) |
| Create a new double array from existing data. | |
| cpl_array * | cpl_array_wrap_float (float *data, int length) |
| Create a new float array from existing data. | |
| cpl_array * | cpl_array_wrap_int (int *data, int length) |
| Create a new integer array from existing data. | |
| cpl_array * | cpl_array_wrap_string (char **data, int length) |
| Create a new character string array from existing data. | |
#include <cpl_array.h>
| cpl_error_code cpl_array_copy_data | ( | cpl_array * | array, | |
| const double * | data | |||
| ) |
Copy buffer of numerical data to a numerical array.
| array | Existing array. | |
| data | Existing data buffer. |
CPL_ERROR_NONE on success. If the array is not numerical, a CPL_ERROR_INVALID_TYPE is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.cpl_array_set_invalid(). If N is the length of the array, the first N values of the input data buffer would be copied to the column buffer. If the array had length zero, no values would be copied.
| cpl_error_code cpl_array_copy_data_double | ( | cpl_array * | array, | |
| const double * | data | |||
| ) |
Copy existing data to a double array.
| array | Existing array. | |
| data | Existing data buffer. |
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_DOUBLE, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.cpl_array_copy_data_int().
| cpl_error_code cpl_array_copy_data_float | ( | cpl_array * | array, | |
| const float * | data | |||
| ) |
Copy existing data to a float array.
| array | Existing array. | |
| data | Existing data buffer. |
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_FLOAT, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.cpl_array_copy_data_int().
| cpl_error_code cpl_array_copy_data_int | ( | cpl_array * | array, | |
| const int * | data | |||
| ) |
Copy existing data to an integer array.
| array | Existing array. | |
| data | Existing data buffer. |
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_INT, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.cpl_array_set_invalid(). If N is the length of the array, the first N values of the input data buffer would be copied to the array buffer. If the array had length zero, no values would be copied.
| cpl_error_code cpl_array_copy_data_string | ( | cpl_array * | array, | |
| const char ** | data | |||
| ) |
Copy existing data to a string array.
| array | Existing array. | |
| data | Existing data buffer. |
CPL_ERROR_NONE on success. If the input array is not of type CPL_TYPE_STRING, a CPL_ERROR_TYPE_MISMATCH is returned. At any NULL input pointer a CPL_ERROR_NULL_INPUT would be returned.cpl_array_copy_data_int().The input data are copied into the specified array. The size of the input buffer is not checked in any way. The strings pointed by the input buffer are all duplicated, while the strings contained in the array are released before being overwritten.
| int cpl_array_count_invalid | ( | const cpl_array * | array | ) |
Count number of invalid elements in an array.
| array | Array to inquire. |
NULL pointer, an error CPL_ERROR_NULL_INPUT is set.
| void cpl_array_delete | ( | cpl_array * | array | ) |
Delete an array.
| array | Array to be deleted. |
NULL, nothing is done, and no error is set.
| cpl_array* cpl_array_duplicate | ( | const cpl_array * | array | ) |
Make a copy of an array.
| array | Array to be duplicated. |
NULL in case of error.NULL pointer, a CPL_ERROR_NULL_INPUT is returned. Copy is "in depth": in the case of a string array, also the string elements are duplicated.
| cpl_error_code cpl_array_fill_window | ( | cpl_array * | array, | |
| int | start, | |||
| int | count, | |||
| double | value | |||
| ) |
Write the same value within a numerical array segment.
| array | Array to be accessed. | |
| start | Position where to begin write value. | |
| count | Number of values to write. | |
| value | Value to write. |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of numerical type, a CPL_ERROR_INVALID_TYPE is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.cpl_array_fill_window_invalid().
| cpl_error_code cpl_array_fill_window_double | ( | cpl_array * | array, | |
| int | start, | |||
| int | count, | |||
| double | value | |||
| ) |
Write the same value within a double array segment.
| array | Array to be accessed. | |
| start | Position where to begin write value. | |
| count | Number of values to write. | |
| value | Value to write. |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be written just up to the end of the array. If count is zero, the array is not modified and no error is set.
| cpl_error_code cpl_array_fill_window_float | ( | cpl_array * | array, | |
| int | start, | |||
| int | count, | |||
| float | value | |||
| ) |
Write the same value within a float array segment.
| array | Array to be accessed. | |
| start | Position where to begin write value. | |
| count | Number of values to write. | |
| value | Value to write. |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be written just up to the end of the array. If count is zero, the array is not modified and no error is set.
| cpl_error_code cpl_array_fill_window_int | ( | cpl_array * | array, | |
| int | start, | |||
| int | count, | |||
| int | value | |||
| ) |
Write the same value within an integer array segment.
| array | Array to be accessed. | |
| start | Position where to begin write value. | |
| count | Number of values to write. | |
| value | Value to write. |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be written just up to the end of the array. If count is zero, the array is not modified and no error is set.
| cpl_error_code cpl_array_fill_window_invalid | ( | cpl_array * | array, | |
| int | start, | |||
| int | count | |||
| ) |
Set an array segment to NULL.
| array | Array to be accessed. | |
| start | Position where to start writing NULLs. | |
| count | Number of column elements to set to NULL. |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.NULL; for other data types, the corresponding elements are flagged as invalid.
| cpl_error_code cpl_array_fill_window_string | ( | cpl_array * | array, | |
| int | start, | |||
| int | count, | |||
| const char * | value | |||
| ) |
Write a string to a string array segment.
| array | Array to be accessed. | |
| start | Position where to begin write value. | |
| count | Number of values to write. | |
| value | Value to write. |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If start is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the error CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned. If count is negative, a CPL_ERROR_ILLEGAL_INPUT is returned.NULL pointer, it is duplicated for each accessed array element. If the input string is NULL, this call is equivalent to cpl_array_fill_window_invalid(). The count argument can go beyond the array end, and in that case the specified value will be copied just up to the end of the array. If count is zero, the array is not modified and no error is set.
| double cpl_array_get | ( | const cpl_array * | array, | |
| int | indx, | |||
| int * | null | |||
| ) |
Read a value from a numerical array.
| array | Array to be accessed. | |
| indx | Position of element to be read. | |
| null | Flag indicating null values, or error condition. |
CPL_ERROR_NULL_INPUT is set in case array is a NULL pointer. A CPL_ERROR_INVALID_TYPE is set in case a non-numerical array is accessed. CPL_ERROR_ACCESS_OUT_OF_RANGE is set if the indx is outside the array range. Indexes are counted starting from 0. If the input array has length zero, CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. The null flag is used to indicate whether the accessed array element is valid (0) or invalid (1). The null flag also signals an error condition (-1). The null argument can be left to NULL.
| double* cpl_array_get_data_double | ( | cpl_array * | array | ) |
Get a pointer to double array data.
| array | Array to get the data from. |
double array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.CPL_TYPE_DOUBLE, a CPL_ERROR_TYPE_MISMATCH is set.See documentation of function cpl_array_get_data_int().
| const double* cpl_array_get_data_double_const | ( | const cpl_array * | array | ) |
Get a pointer to constant double array data.
| array | Constant array to get the data from. |
NULL is returned. If array is a NULL, a NULL is returned, and an error is set.CPL_TYPE_DOUBLE, a CPL_ERROR_TYPE_MISMATCH is set.See documentation of function cpl_array_get_data_int_const().
| float* cpl_array_get_data_float | ( | cpl_array * | array | ) |
Get a pointer to float array data.
| array | Array to get the data from. |
float array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.CPL_TYPE_FLOAT, a CPL_ERROR_TYPE_MISMATCH is set.See documentation of function cpl_array_get_data_int().
| const float* cpl_array_get_data_float_const | ( | const cpl_array * | array | ) |
Get a pointer to constant float array data.
| array | Constant array to get the data from. |
NULL is returned. If array is a NULL, a NULL is returned, and an error is set.CPL_TYPE_FLOAT, a CPL_ERROR_TYPE_MISMATCH is set.See documentation of function cpl_array_get_data_int_const().
| int* cpl_array_get_data_int | ( | cpl_array * | array | ) |
Get a pointer to integer array data.
| array | Array to get the data from. |
integer array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.CPL_TYPE_INT, a CPL_ERROR_TYPE_MISMATCH is set.
| const int* cpl_array_get_data_int_const | ( | const cpl_array * | array | ) |
Get a pointer to constant integer array data.
| array | Constant array to get the data from. |
integer array data. If array contains no data (zero length), a NULL is returned. If array is a NULL, a NULL is returned, and an error is set.CPL_TYPE_INT, a CPL_ERROR_TYPE_MISMATCH is set.
| char** cpl_array_get_data_string | ( | cpl_array * | array | ) |
Get a pointer to string array data.
| array | Array to get the data from. |
NULL is returned. If array is a NULL, a NULL is returned, and an error is set.CPL_TYPE_STRING, a CPL_ERROR_TYPE_MISMATCH is set.See documentation of function cpl_array_get_data_int().
| const char** cpl_array_get_data_string_const | ( | const cpl_array * | array | ) |
Get a pointer to constant string array data.
| array | Constant array to get the data from. |
NULL is returned. If array is a NULL, a NULL is returned, and an error is set.CPL_TYPE_STRING, a CPL_ERROR_TYPE_MISMATCH is set.See documentation of function cpl_array_get_data_int().
| double cpl_array_get_double | ( | const cpl_array * | array, | |
| int | indx, | |||
| int * | null | |||
| ) |
Read a value from a double array.
| array | Array to be accessed. | |
| indx | Position of element to be read. | |
| null | Flag indicating null values, or error condition. |
CPL_TYPE_DOUBLE. See the documentation of the function cpl_array_get_int().
| float cpl_array_get_float | ( | const cpl_array * | array, | |
| int | indx, | |||
| int * | null | |||
| ) |
Read a value from a float array.
| array | Array to be accessed. | |
| indx | Position of element to be read. | |
| null | Flag indicating null values, or error condition. |
CPL_TYPE_FLOAT. See the documentation of the function cpl_array_get_int().
| int cpl_array_get_int | ( | const cpl_array * | array, | |
| int | indx, | |||
| int * | null | |||
| ) |
Read a value from an integer array.
| array | Array to be accessed. | |
| indx | Position of element to be read. | |
| null | Flag indicating null values, or error condition. |
CPL_TYPE_INT. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is set. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is set. Indexes are counted starting from 0. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always set. If the null flag is a valid pointer, it is used to indicate whether the accessed array element is valid (0) or invalid (1). The null flag also signals an error condition (-1).
| int cpl_array_get_size | ( | const cpl_array * | array | ) |
Get the length of an array.
| array | Input array. |
NULL array is passed to the function, but in the latter case a CPL_ERROR_NULL_INPUT is set.| const char* cpl_array_get_string | ( | const cpl_array * | array, | |
| int | indx | |||
| ) |
Read a value from a string array.
| array | Array to be accessed. | |
| indx | Position of element to be read. |
NULL pointer is returned.CPL_TYPE_STRING. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is set. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is set. Indexes are counted starting from 0. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always set.
cpl_array_set_string() will turn it into garbage. Therefore, if a real copy of a string array element is required, this function should be called as an argument of the function strdup(). | cpl_type cpl_array_get_type | ( | const cpl_array * | array | ) |
Get the type of an array.
| array | Input array |
CPL_TYPE_INVALID if a NULL array is passed to the function.NULL, CPL_ERROR_NULL_INPUT is set.
| int cpl_array_has_invalid | ( | const cpl_array * | array | ) |
Check if an array contains at least one invalid element.
| array | Array to inquire. |
NULL pointer, a CPL_ERROR_NULL_INPUT is set.
| int cpl_array_has_valid | ( | const cpl_array * | array | ) |
Check if an array contains at least one valid value.
| array | Array to inquire. |
NULL pointer, a CPL_ERROR_NULL_INPUT is set.
| cpl_array* cpl_array_new | ( | int | length, | |
| cpl_type | type | |||
| ) |
Create a new array of given type.
| length | Number of elements in array. | |
| type | Type of array |
NULL in case of error.CPL_TYPE_INT, CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE, and CPL_TYPE_STRING, are supported. An error CPL_ERROR_INVALID_TYPE is set in case other types are specified. All array elements are initially flagged as invalid. If a negative length is specified, an error CPL_ERROR_ILLEGAL_INPUT is set. Zero length arrays are allowed.
| cpl_error_code cpl_array_set | ( | cpl_array * | array, | |
| int | indx, | |||
| double | value | |||
| ) |
Write a value to a numerical array element.
| array | Array to be accessed. | |
| indx | Position where to write value. | |
| value | Value to write. |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of numerical type, a CPL_ERROR_INVALID_TYPE is returned. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length zero, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.cpl_array_set_invalid(). Array elements are counted starting from 0.
| cpl_error_code cpl_array_set_double | ( | cpl_array * | array, | |
| int | indx, | |||
| double | value | |||
| ) |
Write a value to a double array element.
| array | Array to be accessed. | |
| indx | Position where to write value. | |
| value | Value to write. |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.cpl_array_set_invalid(). Array elements are counted starting from 0.
| cpl_error_code cpl_array_set_float | ( | cpl_array * | array, | |
| int | indx, | |||
| float | value | |||
| ) |
Write a value to a float array element.
| array | Array to be accessed. | |
| indx | Position where to write value. | |
| value | Value to write. |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.cpl_array_set_invalid(). Array elements are counted starting from 0.
| cpl_error_code cpl_array_set_int | ( | cpl_array * | array, | |
| int | indx, | |||
| int | value | |||
| ) |
Write a value to an integer array element.
| array | Array to be accessed. | |
| indx | Position where to write value. | |
| value | Value to write. |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is set. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.cpl_array_set_invalid(). Array elements are counted starting from 0.
| cpl_error_code cpl_array_set_invalid | ( | cpl_array * | array, | |
| int | indx | |||
| ) |
Invalidate an array element.
| array | Array to be accessed | |
| indx | Position of element to invalidate |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is set. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always set.NULL; for other data types, the corresponding element of the null flags buffer is flagged. Array elements are counted starting from zero.
| cpl_error_code cpl_array_set_string | ( | cpl_array * | array, | |
| int | indx, | |||
| const char * | string | |||
| ) |
Write a character string to a string array element.
| array | Array to be accessed. | |
| indx | Position where to write character string. | |
| string | Character string to write. |
CPL_ERROR_NONE on success. If array is a NULL pointer a CPL_ERROR_NULL_INPUT is returned. If the array is not of the expected type, a CPL_ERROR_TYPE_MISMATCH is returned. If indx is outside the array range, a CPL_ERROR_ACCESS_OUT_OF_RANGE is returned. If the input array has length 0, the CPL_ERROR_ACCESS_OUT_OF_RANGE is always returned.NULL pointer. Note that the input character string is copied, therefore the original can be modified without affecting the column content. To "plug" a character string directly into an array element, use the function cpl_array_get_data_string(). Array elements are counted starting from zero.
| void* cpl_array_unwrap | ( | cpl_array * | array | ) |
Delete an array, without losing the data buffer.
| array | Array to be deleted. |
cpl_array_get_data_int(), cpl_array_get_data_float(), etc. If the input array is NULL, nothing is done, and no error is set.
| cpl_array* cpl_array_wrap_double | ( | double * | data, | |
| int | length | |||
| ) |
Create a new double array from existing data.
| data | Existing data buffer. | |
| length | Number of elements in array. |
NULL in case of error.cpl_array_wrap_int().
| cpl_array* cpl_array_wrap_float | ( | float * | data, | |
| int | length | |||
| ) |
Create a new float array from existing data.
| data | Existing data buffer. | |
| length | Number of elements in array. |
NULL in case of error.cpl_array_wrap_int().
| cpl_array* cpl_array_wrap_int | ( | int * | data, | |
| int | length | |||
| ) |
Create a new integer array from existing data.
| data | Existing data buffer. | |
| length | Number of elements in array. |
NULL in case of error.cpl_array_set_invalid() The data array is not copied, so it should never be deallocated: to deallocate it, the function cpl_array_delete() should be called instead. Alternatively, the function cpl_array_unwrap() might be used, and the data array deallocated afterwards. A zero or negative length is illegal, and would cause an error CPL_ERROR_ILLEGAL_INPUT to be set. An input NULL pointer would set an error CPL_ERROR_NULL_INPUT.
cpl_array_set_size(), cpl_array_delete(), etc.) would crash the program. This means that a static data buffer should never be passed to this function if memory handling is planned. In case of a static data buffer, only the cpl_array_unwrap() destructor can be used. | cpl_array* cpl_array_wrap_string | ( | char ** | data, | |
| int | length | |||
| ) |
Create a new character string array from existing data.
| data | Existing data buffer. | |
| length | Number of elements in array. |
NULL in case of error.cpl_array_wrap_int().
1.5.1