SDDSlib
|
This file contains routines for getting pointers to SDDS objects like columns and parameters. More...
Go to the source code of this file.
Functions | |
int32_t | SDDS_SetRowFlags (SDDS_DATASET *SDDS_dataset, int32_t row_flag_value) |
Sets the acceptance flags for all rows in the current data table of a data set. | |
int32_t | SDDS_GetRowFlag (SDDS_DATASET *SDDS_dataset, int64_t row) |
Retrieves the acceptance flag of a specific row in the current data table. | |
int32_t | SDDS_GetRowFlags (SDDS_DATASET *SDDS_dataset, int32_t *flag, int64_t rows) |
Retrieves the acceptance flags for all rows in the current data table. | |
int32_t | SDDS_AssertRowFlags (SDDS_DATASET *SDDS_dataset, uint32_t mode,...) |
Sets acceptance flags for rows based on specified criteria. | |
int32_t | SDDS_SetColumnFlags (SDDS_DATASET *SDDS_dataset, int32_t column_flag_value) |
Sets the acceptance flags for all columns in the current data table of a data set. | |
int32_t | SDDS_AssertColumnFlags (SDDS_DATASET *SDDS_dataset, uint32_t mode,...) |
Sets acceptance flags for columns based on specified criteria. | |
int32_t | SDDS_CountColumnsOfInterest (SDDS_DATASET *SDDS_dataset) |
Counts the number of columns marked as "of interest" in the current data table. | |
int64_t | SDDS_CountRowsOfInterest (SDDS_DATASET *SDDS_dataset) |
Counts the number of rows marked as "of interest" in the current data table. | |
int32_t | SDDS_SetColumnsOfInterest (SDDS_DATASET *SDDS_dataset, int32_t mode,...) |
Sets the acceptance flags for columns based on specified naming criteria. | |
void * | SDDS_GetColumn (SDDS_DATASET *SDDS_dataset, char *column_name) |
Retrieves a copy of the data for a specified column, including only rows marked as "of interest". | |
void * | SDDS_GetInternalColumn (SDDS_DATASET *SDDS_dataset, char *column_name) |
Retrieves an internal pointer to the data of a specified column, including all rows. | |
long double * | SDDS_GetColumnInLongDoubles (SDDS_DATASET *SDDS_dataset, char *column_name) |
Retrieves the data of a specified numerical column as an array of long doubles, considering only rows marked as "of interest". | |
double * | SDDS_GetColumnInDoubles (SDDS_DATASET *SDDS_dataset, char *column_name) |
Retrieves the data of a specified numerical column as an array of doubles, considering only rows marked as "of interest". | |
float * | SDDS_GetColumnInFloats (SDDS_DATASET *SDDS_dataset, char *column_name) |
Retrieves the data of a specified numerical column as an array of floats, considering only rows marked as "of interest". | |
int32_t * | SDDS_GetColumnInLong (SDDS_DATASET *SDDS_dataset, char *column_name) |
Retrieves the data of a specified numerical column as an array of 32-bit integers, considering only rows marked as "of interest". | |
short * | SDDS_GetColumnInShort (SDDS_DATASET *SDDS_dataset, char *column_name) |
Retrieves the data of a specified numerical column as an array of short integers, considering only rows marked as "of interest". | |
char ** | SDDS_GetColumnInString (SDDS_DATASET *SDDS_dataset, char *column_name) |
Retrieves the data of a specified column as an array of strings, considering only rows marked as "of interest". | |
void * | SDDS_GetNumericColumn (SDDS_DATASET *SDDS_dataset, char *column_name, int32_t desiredType) |
Retrieves the data of a specified numerical column as an array of a desired numerical type, considering only rows marked as "of interest". | |
int64_t | SDDS_GetSelectedRowIndex (SDDS_DATASET *SDDS_dataset, int64_t srow_index) |
Retrieves the actual row index corresponding to a selected row position within the current data table. | |
void * | SDDS_GetValue (SDDS_DATASET *SDDS_dataset, char *column_name, int64_t srow_index, void *memory) |
Retrieves the value from a specified column and selected row, optionally storing it in provided memory. | |
double | SDDS_GetValueAsDouble (SDDS_DATASET *SDDS_dataset, char *column_name, int64_t srow_index) |
Retrieves the value from a specified column and selected row, casting it to a double. | |
double | SDDS_GetValueByIndexAsDouble (SDDS_DATASET *SDDS_dataset, int32_t column_index, int64_t srow_index) |
Retrieves the value from a specified column and selected row, casting it to a double. | |
void * | SDDS_GetValueByIndex (SDDS_DATASET *SDDS_dataset, int32_t column_index, int64_t srow_index, void *memory) |
Retrieves the value from a specified column and selected row, optionally storing it in provided memory. | |
void * | SDDS_GetValueByAbsIndex (SDDS_DATASET *SDDS_dataset, int32_t column_index, int64_t row_index, void *memory) |
Retrieves the value from a specified column and absolute row index, optionally storing it in provided memory. | |
int32_t | SDDS_GetRowType (SDDS_DATASET *SDDS_dataset) |
Determines the data type of the rows based on selected columns in the current data table. | |
void * | SDDS_GetRow (SDDS_DATASET *SDDS_dataset, int64_t srow_index, void *memory) |
Retrieves the data of a specific selected row as an array, considering only columns marked as "of interest". | |
void * | SDDS_GetMatrixOfRows (SDDS_DATASET *SDDS_dataset, int64_t *n_rows) |
Retrieves all rows marked as "of interest" as a matrix (array of row arrays). | |
void * | SDDS_GetCastMatrixOfRows (SDDS_DATASET *SDDS_dataset, int64_t *n_rows, int32_t sddsType) |
Retrieves all rows marked as "of interest" as a matrix, casting each value to a specified numerical type. | |
int32_t | SDDS_GetParameters (SDDS_DATASET *SDDS_dataset,...) |
Retrieves multiple parameter values from the current data table of a data set. | |
void * | SDDS_GetParameter (SDDS_DATASET *SDDS_dataset, char *parameter_name, void *memory) |
Retrieves the value of a specified parameter from the current data table of a data set. | |
void * | SDDS_GetParameterByIndex (SDDS_DATASET *SDDS_dataset, int32_t index, void *memory) |
Retrieves the value of a specified parameter by its index from the current data table of a data set. | |
int32_t * | SDDS_GetParameterAsLong (SDDS_DATASET *SDDS_dataset, char *parameter_name, int32_t *memory) |
Retrieves the value of a specified parameter as a 32-bit integer from the current data table of a data set. | |
int64_t * | SDDS_GetParameterAsLong64 (SDDS_DATASET *SDDS_dataset, char *parameter_name, int64_t *memory) |
Retrieves the value of a specified parameter as a 64-bit integer from the current data table of an SDDS dataset. | |
long double * | SDDS_GetParameterAsLongDouble (SDDS_DATASET *SDDS_dataset, char *parameter_name, long double *memory) |
Retrieves the value of a specified parameter as a long double from the current data table of an SDDS dataset. | |
double * | SDDS_GetParameterAsDouble (SDDS_DATASET *SDDS_dataset, char *parameter_name, double *memory) |
Retrieves the value of a specified parameter as a double from the current data table of an SDDS dataset. | |
char * | SDDS_GetParameterAsString (SDDS_DATASET *SDDS_dataset, char *parameter_name, char **memory) |
Retrieves the value of a specified parameter as a string from the current data table of an SDDS dataset. | |
char * | SDDS_GetParameterAsFormattedString (SDDS_DATASET *SDDS_dataset, char *parameter_name, char **memory, char *suppliedformat) |
Retrieves the value of a specified parameter as a formatted string from the current data table of an SDDS dataset. | |
void * | SDDS_GetFixedValueParameter (SDDS_DATASET *SDDS_dataset, char *parameter_name, void *memory) |
Retrieves the fixed value of a specified parameter from an SDDS dataset. | |
void * | SDDS_GetMatrixFromColumn (SDDS_DATASET *SDDS_dataset, char *column_name, int64_t dimension1, int64_t dimension2, int32_t mode) |
Extracts a matrix from a specified column in the current data table of an SDDS dataset. | |
void * | SDDS_GetDoubleMatrixFromColumn (SDDS_DATASET *SDDS_dataset, char *column_name, int64_t dimension1, int64_t dimension2, int32_t mode) |
Extracts a matrix of doubles from a specified column in the current data table of an SDDS dataset. | |
int64_t | SDDS_SetRowsOfInterest (SDDS_DATASET *SDDS_dataset, char *selection_column, int32_t mode,...) |
Sets the rows of interest in an SDDS dataset based on various selection criteria. | |
int64_t | SDDS_MatchRowsOfInterest (SDDS_DATASET *SDDS_dataset, char *selection_column, char *label_to_match, int32_t logic) |
Matches and marks rows of interest in an SDDS dataset based on label matching. | |
int64_t | SDDS_FilterRowsOfInterest (SDDS_DATASET *SDDS_dataset, char *filter_column, double lower_limit, double upper_limit, int32_t logic) |
Filters rows of interest in an SDDS dataset based on numeric ranges in a specified column. | |
int64_t | SDDS_FilterRowsByNumScan (SDDS_DATASET *SDDS_dataset, char *filter_column, uint32_t mode) |
Filters rows of interest in an SDDS dataset based on numeric scanning of a specified column. | |
int32_t | SDDS_DeleteUnsetRows (SDDS_DATASET *SDDS_dataset) |
Deletes rows from an SDDS dataset that are not marked as "of interest". | |
int32_t | SDDS_TransferRow (SDDS_DATASET *SDDS_dataset, int64_t target, int64_t source) |
Transfers data from a source row to a target row within an SDDS dataset. | |
int32_t | SDDS_DeleteColumn (SDDS_DATASET *SDDS_dataset, char *column_name) |
Deletes a specified column from an SDDS dataset. | |
int32_t | SDDS_DeleteUnsetColumns (SDDS_DATASET *SDDS_dataset) |
Deletes all columns from an SDDS dataset that are not marked as "of interest". | |
int32_t | SDDS_CopyColumn (SDDS_DATASET *SDDS_dataset, int32_t target, int32_t source) |
Copies data from a source column to a target column within an SDDS dataset. | |
int32_t | SDDS_DeleteParameter (SDDS_DATASET *SDDS_dataset, char *parameter_name) |
Deletes a specified parameter from an SDDS dataset. | |
int32_t | SDDS_CopyParameter (SDDS_DATASET *SDDS_dataset, int32_t target, int32_t source) |
Copies a parameter from a source index to a target index within an SDDS dataset. | |
int32_t | SDDS_ItemInsideWindow (void *data, int64_t index, int32_t type, double lower_limit, double upper_limit) |
Checks whether a data item is within a specified numeric window. | |
int32_t | SDDS_Logic (int32_t previous, int32_t match, uint32_t logic) |
Applies logical operations to determine the new state of a row flag based on previous and current match conditions. | |
SDDS_ARRAY * | SDDS_GetArray (SDDS_DATASET *SDDS_dataset, char *array_name, SDDS_ARRAY *memory) |
Retrieves an array from the current data table of an SDDS dataset. | |
char ** | SDDS_GetArrayInString (SDDS_DATASET *SDDS_dataset, char *array_name, int32_t *values) |
Retrieves an array from the current data table of an SDDS dataset and converts its elements to strings. | |
double * | SDDS_GetArrayInDoubles (SDDS_DATASET *SDDS_dataset, char *array_name, int32_t *values) |
Retrieves an array from the current data table of an SDDS dataset and converts its elements to doubles. | |
int32_t * | SDDS_GetArrayInLong (SDDS_DATASET *SDDS_dataset, char *array_name, int32_t *values) |
Retrieves an array from the current data table of an SDDS dataset and converts its elements to 32-bit integers. | |
int32_t | SDDS_GetDescription (SDDS_DATASET *SDDS_dataset, char **text, char **contents) |
Retrieves the text and contents descriptions from an SDDS dataset. | |
int32_t | SDDS_SetArrayUnitsConversion (SDDS_DATASET *SDDS_dataset, char *array_name, char *new_units, char *old_units, double factor) |
Sets unit conversions for a specified array in an SDDS dataset. | |
int32_t | SDDS_SetColumnUnitsConversion (SDDS_DATASET *SDDS_dataset, char *column_name, char *new_units, char *old_units, double factor) |
Sets unit conversions for a specified column in an SDDS dataset. | |
int32_t | SDDS_SetParameterUnitsConversion (SDDS_DATASET *SDDS_dataset, char *parameter_name, char *new_units, char *old_units, double factor) |
Sets unit conversions for a specified parameter in an SDDS dataset. | |
This file contains routines for getting pointers to SDDS objects like columns and parameters.
This file provides functions for extracting data in the Self-Describing Data Sets (SDDS) format.
Definition in file SDDS_extract.c.
int32_t SDDS_AssertColumnFlags | ( | SDDS_DATASET * | SDDS_dataset, |
uint32_t | mode, | ||
... ) |
Sets acceptance flags for columns based on specified criteria.
This function allows setting column flags in two modes:
A non-zero flag indicates that a column is "of interest", while a zero flag marks it for rejection.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | Operation mode determining how flags are set. Possible values:
|
... | Variable arguments based on the selected mode:
|
SDDS_FLAG_ARRAY
, if columnsInArray
exceeds the number of allocated columns, it is truncated to fit.SDDS_INDEX_LIMITS
, if end
exceeds the number of columns, it is adjusted to the last valid column index.Definition at line 273 of file SDDS_extract.c.
int32_t SDDS_AssertRowFlags | ( | SDDS_DATASET * | SDDS_dataset, |
uint32_t | mode, | ||
... ) |
Sets acceptance flags for rows based on specified criteria.
This function allows setting row flags in two modes:
A non-zero flag indicates that a row is "of interest", while a zero flag marks it for rejection.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | Operation mode determining how flags are set. Possible values:
|
... | Variable arguments based on the selected mode:
|
SDDS_FLAG_ARRAY
, if rowsInArray
exceeds the number of allocated rows, it is truncated to fit.SDDS_INDEX_LIMITS
, if end
exceeds the number of rows, it is adjusted to the last valid row index.Definition at line 148 of file SDDS_extract.c.
int32_t SDDS_CopyColumn | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | target, | ||
int32_t | source ) |
Copies data from a source column to a target column within an SDDS dataset.
This function duplicates the data from the specified source column to the target column in the provided SDDS dataset. It handles both string and non-string data types appropriately, ensuring that memory is managed correctly for string entries.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
target | The index of the target column where data will be copied to. |
source | The index of the source column from which data will be copied. |
1
. On failure, returns 0
and sets an appropriate error message.1 | Indicates that the column copy was successful. |
0 | Indicates that an error occurred (e.g., invalid dataset, out-of-range indices, memory allocation failure, string copy failure). |
target
and source
must be valid column indices within the dataset.Definition at line 3928 of file SDDS_extract.c.
int32_t SDDS_CopyParameter | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | target, | ||
int32_t | source ) |
Copies a parameter from a source index to a target index within an SDDS dataset.
This function duplicates the parameter data from the source index to the target index in the provided SDDS dataset. It handles both string and non-string data types appropriately, ensuring that memory is managed correctly for string entries.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
target | The index of the target parameter where data will be copied to. |
source | The index of the source parameter from which data will be copied. |
1
. On failure, returns 0
and sets an appropriate error message.1 | Indicates that the parameter copy was successful. |
0 | Indicates that an error occurred (e.g., invalid dataset, out-of-range indices, memory allocation failure, string copy failure). |
target
and source
must be valid parameter indices within the dataset.Definition at line 4017 of file SDDS_extract.c.
int32_t SDDS_CountColumnsOfInterest | ( | SDDS_DATASET * | SDDS_dataset | ) |
Counts the number of columns marked as "of interest" in the current data table.
This function returns the total number of columns that have been flagged as "of interest" based on their acceptance flags.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
Definition at line 342 of file SDDS_extract.c.
int64_t SDDS_CountRowsOfInterest | ( | SDDS_DATASET * | SDDS_dataset | ) |
Counts the number of rows marked as "of interest" in the current data table.
This function iterates through the row acceptance flags and tallies the number of rows that are flagged as "of interest" (non-zero).
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
Definition at line 364 of file SDDS_extract.c.
int32_t SDDS_DeleteColumn | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name ) |
Deletes a specified column from an SDDS dataset.
Note: This function is currently non-functional and will abort execution if called.
This function is intended to remove a column identified by column_name
from the provided SDDS dataset. It handles the reordering of remaining columns and updates the dataset's layout accordingly. However, as indicated by the current implementation, the function is not operational and will terminate the program when invoked.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
column_name | A null-terminated string specifying the name of the column to be deleted. |
1
on success and 0
on failure.Definition at line 3845 of file SDDS_extract.c.
int32_t SDDS_DeleteParameter | ( | SDDS_DATASET * | SDDS_dataset, |
char * | parameter_name ) |
Deletes a specified parameter from an SDDS dataset.
This function removes a parameter identified by parameter_name
from the provided SDDS dataset. It shifts all subsequent parameters up to fill the gap left by the deleted parameter and updates the dataset's parameter count accordingly.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
parameter_name | A null-terminated string specifying the name of the parameter to be deleted. |
1
. On failure, returns 0
and sets an appropriate error message.1 | Indicates that the parameter was successfully deleted. |
0 | Indicates that an error occurred (e.g., invalid dataset, unrecognized parameter name, error copying parameters). |
Definition at line 3978 of file SDDS_extract.c.
int32_t SDDS_DeleteUnsetColumns | ( | SDDS_DATASET * | SDDS_dataset | ) |
Deletes all columns from an SDDS dataset that are not marked as "of interest".
This function iterates through all columns in the provided SDDS dataset and removes those that have not been flagged as "of interest". It ensures that only desired columns are retained, updating the dataset's layout and column order accordingly.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
1
. On failure, returns 0
and sets an appropriate error message.1 | Indicates that columns were successfully deleted. |
0 | Indicates that an error occurred (e.g., invalid dataset, failure to delete a column). |
Definition at line 3893 of file SDDS_extract.c.
int32_t SDDS_DeleteUnsetRows | ( | SDDS_DATASET * | SDDS_dataset | ) |
Deletes rows from an SDDS dataset that are not marked as "of interest".
This function removes all rows in the provided SDDS dataset that have not been flagged as "of interest" using prior selection functions. It effectively compacts the dataset by retaining only the desired rows and updating the row count accordingly.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
1
. On failure, returns 0
and sets an appropriate error message.1 | Indicates that rows were successfully deleted. |
0 | Indicates that an error occurred (e.g., invalid dataset, problem copying rows). |
Definition at line 3760 of file SDDS_extract.c.
int64_t SDDS_FilterRowsByNumScan | ( | SDDS_DATASET * | SDDS_dataset, |
char * | filter_column, | ||
uint32_t | mode ) |
Filters rows of interest in an SDDS dataset based on numeric scanning of a specified column.
This function marks rows in the provided SDDS dataset as "of interest" based on whether the entries in the specified filter column can be interpreted as valid numbers. It supports inversion of the filtering criterion through the mode
parameter.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
filter_column | A null-terminated string specifying the name of the column used for numeric scanning. This column must not be of string type. |
mode | An unsigned integer representing mode flags. Supported flags include:
|
-1
and sets an appropriate error message.-1 | Indicates that an error occurred (e.g., invalid dataset, unrecognized filter column, filter column is of string type). |
Non-negative | Integer representing the count of rows marked as "of interest". |
tokenIsNumber
to determine if an entry is a valid number.Definition at line 3697 of file SDDS_extract.c.
int64_t SDDS_FilterRowsOfInterest | ( | SDDS_DATASET * | SDDS_dataset, |
char * | filter_column, | ||
double | lower_limit, | ||
double | upper_limit, | ||
int32_t | logic ) |
Filters rows of interest in an SDDS dataset based on numeric ranges in a specified column.
This function marks rows in the provided SDDS dataset as "of interest" if the values in the specified filter column fall within the defined numeric range (lower_limit
to upper_limit
). Logical operations specified by the logic
parameter determine how the filtering interacts with existing row flags.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
filter_column | A null-terminated string specifying the name of the column used for numeric filtering. This column must be of a numeric type. |
lower_limit | The lower bound of the numeric range. Rows with values below this limit are excluded. |
upper_limit | The upper bound of the numeric range. Rows with values above this limit are excluded. |
logic | An integer representing logical operation flags. Supported flags include:
|
-1
and sets an appropriate error message.-1 | Indicates that an error occurred (e.g., invalid dataset, unrecognized filter column, non-numeric filter column). |
Non-negative | Integer representing the count of rows marked as "of interest". |
SDDS_SHORT
, SDDS_USHORT
, SDDS_LONG
, SDDS_ULONG
, SDDS_LONG64
, SDDS_ULONG64
, SDDS_FLOAT
, SDDS_DOUBLE
, SDDS_LONGDOUBLE
).Definition at line 3628 of file SDDS_extract.c.
SDDS_ARRAY * SDDS_GetArray | ( | SDDS_DATASET * | SDDS_dataset, |
char * | array_name, | ||
SDDS_ARRAY * | memory ) |
Retrieves an array from the current data table of an SDDS dataset.
This function returns a pointer to a SDDS_ARRAY
structure containing the data and other information about a specified array within the current data table of an SDDS dataset. The function can either populate a provided SDDS_ARRAY
structure or allocate a new one if memory
is NULL
.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
array_name | A null-terminated string specifying the name of the SDDS array to retrieve. |
memory | Optional pointer to an existing SDDS_ARRAY structure where the array information will be stored. If NULL , a new SDDS_ARRAY structure is allocated and returned. |
SDDS_ARRAY
structure containing the array data and metadata. If memory
is not NULL
, the function populates the provided structure. On failure, returns NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, unrecognized array name, memory allocation failure). |
Non-NULL | Pointer to a SDDS_ARRAY structure containing the array data and metadata. |
SDDS_ARRAY
structure if memory
is NULL
.definition
field in the returned structure points to the internal copy of the array definition.Definition at line 4209 of file SDDS_extract.c.
double * SDDS_GetArrayInDoubles | ( | SDDS_DATASET * | SDDS_dataset, |
char * | array_name, | ||
int32_t * | values ) |
Retrieves an array from the current data table of an SDDS dataset and converts its elements to doubles.
This function extracts the specified array from the provided SDDS dataset and converts each of its elements into a double
value. It ensures that the array is of a compatible numeric type before performing the conversion.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
array_name | A null-terminated string specifying the name of the SDDS array to retrieve and convert. |
values | Pointer to an integer where the number of elements in the array will be stored upon successful completion. |
double
values representing the SDDS array elements. On failure, returns NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, unrecognized array name, incompatible array type, memory allocation failure). |
Non-NULL | Pointer to an array of double values representing the SDDS array elements. |
double
array.Definition at line 4413 of file SDDS_extract.c.
int32_t * SDDS_GetArrayInLong | ( | SDDS_DATASET * | SDDS_dataset, |
char * | array_name, | ||
int32_t * | values ) |
Retrieves an array from the current data table of an SDDS dataset and converts its elements to 32-bit integers.
This function extracts the specified array from the provided SDDS dataset and converts each of its elements into a 32-bit integer (int32_t
). It ensures that the array is of a compatible numeric type before performing the conversion.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
array_name | A null-terminated string specifying the name of the SDDS array to retrieve and convert. |
values | Pointer to an integer where the number of elements in the array will be stored upon successful completion. |
int32_t
values representing the SDDS array elements. On failure, returns NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, unrecognized array name, incompatible array type, memory allocation failure). |
Non-NULL | Pointer to an array of int32_t values representing the SDDS array elements. |
int32_t
array.Definition at line 4518 of file SDDS_extract.c.
char ** SDDS_GetArrayInString | ( | SDDS_DATASET * | SDDS_dataset, |
char * | array_name, | ||
int32_t * | values ) |
Retrieves an array from the current data table of an SDDS dataset and converts its elements to strings.
This function extracts the specified array from the provided SDDS dataset and converts each of its elements into a null-terminated string representation. The conversion respects the data type of the array elements, ensuring accurate string formatting.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
array_name | A null-terminated string specifying the name of the SDDS array to retrieve and convert. |
values | Pointer to an integer where the number of elements in the array will be stored upon successful completion. |
char **
). Each string represents an element of the original SDDS array. On failure, returns NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, unrecognized array name, memory allocation failure). |
Non-NULL | Pointer to an array of strings representing the SDDS array elements. |
Definition at line 4291 of file SDDS_extract.c.
void * SDDS_GetCastMatrixOfRows | ( | SDDS_DATASET * | SDDS_dataset, |
int64_t * | n_rows, | ||
int32_t | sddsType ) |
Retrieves all rows marked as "of interest" as a matrix, casting each value to a specified numerical type.
This function extracts all rows that are flagged as "of interest" within the current data table of a dataset and casts each value to a specified numerical type. It processes only those columns that are flagged as "of interest" and returns the data as a matrix, where each row is an array of casted values corresponding to the selected columns.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
n_rows | Pointer to an int64_t variable where the number of rows retrieved will be stored. |
sddsType | Integer constant representing the desired data type for casting (e.g., SDDS_DOUBLE , SDDS_FLOAT , etc.). Must be a valid numerical type as defined by SDDS. |
sddsType
, memory allocation failure). In this case, an error message is recorded internally.sddsType
is a valid numerical type supported by SDDS.n_rows
.SDDS_CastValue
. If casting fails for any value, the function will terminate and return NULL
.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data for the columns may be freed after access.Definition at line 2343 of file SDDS_extract.c.
void * SDDS_GetColumn | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name ) |
Retrieves a copy of the data for a specified column, including only rows marked as "of interest".
This function returns a newly allocated array containing data from the specified column for all rows that are flagged as "of interest". The data type of the returned array matches the column's data type.
For columns of type SDDS_STRING
, the returned array is of type char**
, with each element being a dynamically allocated string.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_name | NULL-terminated string specifying the name of the column to retrieve. |
SDDS_STRING
types, each string within the array should be freed individually, followed by the array itself.SDDS_CountRowsOfInterest
.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data may be freed after access.Definition at line 611 of file SDDS_extract.c.
double * SDDS_GetColumnInDoubles | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name ) |
Retrieves the data of a specified numerical column as an array of doubles, considering only rows marked as "of interest".
This function extracts data from a specified column within the current data table of a dataset. It processes only those rows that are flagged as "of interest" (i.e., have a non-zero acceptance flag). The extracted data is returned as a newly allocated array of double
values.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_name | NULL-terminated string specifying the name of the column from which data is to be retrieved. |
double
containing the data from the specified column for all rows marked as "of interest".SDDS_CHARACTER
) will result in an error.SDDS_CountRowsOfInterest
.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data for the column may be freed after access.Definition at line 872 of file SDDS_extract.c.
float * SDDS_GetColumnInFloats | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name ) |
Retrieves the data of a specified numerical column as an array of floats, considering only rows marked as "of interest".
This function extracts data from a specified column within the current data table of a dataset. It processes only those rows that are flagged as "of interest" (i.e., have a non-zero acceptance flag). The extracted data is returned as a newly allocated array of float
values.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_name | NULL-terminated string specifying the name of the column from which data is to be retrieved. |
float
containing the data from the specified column for all rows marked as "of interest".SDDS_CHARACTER
) will result in an error.SDDS_CountRowsOfInterest
.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data for the column may be freed after access.Definition at line 1014 of file SDDS_extract.c.
int32_t * SDDS_GetColumnInLong | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name ) |
Retrieves the data of a specified numerical column as an array of 32-bit integers, considering only rows marked as "of interest".
This function extracts data from a specified column within the current data table of a dataset. It processes only those rows that are flagged as "of interest" (i.e., have a non-zero acceptance flag). The extracted data is returned as a newly allocated array of int32_t
values.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_name | NULL-terminated string specifying the name of the column from which data is to be retrieved. |
int32_t
containing the data from the specified column for all rows marked as "of interest".SDDS_CHARACTER
) will result in an error.SDDS_CountRowsOfInterest
.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data for the column may be freed after access.Definition at line 1157 of file SDDS_extract.c.
long double * SDDS_GetColumnInLongDoubles | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name ) |
Retrieves the data of a specified numerical column as an array of long doubles, considering only rows marked as "of interest".
This function extracts data from a specified column within the current data table of a dataset. It processes only those rows that are flagged as "of interest" (i.e., have a non-zero acceptance flag). The extracted data is returned as a newly allocated array of long double
values.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_name | NULL-terminated string specifying the name of the column from which data is to be retrieved. |
long double
containing the data from the specified column for all rows marked as "of interest".SDDS_CHARACTER
) will result in an error.SDDS_CountRowsOfInterest
.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data for the column may be freed after access.Definition at line 730 of file SDDS_extract.c.
short * SDDS_GetColumnInShort | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name ) |
Retrieves the data of a specified numerical column as an array of short integers, considering only rows marked as "of interest".
This function extracts data from a specified column within the current data table of a dataset. It processes only those rows that are flagged as "of interest" (i.e., have a non-zero acceptance flag). The extracted data is returned as a newly allocated array of short
values.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_name | NULL-terminated string specifying the name of the column from which data is to be retrieved. |
short
containing the data from the specified column for all rows marked as "of interest".SDDS_CHARACTER
) will result in an error.SDDS_CountRowsOfInterest
.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data for the column may be freed after access.Definition at line 1298 of file SDDS_extract.c.
char ** SDDS_GetColumnInString | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name ) |
Retrieves the data of a specified column as an array of strings, considering only rows marked as "of interest".
This function extracts data from a specified column within the current data table of a dataset. It processes only those rows that are flagged as "of interest" (i.e., have a non-zero acceptance flag). The extracted data is returned as a newly allocated array of char*
(strings).
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_name | NULL-terminated string specifying the name of the column from which data is to be retrieved. |
char*
containing the data from the specified column for all rows marked as "of interest".SDDS_STRING
or SDDS_CHARACTER
). Attempting to retrieve data from a non-string column will result in an error.SDDS_CountRowsOfInterest
.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data for the column may be freed after access.Definition at line 1439 of file SDDS_extract.c.
int32_t SDDS_GetDescription | ( | SDDS_DATASET * | SDDS_dataset, |
char ** | text, | ||
char ** | contents ) |
Retrieves the text and contents descriptions from an SDDS dataset.
This function extracts the text description and contents description from the specified SDDS dataset. The descriptions are copied into the provided pointers if they are not NULL
. This allows users to obtain metadata information about the dataset's content and purpose.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
text | Pointer to a char* variable where the text description will be copied. If NULL , the text description is not retrieved. |
contents | Pointer to a char* variable where the contents description will be copied. If NULL , the contents description is not retrieved. |
1
on successful retrieval of the descriptions. On failure, returns 0
and sets an appropriate error message.1 | Indicates that the descriptions were successfully retrieved and copied. |
0 | Indicates that an error occurred (e.g., invalid dataset, memory allocation failure). |
text
and contents
if they are not NULL
.Definition at line 4626 of file SDDS_extract.c.
void * SDDS_GetDoubleMatrixFromColumn | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name, | ||
int64_t | dimension1, | ||
int64_t | dimension2, | ||
int32_t | mode ) |
Extracts a matrix of doubles from a specified column in the current data table of an SDDS dataset.
This function retrieves the data from the specified column as double
values and organizes it into a matrix with the given dimensions. The data is arranged in either row-major or column-major order based on the mode
parameter. The function allocates memory for the matrix, which should be freed by the caller.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
column_name | A null-terminated string specifying the name of the column from which to extract the matrix. |
dimension1 | The number of rows in the resulting matrix. |
dimension2 | The number of columns in the resulting matrix. |
mode | Specifies the data layout in the matrix. Use SDDS_ROW_MAJOR_DATA for row-major order or SDDS_COLUMN_MAJOR_DATA for column-major order. |
double
values. The matrix is an array of pointers, where each pointer refers to a row (for row-major) or a column (for column-major) in the matrix. On failure, returns NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, column not found, dimension mismatch, memory allocation failure). |
Non-NULL | Pointer to the allocated matrix containing double values. |
Definition at line 3214 of file SDDS_extract.c.
void * SDDS_GetFixedValueParameter | ( | SDDS_DATASET * | SDDS_dataset, |
char * | parameter_name, | ||
void * | memory ) |
Retrieves the fixed value of a specified parameter from an SDDS dataset.
This function accesses the fixed value defined for a given parameter in the dataset's layout and converts it to the appropriate data type. If the memory
pointer is provided, the converted value is stored at the specified memory location. Otherwise, memory is allocated internally to hold the value, which must be freed by the caller.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
parameter_name | A null-terminated string specifying the name of the parameter whose fixed value is to be retrieved. |
memory | Optional pointer to a memory location where the fixed value will be stored. The size of the memory should correspond to the size of the parameter's data type. If NULL , memory is allocated internally to hold the value. |
NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, parameter not found, invalid data type, memory allocation failure, or scan failure). |
Non-NULL | Pointer to the memory containing the fixed parameter value. |
memory
parameter is NULL
.Definition at line 3084 of file SDDS_extract.c.
void * SDDS_GetInternalColumn | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name ) |
Retrieves an internal pointer to the data of a specified column, including all rows.
This function returns a direct pointer to the internal data array of the specified column. Unlike SDDS_GetColumn
, it includes all rows, regardless of their acceptance flags.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_name | NULL-terminated string specifying the name of the column to retrieve. |
DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data may be freed after access.Definition at line 688 of file SDDS_extract.c.
void * SDDS_GetMatrixFromColumn | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name, | ||
int64_t | dimension1, | ||
int64_t | dimension2, | ||
int32_t | mode ) |
Extracts a matrix from a specified column in the current data table of an SDDS dataset.
This function retrieves the data from the specified column and organizes it into a matrix with the given dimensions. The data is arranged in either row-major or column-major order based on the mode
parameter. The function allocates memory for the matrix, which should be freed by the caller.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
column_name | A null-terminated string specifying the name of the column from which to extract the matrix. |
dimension1 | The number of rows in the resulting matrix. |
dimension2 | The number of columns in the resulting matrix. |
mode | Specifies the data layout in the matrix. Use SDDS_ROW_MAJOR_DATA for row-major order or SDDS_COLUMN_MAJOR_DATA for column-major order. |
NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, column not found, dimension mismatch, memory allocation failure). |
Non-NULL | Pointer to the allocated matrix. |
Definition at line 3142 of file SDDS_extract.c.
void * SDDS_GetMatrixOfRows | ( | SDDS_DATASET * | SDDS_dataset, |
int64_t * | n_rows ) |
Retrieves all rows marked as "of interest" as a matrix (array of row arrays).
This function extracts all rows that are flagged as "of interest" within the current data table of a dataset. It processes only those columns that are flagged as "of interest" and returns the data as a matrix, where each row is an array of values corresponding to the selected columns.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
n_rows | Pointer to an int64_t variable where the number of rows retrieved will be stored. |
n_rows
.SDDS_STRING
), each element in the row arrays is a dynamically allocated string that must be freed individually.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data for the columns may be freed after access.Definition at line 2266 of file SDDS_extract.c.
void * SDDS_GetNumericColumn | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name, | ||
int32_t | desiredType ) |
Retrieves the data of a specified numerical column as an array of a desired numerical type, considering only rows marked as "of interest".
This function extracts data from a specified column within the current data table of a dataset. It processes only those rows that are flagged as "of interest" (i.e., have a non-zero acceptance flag). The extracted data is returned as a newly allocated array of the specified numerical type.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_name | NULL-terminated string specifying the name of the column from which data is to be retrieved. |
desiredType | Integer constant representing the desired data type for the returned array. Must be one of the supported SDDS numerical types (e.g., SDDS_DOUBLE , SDDS_FLOAT , etc.). |
SDDS_CHARACTER
) will result in an error.SDDS_CountRowsOfInterest
.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data for the column may be freed after access.desiredType
matches the column's data type, this function internally calls SDDS_GetColumn
. Otherwise, it performs type casting using SDDS_CastValue
.Definition at line 1617 of file SDDS_extract.c.
void * SDDS_GetParameter | ( | SDDS_DATASET * | SDDS_dataset, |
char * | parameter_name, | ||
void * | memory ) |
Retrieves the value of a specified parameter from the current data table of a data set.
This function accesses the value of a specific parameter (identified by its name) within the current data table of a dataset. The retrieved value is either copied into user-provided memory or returned as a direct pointer to the internal data.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
parameter_name | NULL-terminated string specifying the name of the parameter from which the value is to be retrieved. |
memory | Pointer to user-allocated memory where the retrieved parameter value will be stored. If NULL , the function allocates memory. |
memory
(if provided) or to newly allocated memory.memory
is NULL
, the function allocates memory that the caller must free to prevent memory leaks.SDDS_STRING
), the function copies the string into memory
. A typical usage would involve passing a pointer to a char*
variable. c char *string; SDDS_GetParameter(&SDDS_dataset, "parameter_name", &string); // or string = *(char**)SDDS_GetParameter(&SDDS_dataset, "parameter_name", NULL);
SDDS_GetParameterType
.DONT_TRACK_PARAMETER_MEMORY_AFTER_ACCESS
, the internal data for the parameter may be freed after access.Definition at line 2481 of file SDDS_extract.c.
double * SDDS_GetParameterAsDouble | ( | SDDS_DATASET * | SDDS_dataset, |
char * | parameter_name, | ||
double * | memory ) |
Retrieves the value of a specified parameter as a double
from the current data table of an SDDS dataset.
This function searches for the parameter by name within the provided SDDS dataset and retrieves its value as a double
. If the memory
pointer is supplied, the value is stored at the specified memory location. If memory
is NULL
, the function allocates memory for storing the value, which should be freed by the caller.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
parameter_name | A null-terminated string specifying the name of the parameter to retrieve. |
memory | Optional pointer to a double variable where the parameter value will be stored. If NULL , memory is allocated internally to hold the value. |
double
containing the parameter value. On failure, returns NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, parameter not found, type mismatch, or memory allocation failure). |
Non-NULL | Pointer to the double containing the parameter value. |
memory
parameter is NULL
.Definition at line 2782 of file SDDS_extract.c.
char * SDDS_GetParameterAsFormattedString | ( | SDDS_DATASET * | SDDS_dataset, |
char * | parameter_name, | ||
char ** | memory, | ||
char * | suppliedformat ) |
Retrieves the value of a specified parameter as a formatted string from the current data table of an SDDS dataset.
This function searches for the parameter by name within the provided SDDS dataset, formats its value based on the supplied format string, and returns it as a null-terminated string. If suppliedformat
is NULL
, the function uses the format string defined in the parameter's definition. If the memory
pointer is provided, the formatted string is stored at the specified memory location. Otherwise, memory is allocated internally to hold the string, which must be freed by the caller.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
parameter_name | A null-terminated string specifying the name of the parameter to retrieve. |
memory | Optional pointer to a char* variable where the formatted string will be stored. If NULL , memory is allocated internally to hold the string. |
suppliedformat | A null-terminated format string (similar to printf format specifiers) to format the parameter value. If NULL , the function uses the format string defined in the parameter's definition within the dataset. |
NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, parameter not found, invalid format string, type mismatch, memory allocation failure, or unknown data type). |
Non-NULL | Pointer to the null-terminated string containing the formatted parameter value. |
memory
parameter is NULL
.Definition at line 2935 of file SDDS_extract.c.
int32_t * SDDS_GetParameterAsLong | ( | SDDS_DATASET * | SDDS_dataset, |
char * | parameter_name, | ||
int32_t * | memory ) |
Retrieves the value of a specified parameter as a 32-bit integer from the current data table of a data set.
This function accesses the value of a specific parameter (identified by its name) within the current data table of a dataset and converts it to a 32-bit integer (int32_t
). The converted value is either stored in user-provided memory or allocated by the function.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
parameter_name | NULL-terminated string specifying the name of the parameter from which the value is to be retrieved. |
memory | Pointer to a 32-bit integer where the converted parameter value will be stored. If NULL , the function allocates memory. |
int32_t
value stored in memory
(if provided) or to newly allocated memory containing the converted value.SDDS_STRING
). In this case, an error message is recorded internally.memory
is NULL
, the function allocates memory that the caller must free to prevent memory leaks.SDDS_STRING
. Attempting to retrieve string parameters as long integers will result in an error.SDDS_ConvertToLong
, which handles casting from various numerical types to int32_t
.Definition at line 2615 of file SDDS_extract.c.
int64_t * SDDS_GetParameterAsLong64 | ( | SDDS_DATASET * | SDDS_dataset, |
char * | parameter_name, | ||
int64_t * | memory ) |
Retrieves the value of a specified parameter as a 64-bit integer from the current data table of an SDDS dataset.
This function looks up the parameter by name within the given SDDS dataset and returns its value as an int64_t
. If the memory
pointer is provided, the value is stored at the given memory location. Otherwise, the function allocates memory to store the value, which must be freed by the caller.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
parameter_name | A null-terminated string specifying the name of the parameter to retrieve. |
memory | Optional pointer to an int64_t variable where the parameter value will be stored. If NULL , memory is allocated internally to hold the value. |
int64_t
containing the parameter value. On failure, returns NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, parameter not found, type mismatch, or memory allocation failure). |
Non-NULL | Pointer to the int64_t containing the parameter value. |
memory
parameter is NULL
.Definition at line 2671 of file SDDS_extract.c.
long double * SDDS_GetParameterAsLongDouble | ( | SDDS_DATASET * | SDDS_dataset, |
char * | parameter_name, | ||
long double * | memory ) |
Retrieves the value of a specified parameter as a long double
from the current data table of an SDDS dataset.
This function searches for the parameter by name within the provided SDDS dataset and retrieves its value as a long double
. If the memory
pointer is supplied, the value is stored at the specified memory location. If memory
is NULL
, the function allocates memory for storing the value, which should be freed by the caller.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
parameter_name | A null-terminated string specifying the name of the parameter to retrieve. |
memory | Optional pointer to a long double variable where the parameter value will be stored. If NULL , memory is allocated internally to hold the value. |
long double
containing the parameter value. On failure, returns NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, parameter not found, type mismatch, or memory allocation failure). |
Non-NULL | Pointer to the long double containing the parameter value. |
memory
parameter is NULL
.Definition at line 2727 of file SDDS_extract.c.
char * SDDS_GetParameterAsString | ( | SDDS_DATASET * | SDDS_dataset, |
char * | parameter_name, | ||
char ** | memory ) |
Retrieves the value of a specified parameter as a string from the current data table of an SDDS dataset.
This function searches for the parameter by name within the provided SDDS dataset and retrieves its value as a string. The function formats the parameter's value based on its data type. If the memory
pointer is provided, the string is stored at the specified memory location. Otherwise, the function allocates memory to hold the string, which must be freed by the caller.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
parameter_name | A null-terminated string specifying the name of the parameter to retrieve. |
memory | Optional pointer to a char* variable where the string will be stored. If NULL , memory is allocated internally to hold the string. |
NULL
and sets an appropriate error message.NULL | Indicates that an error occurred (e.g., invalid dataset, parameter not found, type mismatch, memory allocation failure, or unknown data type). |
Non-NULL | Pointer to the null-terminated string containing the parameter value. |
memory
parameter is NULL
.Definition at line 2838 of file SDDS_extract.c.
void * SDDS_GetParameterByIndex | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | index, | ||
void * | memory ) |
Retrieves the value of a specified parameter by its index from the current data table of a data set.
This function accesses the value of a specific parameter (identified by its index) within the current data table of a dataset. The retrieved value is either copied into user-provided memory or returned as a direct pointer to the internal data.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
index | Zero-based index of the parameter to retrieve. Must be within the range [0, n_parameters-1]. |
memory | Pointer to user-allocated memory where the retrieved parameter value will be stored. If NULL , the function allocates memory. |
memory
(if provided) or to newly allocated memory.memory
is NULL
, the function allocates memory that the caller must free to prevent memory leaks.SDDS_STRING
), the function copies the string into memory
. A typical usage would involve passing a pointer to a char*
variable. c char *string; SDDS_GetParameterByIndex(&SDDS_dataset, index, &string); // or string = *(char**)SDDS_GetParameterByIndex(&SDDS_dataset, index, NULL);
SDDS_GetParameterType
.DONT_TRACK_PARAMETER_MEMORY_AFTER_ACCESS
, the internal data for the parameter may be freed after access.Definition at line 2554 of file SDDS_extract.c.
int32_t SDDS_GetParameters | ( | SDDS_DATASET * | SDDS_dataset, |
... ) |
Retrieves multiple parameter values from the current data table of a data set.
This variadic function allows the retrieval of multiple parameter values in a single call. Each parameter's name and corresponding memory location are provided as pairs of arguments.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
... | Variable arguments consisting of pairs of:
|
memory
pointers provided are of appropriate types and have sufficient space to hold the parameter values.NULL
as the parameter name. c SDDS_GetParameters(&SDDS_dataset, "param1", &value1, "param2", &value2, NULL);
Definition at line 2420 of file SDDS_extract.c.
void * SDDS_GetRow | ( | SDDS_DATASET * | SDDS_dataset, |
int64_t | srow_index, | ||
void * | memory ) |
Retrieves the data of a specific selected row as an array, considering only columns marked as "of interest".
This function extracts data from a specific selected row (identified by its selected row index among rows marked as "of interest") within the current data table of a dataset. It processes only those columns that are flagged as "of interest" and returns the row's data as a newly allocated array or stores it in user-provided memory.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
srow_index | Zero-based index representing the position of the selected row among all rows marked as "of interest". |
memory | Pointer to user-allocated memory where the retrieved row data will be stored. If NULL , the function allocates memory. |
memory
(if provided) or to newly allocated memory.memory
is NULL
, the function allocates memory that the caller must free to prevent memory leaks.SDDS_STRING
), each element in the returned array is a dynamically allocated string that must be freed individually, followed by the array itself.SDDS_CountColumnsOfInterest
.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data for the columns may be freed after access.Definition at line 2201 of file SDDS_extract.c.
int32_t SDDS_GetRowFlag | ( | SDDS_DATASET * | SDDS_dataset, |
int64_t | row ) |
Retrieves the acceptance flag of a specific row in the current data table.
This function fetches the acceptance flag for a given row. The flag indicates whether the row is "of interest" (non-zero) or rejected (zero).
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
row | Index of the row whose flag is to be retrieved. Must be within the range [0, n_rows-1]. |
Definition at line 71 of file SDDS_extract.c.
int32_t SDDS_GetRowFlags | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t * | flag, | ||
int64_t | rows ) |
Retrieves the acceptance flags for all rows in the current data table.
This function copies the acceptance flags of each row into a provided array. Each flag indicates whether the corresponding row is "of interest" (non-zero) or rejected (zero).
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
flag | Pointer to an integer array where the row flags will be stored. The array must have at least rows elements. |
rows | Number of rows to retrieve flags for. Typically, this should match the total number of rows in the data table. |
flag
array is adequately allocated to hold the flags for all specified rows.Definition at line 97 of file SDDS_extract.c.
int32_t SDDS_GetRowType | ( | SDDS_DATASET * | SDDS_dataset | ) |
Determines the data type of the rows based on selected columns in the current data table.
This function iterates through all columns marked as "of interest" and verifies that they share the same data type. If all selected columns have a consistent data type, that type is returned. If there is a mismatch in data types among the selected columns, an error is recorded.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
Definition at line 2149 of file SDDS_extract.c.
int64_t SDDS_GetSelectedRowIndex | ( | SDDS_DATASET * | SDDS_dataset, |
int64_t | srow_index ) |
Retrieves the actual row index corresponding to a selected row position within the current data table.
This function maps a selected row index (i.e., the position among rows marked as "of interest") to its corresponding actual row index within the dataset's data table.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
srow_index | Zero-based index representing the position of the selected row among all rows marked as "of interest". |
srow_index
out of range).srow_index
is within the valid range [0, SDDS_CountRowsOfInterest(SDDS_dataset)
- 1] to avoid out-of-range errors.Definition at line 1701 of file SDDS_extract.c.
void * SDDS_GetValue | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name, | ||
int64_t | srow_index, | ||
void * | memory ) |
Retrieves the value from a specified column and selected row, optionally storing it in provided memory.
This function accesses the value of a specific column and selected row within the current data table of a dataset. It returns the value as a pointer to the data, allowing for both direct access and optional storage in user-provided memory.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_name | NULL-terminated string specifying the name of the column from which the value is to be retrieved. |
srow_index | Zero-based index representing the position of the selected row among all rows marked as "of interest". |
memory | Pointer to user-allocated memory where the retrieved value will be stored. If NULL , the function allocates memory internally, and the caller is responsible for freeing it. |
memory
(if provided) or in newly allocated memory.memory
is NULL
, the function allocates memory that the caller must free to prevent memory leaks.memory
is of the appropriate type matching the column's data type.SDDS_STRING
), the function copies the string into memory
. A typical usage would involve passing a pointer to a char*
variable. c char *string; SDDS_GetValue(&SDDS_dataset, "name", index, &string); // or string = *(char**)SDDS_GetValue(&SDDS_dataset, "name", index, NULL);
SDDS_CountRowsOfInterest
.Definition at line 1754 of file SDDS_extract.c.
double SDDS_GetValueAsDouble | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name, | ||
int64_t | srow_index ) |
Retrieves the value from a specified column and selected row, casting it to a double.
This function accesses the value of a specific column and selected row within the current data table of a dataset. It casts the retrieved value to a double
before returning it.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_name | NULL-terminated string specifying the name of the column from which the value is to be retrieved. |
srow_index | Zero-based index representing the position of the selected row among all rows marked as "of interest". |
SDDS_CHARACTER
) will result in an error.Definition at line 1821 of file SDDS_extract.c.
void * SDDS_GetValueByAbsIndex | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | column_index, | ||
int64_t | row_index, | ||
void * | memory ) |
Retrieves the value from a specified column and absolute row index, optionally storing it in provided memory.
This function accesses the value of a specific column (identified by its index) and an absolute row index within the current data table of a dataset. The retrieved value is either copied into user-provided memory or returned as a direct pointer to the internal data.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_index | Zero-based index of the column from which the value is to be retrieved. Must be within the range [0, n_columns-1]. |
row_index | Absolute zero-based row index within the dataset's data table. Must be within the range [0, n_rows-1]. |
memory | Pointer to user-allocated memory where the retrieved value will be stored. If NULL , the function returns a pointer to the internal data. |
memory
(if provided) or to the internal data.memory
is NULL
, the function returns a direct pointer to the internal data. Modifying the data through this pointer affects the dataset's internal state.memory
is provided, ensure that it points to sufficient memory to hold the data type of the column.memory
type matches the column's data type.SDDS_GetValueByIndex
, this function uses an absolute row index rather than a selected row index among rows marked as "of interest".SDDS_STRING
), the function copies the string into memory
. A typical usage would involve passing a pointer to a char*
variable. c char *string; SDDS_GetValueByAbsIndex(&SDDS_dataset, column_index, row_index, &string); // or string = *(char**)SDDS_GetValueByAbsIndex(&SDDS_dataset, column_index, row_index, NULL);
Definition at line 2090 of file SDDS_extract.c.
void * SDDS_GetValueByIndex | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | column_index, | ||
int64_t | srow_index, | ||
void * | memory ) |
Retrieves the value from a specified column and selected row, optionally storing it in provided memory.
This function accesses the value of a specific column (identified by its index) and a selected row (identified by its selected row index among rows marked as "of interest") within the current data table of a dataset. The retrieved value is either copied into user-provided memory or returned as a direct pointer to the internal data.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_index | Zero-based index of the column from which the value is to be retrieved. Must be within the range [0, n_columns-1]. |
srow_index | Zero-based index representing the position of the selected row among all rows marked as "of interest". |
memory | Pointer to user-allocated memory where the retrieved value will be stored. If NULL , the function returns a pointer to the internal data. |
memory
(if provided) or to the internal data.memory
is NULL
, the function returns a direct pointer to the internal data. Modifying the data through this pointer affects the dataset's internal state.memory
is provided, ensure that it points to sufficient memory to hold the data type of the column.memory
type matches the column's data type.SDDS_STRING
), the function copies the string into memory
. A typical usage would involve passing a pointer to a char*
variable. c char *string; SDDS_GetValueByIndex(&SDDS_dataset, column_index, index, &string); // or string = *(char**)SDDS_GetValueByIndex(&SDDS_dataset, column_index, index, NULL);
SDDS_CountRowsOfInterest
.Definition at line 2014 of file SDDS_extract.c.
double SDDS_GetValueByIndexAsDouble | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | column_index, | ||
int64_t | srow_index ) |
Retrieves the value from a specified column and selected row, casting it to a double.
This function accesses the value of a specific column (identified by its index) and a selected row (identified by its selected row index among rows marked as "of interest") within the current data table of a dataset. It casts the retrieved value to a double
before returning it.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_index | Zero-based index of the column from which the value is to be retrieved. Must be within the range [0, n_columns-1]. |
srow_index | Zero-based index representing the position of the selected row among all rows marked as "of interest". |
SDDS_CHARACTER
) will result in an error.0.0
may be ambiguous if it is a valid data value. Always check for errors using SDDS_CheckError
or similar mechanisms.SDDS_CountRowsOfInterest
.DONT_TRACK_COLUMN_MEMORY_AFTER_ACCESS
, the internal data for the column may be freed after access.Definition at line 1914 of file SDDS_extract.c.
int32_t SDDS_ItemInsideWindow | ( | void * | data, |
int64_t | index, | ||
int32_t | type, | ||
double | lower_limit, | ||
double | upper_limit ) |
Checks whether a data item is within a specified numeric window.
This function determines if the data item at the given index within the data array falls within the range defined by lower_limit
and upper_limit
. It handles various numeric data types and ensures that the value is neither NaN nor infinity.
data | Pointer to the data array. |
index | The index of the item within the data array to be checked. |
type | The data type of the item. Supported types include:
|
lower_limit | The lower bound of the numeric window. |
upper_limit | The upper bound of the numeric window. |
1
if the item is within the window and valid, otherwise returns 0
.1 | Indicates that the item is within the specified numeric window and is a valid number. |
0 | Indicates that the item is outside the specified window, is NaN, is infinite, or the data type is non-numeric. |
data
array is properly initialized and contains valid data before calling this function.Definition at line 4077 of file SDDS_extract.c.
int32_t SDDS_Logic | ( | int32_t | previous, |
int32_t | match, | ||
uint32_t | logic ) |
Applies logical operations to determine the new state of a row flag based on previous and current match conditions.
This function evaluates logical conditions between a previous flag (previous
) and a current match flag (match
) based on the provided logic
flags. It supports various logical operations such as AND, OR, negation of previous flags, and negation of match results.
previous | The previous state of the row flag (typically 0 or 1 ). |
match | The current match result to be combined with the previous flag. |
logic | An unsigned integer representing logical operation flags. Supported flags include:
|
0
or 1
).1 | Indicates that the final logical condition evaluates to true. |
0 | Indicates that the final logical condition evaluates to false. |
Definition at line 4165 of file SDDS_extract.c.
int64_t SDDS_MatchRowsOfInterest | ( | SDDS_DATASET * | SDDS_dataset, |
char * | selection_column, | ||
char * | label_to_match, | ||
int32_t | logic ) |
Matches and marks rows of interest in an SDDS dataset based on label matching.
This function marks rows in the provided SDDS dataset as "of interest" by matching labels in a specified column against a target label. It supports both direct and indirect matching, as well as case-sensitive and case-insensitive comparisons, based on the provided logic flags.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
selection_column | A null-terminated string specifying the name of the column used for label matching. This column must be of string or character type. |
label_to_match | A null-terminated string specifying the label to match against the entries in the selection column. If logic includes SDDS_INDIRECT_MATCH , this parameter is treated as the name of another column used for indirect matching. |
logic | An integer representing logical operation flags. Supported flags include:
|
-1
and sets an appropriate error message.-1 | Indicates that an error occurred (e.g., invalid dataset, unrecognized selection column, type mismatch, unrecognized indirect column). |
Non-negative | Integer representing the count of rows marked as "of interest". |
SDDS_INDIRECT_MATCH
), the indirect column must exist and be of the same type as the selection column.Definition at line 3506 of file SDDS_extract.c.
int32_t SDDS_SetArrayUnitsConversion | ( | SDDS_DATASET * | SDDS_dataset, |
char * | array_name, | ||
char * | new_units, | ||
char * | old_units, | ||
double | factor ) |
Sets unit conversions for a specified array in an SDDS dataset.
This function updates the units of the specified array within the SDDS dataset and applies a conversion factor to all its elements if the dataset has already been read (i.e., pages_read > 0
). The function ensures that the new units are consistent with the old units if provided.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
array_name | A null-terminated string specifying the name of the array to update. |
new_units | A null-terminated string specifying the new units to assign to the array. This parameter must not be NULL . |
old_units | A null-terminated string specifying the expected current units of the array. If NULL , the function does not verify the existing units. |
factor | A double representing the conversion factor to apply to each element of the array. Each element will be multiplied by this factor. |
1
on successful unit conversion and update. On failure, returns 0
and sets an appropriate error message.1 | Indicates that the unit conversion was successfully applied. |
0 | Indicates that an error occurred (e.g., invalid dataset, unrecognized array name, type undefined, memory allocation failure). |
new_units
parameter must not be NULL
. Passing NULL
will result in an error.pages_read == 0
), the conversion factor is stored but not applied immediately.Definition at line 4675 of file SDDS_extract.c.
int32_t SDDS_SetColumnFlags | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | column_flag_value ) |
Sets the acceptance flags for all columns in the current data table of a data set.
This function initializes the acceptance flags for each column. A non-zero flag indicates that the column is "of interest" and should be considered in subsequent operations, while a zero flag marks the column for rejection.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
column_flag_value | Integer value to assign to all column flags.
|
column_flag_value
. It also updates the column_order
array accordingly.Definition at line 218 of file SDDS_extract.c.
int32_t SDDS_SetColumnsOfInterest | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | mode, | ||
... ) |
Sets the acceptance flags for columns based on specified naming criteria.
This function allows modifying column acceptance flags using various methods, including specifying column names directly or using pattern matching.
Supported modes:
NULL
.A non-zero flag indicates that a column is "of interest", while a zero flag marks it for rejection.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | Operation mode determining how columns are selected. Possible values:
|
... | Variable arguments based on the selected mode:
|
SDDS_MATCH_STRING
, the pattern
may include wildcards to match multiple column names.Definition at line 432 of file SDDS_extract.c.
int32_t SDDS_SetColumnUnitsConversion | ( | SDDS_DATASET * | SDDS_dataset, |
char * | column_name, | ||
char * | new_units, | ||
char * | old_units, | ||
double | factor ) |
Sets unit conversions for a specified column in an SDDS dataset.
This function updates the units of the specified column within the SDDS dataset and applies a conversion factor to all its elements if the dataset has already been read (i.e., pages_read > 0
). The function ensures that the new units are consistent with the old units if provided.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
column_name | A null-terminated string specifying the name of the column to update. |
new_units | A null-terminated string specifying the new units to assign to the column. This parameter must not be NULL . |
old_units | A null-terminated string specifying the expected current units of the column. If NULL , the function does not verify the existing units. |
factor | A double representing the conversion factor to apply to each element of the column. Each element will be multiplied by this factor. |
1
on successful unit conversion and update. On failure, returns 0
and sets an appropriate error message.1 | Indicates that the unit conversion was successfully applied. |
0 | Indicates that an error occurred (e.g., invalid dataset, unrecognized column name, type undefined, memory allocation failure). |
new_units
parameter must not be NULL
. Passing NULL
will result in an error.pages_read == 0
), the conversion factor is stored but not applied immediately.Definition at line 4788 of file SDDS_extract.c.
int32_t SDDS_SetParameterUnitsConversion | ( | SDDS_DATASET * | SDDS_dataset, |
char * | parameter_name, | ||
char * | new_units, | ||
char * | old_units, | ||
double | factor ) |
Sets unit conversions for a specified parameter in an SDDS dataset.
This function updates the units of the specified parameter within the SDDS dataset and applies a conversion factor to its value if the dataset has already been read (i.e., pages_read > 0
). The function ensures that the new units are consistent with the old units if provided.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
parameter_name | A null-terminated string specifying the name of the parameter to update. |
new_units | A null-terminated string specifying the new units to assign to the parameter. This parameter must not be NULL . |
old_units | A null-terminated string specifying the expected current units of the parameter. If NULL , the function does not verify the existing units. |
factor | A double representing the conversion factor to apply to the parameter's value. The parameter's value will be multiplied by this factor. |
1
on successful unit conversion and update. On failure, returns 0
and sets an appropriate error message.1 | Indicates that the unit conversion was successfully applied. |
0 | Indicates that an error occurred (e.g., invalid dataset, unrecognized parameter name, type undefined, memory allocation failure). |
new_units
parameter must not be NULL
. Passing NULL
will result in an error.pages_read == 0
), the conversion factor is stored but not applied immediately.Definition at line 4903 of file SDDS_extract.c.
int32_t SDDS_SetRowFlags | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | row_flag_value ) |
Sets the acceptance flags for all rows in the current data table of a data set.
This function initializes the acceptance flags for each row in the data table. A non-zero flag indicates that the row is "of interest" and should be considered in subsequent operations, while a zero flag marks the row for rejection.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
row_flag_value | Integer value to assign to all row flags.
|
row_flag_value
.Definition at line 46 of file SDDS_extract.c.
int64_t SDDS_SetRowsOfInterest | ( | SDDS_DATASET * | SDDS_dataset, |
char * | selection_column, | ||
int32_t | mode, | ||
... ) |
Sets the rows of interest in an SDDS dataset based on various selection criteria.
This function marks rows in the provided SDDS dataset as "of interest" based on the specified selection criteria. It supports multiple selection modes, allowing users to specify rows by an array of names, a single string containing multiple names, a variadic list of names, or by matching a specific string with logical operations.
Calling Modes:
NULL
. Additionally, each of these modes has a case-insensitive variant prefixed with SDDS_CI_
(e.g., SDDS_CI_NAME_ARRAY
).
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
selection_column | A null-terminated string specifying the name of the column used for row selection. This column must be of string type. |
mode | An integer representing the selection mode. Supported modes include:
|
... | Variable arguments corresponding to the selected mode:
|
-1
and sets an appropriate error message.-1 | Indicates that an error occurred (e.g., invalid dataset, unrecognized selection column, memory allocation failure, unknown mode). |
Non-negative | Integer representing the count of rows marked as "of interest". |
selection_column
exists and is of string type in the dataset.SDDS_NAMES_STRING
), the function handles memory management internally.Definition at line 3324 of file SDDS_extract.c.
int32_t SDDS_TransferRow | ( | SDDS_DATASET * | SDDS_dataset, |
int64_t | target, | ||
int64_t | source ) |
Transfers data from a source row to a target row within an SDDS dataset.
This function copies all column data from the specified source row to the target row in the provided SDDS dataset. It handles both string and non-string data types appropriately, ensuring that memory is managed correctly for string entries.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the dataset. |
target | The index of the target row where data will be copied to. |
source | The index of the source row from which data will be copied. |
1
. On failure, returns 0
and sets an appropriate error message.1 | Indicates that the row transfer was successful. |
0 | Indicates that an error occurred (e.g., invalid dataset, out-of-range indices, memory allocation failure, string copy failure). |
target
and source
must be valid row indices within the dataset.Definition at line 3802 of file SDDS_extract.c.