SDDSlib
|
This file provides functions for SDDS dataset preparations. More...
Go to the source code of this file.
Functions | |
int32_t | SDDS_AllocateColumnFlags (SDDS_DATASET *SDDS_target) |
int32_t | SDDS_StartPage (SDDS_DATASET *SDDS_dataset, int64_t expected_n_rows) |
int32_t | SDDS_ClearPage (SDDS_DATASET *SDDS_dataset) |
int32_t | SDDS_ShortenTable (SDDS_DATASET *SDDS_dataset, int64_t rows) |
int32_t | SDDS_LengthenTable (SDDS_DATASET *SDDS_dataset, int64_t n_additional_rows) |
int32_t | SDDS_SetParameters (SDDS_DATASET *SDDS_dataset, int32_t mode,...) |
int32_t | SDDS_SetParameter (SDDS_DATASET *SDDS_dataset, int32_t mode,...) |
int32_t | SDDS_SetParametersFromDoubles (SDDS_DATASET *SDDS_dataset, int32_t mode,...) |
int32_t | SDDS_SetParametersFromLongDoubles (SDDS_DATASET *SDDS_dataset, int32_t mode,...) |
int32_t | SDDS_SetRowValues (SDDS_DATASET *SDDS_dataset, int32_t mode, int64_t row,...) |
int32_t | SDDS_SetArrayVararg (SDDS_DATASET *SDDS_dataset, char *array_name, int32_t mode, void *data_pointer,...) |
Sets the values of an array variable in the SDDS dataset using variable arguments for dimensions. | |
int32_t | SDDS_SetArray (SDDS_DATASET *SDDS_dataset, char *array_name, int32_t mode, void *data_pointer, int32_t *dimension) |
Sets the values of an array variable in the SDDS dataset using specified dimensions. | |
int32_t | SDDS_AppendToArrayVararg (SDDS_DATASET *SDDS_dataset, char *array_name, int32_t mode, void *data_pointer, int32_t elements,...) |
Appends data to an existing array variable in the SDDS dataset using variable arguments for dimensions. | |
int32_t | SDDS_AdvanceCounter (int32_t *counter, int32_t *max_count, int32_t n_indices) |
Advances a multi-dimensional counter based on maximum counts for each dimension. | |
int32_t | SDDS_SetColumn (SDDS_DATASET *SDDS_dataset, int32_t mode, void *data, int64_t rows,...) |
Sets the values for one data column in the current data table of an SDDS dataset. | |
int32_t | SDDS_SetColumnFromDoubles (SDDS_DATASET *SDDS_dataset, int32_t mode, double *data, int64_t rows,...) |
Sets the values for a single data column using double-precision floating-point numbers. | |
int32_t | SDDS_SetColumnFromLongDoubles (SDDS_DATASET *SDDS_dataset, int32_t mode, long double *data, int64_t rows,...) |
Sets the values for a single data column using long double-precision floating-point numbers. | |
int32_t | SDDS_SetColumnFromFloats (SDDS_DATASET *SDDS_dataset, int32_t mode, float *data, int64_t rows,...) |
Sets the values for a single data column using single-precision floating-point numbers. | |
int32_t | SDDS_SetColumnFromLongs (SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t *data, int64_t rows,...) |
Sets the values for a single data column using long integer numbers. | |
This file provides functions for SDDS dataset preparations.
This file provides functions for SDDS dataset preparations.
Definition in file SDDS_dataprep.c.
int32_t SDDS_AdvanceCounter | ( | int32_t * | counter, |
int32_t * | max_count, | ||
int32_t | n_indices ) |
Advances a multi-dimensional counter based on maximum counts for each dimension.
This helper function increments a multi-dimensional counter array, handling carry-over for each dimension. It is typically used for iterating over multi-dimensional arrays in a nested loop fashion.
counter | Pointer to an array of integers representing the current count in each dimension. |
max_count | Pointer to an array of integers representing the maximum count for each dimension. |
n_indices | The number of dimensions (indices) in the counter and max_count arrays. |
-1
to indicate completion.Definition at line 1491 of file SDDS_dataprep.c.
int32_t SDDS_AllocateColumnFlags | ( | SDDS_DATASET * | SDDS_target | ) |
Allocates memory for column flags and column order arrays in the specified SDDS dataset.
This function allocates memory for the column_flag
and column_order
arrays based on the number of columns defined in the dataset's layout. It initializes column_flag
to 1 and column_order
to 0 and 1 respectively.
SDDS_target | Pointer to the SDDS_DATASET structure where column flags will be allocated. |
Definition at line 36 of file SDDS_dataprep.c.
int32_t SDDS_AppendToArrayVararg | ( | SDDS_DATASET * | SDDS_dataset, |
char * | array_name, | ||
int32_t | mode, | ||
void * | data_pointer, | ||
int32_t | elements, | ||
... ) |
Appends data to an existing array variable in the SDDS dataset using variable arguments for dimensions.
This function appends additional data to a specified array within the current SDDS dataset. The elements
parameter specifies the number of new elements to append. The mode
parameter controls how the data is interpreted and stored. The dimensions of the array are provided as variable arguments, allowing for flexible handling of multi-dimensional arrays.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
array_name | The name of the array to append data to within the dataset. |
mode | Bitwise flags that determine how the array is set. Valid flags include:
|
data_pointer | Pointer to the data to be appended to the array. The data must match the type defined for the array. |
elements | The number of elements to append to the array. |
... | Variable arguments specifying the dimensions of the array. The number of dimensions should match the array definition. |
1
on successful appending of the array data. On failure, returns 0
and records an appropriate error message.Definition at line 1392 of file SDDS_dataprep.c.
int32_t SDDS_ClearPage | ( | SDDS_DATASET * | SDDS_dataset | ) |
Clears the current page in the SDDS dataset, resetting all data and flags.
This function resets the current data page in the specified SDDS dataset by reinitializing column flags and order. It frees any allocated string data and zeros out the data arrays, parameters, and arrays in the dataset.
SDDS_dataset | Pointer to the SDDS_DATASET structure whose current page will be cleared. |
Definition at line 188 of file SDDS_dataprep.c.
int32_t SDDS_LengthenTable | ( | SDDS_DATASET * | SDDS_dataset, |
int64_t | n_additional_rows ) |
Increases the number of allocated rows in the SDDS dataset's data table.
This function extends the allocated memory for the data table in the specified SDDS dataset by adding the specified number of additional rows. It reallocates memory for each column's data array and the row flags, initializing the newly allocated memory to zero.
SDDS_dataset | Pointer to the SDDS_DATASET structure whose table will be lengthened. |
n_additional_rows | The number of additional rows to allocate. If n_additional_rows is less than zero, it is treated as zero. |
Definition at line 297 of file SDDS_dataprep.c.
int32_t SDDS_SetArray | ( | SDDS_DATASET * | SDDS_dataset, |
char * | array_name, | ||
int32_t | mode, | ||
void * | data_pointer, | ||
int32_t * | dimension ) |
Sets the values of an array variable in the SDDS dataset using specified dimensions.
This function assigns data to a specified array within the current SDDS dataset. The dimensions of the array are provided as an array of integers, allowing for the assignment of multi-dimensional arrays. The mode
parameter controls how the data is interpreted and stored. This function handles both pointer arrays and contiguous data.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
array_name | The name of the array to set within the dataset. |
mode | Bitwise flags that determine how the array is set. Valid flags include:
|
data_pointer | Pointer to the data to be assigned to the array. The data must match the type defined for the array. |
dimension | Pointer to an array of integers specifying the dimensions of the array. The number of dimensions should match the array definition. |
1
on successful assignment of the array data. On failure, returns 0
and records an appropriate error message.Definition at line 1278 of file SDDS_dataprep.c.
int32_t SDDS_SetArrayVararg | ( | SDDS_DATASET * | SDDS_dataset, |
char * | array_name, | ||
int32_t | mode, | ||
void * | data_pointer, | ||
... ) |
Sets the values of an array variable in the SDDS dataset using variable arguments for dimensions.
This function assigns data to a specified array within the current SDDS dataset. The dimensions of the array are provided as variable arguments, allowing for flexible assignment of multi-dimensional arrays. The mode
parameter controls how the data is interpreted and stored. This function handles both pointer arrays and contiguous data.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
array_name | The name of the array to set within the dataset. |
mode | Bitwise flags that determine how the array is set. Valid flags include:
|
data_pointer | Pointer to the data to be assigned to the array. The data must match the type defined for the array. |
... | Variable arguments specifying the dimensions of the array. The number of dimensions should match the array definition. |
1
on successful assignment of the array data. On failure, returns 0
and records an appropriate error message.Definition at line 1157 of file SDDS_dataprep.c.
int32_t SDDS_SetColumn | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | mode, | ||
void * | data, | ||
int64_t | rows, | ||
... ) |
Sets the values for one data column in the current data table of an SDDS dataset.
This function assigns data to a specified column within the current data table of the given SDDS dataset. The column can be identified either by its index or by its name. The mode
parameter determines how the column is identified. The function ensures that the number of rows in the new column matches the existing data table.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | Bitwise flags that determine how the column is identified. Valid flags include:
|
data | Pointer to an array of data to be assigned to the column. The elements of the array must be of the same type as the column type. |
rows | The number of rows in the column. This should match the number of rows in the existing data table. |
... | Variable arguments specifying either the column index or column name, depending on the mode parameter:
|
1
on successful assignment of the column data. On failure, returns 0
and records an appropriate error message.SDDS_STRING
, it handles memory allocation and copying of strings appropriately.Definition at line 1536 of file SDDS_dataprep.c.
int32_t SDDS_SetColumnFromDoubles | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | mode, | ||
double * | data, | ||
int64_t | rows, | ||
... ) |
Sets the values for a single data column using double-precision floating-point numbers.
This function assigns data to a specified column within the current data table of the given SDDS dataset. The column can be identified either by its index or by its name, based on the provided mode
. The data provided must be in the form of double-precision floating-point numbers (double
). If the target column is of a different numeric type, the function will perform the necessary type casting. For string columns, the function converts the double values to strings with appropriate formatting.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | Bitwise flags that determine how the column is identified. Valid flags include:
|
Mode Requirements:
SDDS_SET_BY_INDEX
or SDDS_SET_BY_NAME
must be set.Syntax Based on Mode Combination:
SDDS_SET_BY_INDEX
: int32_t SDDS_SetColumnFromDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, double *data, int64_t rows, int32_t index)
SDDS_SET_BY_NAME
: int32_t SDDS_SetColumnFromDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, double *data, int64_t rows, char *name)
data | Pointer to an array of double-precision floating-point data to be assigned to the column. The array should contain at least rows elements. |
rows | The number of rows (elements) in the column to be set. Must not exceed the allocated memory for the dataset. |
... | Variable arguments specifying either the column index (int32_t ) or column name (char * ), depending on the mode . |
1
on successful assignment of the column data. On failure, returns 0
and records an appropriate error message using SDDS_SetError
.SDDS_STRING
, the function converts each double value to a string with a precision of up to 15 significant digits.SDDS_StartPage
before setting column values.Definition at line 1642 of file SDDS_dataprep.c.
int32_t SDDS_SetColumnFromFloats | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | mode, | ||
float * | data, | ||
int64_t | rows, | ||
... ) |
Sets the values for a single data column using single-precision floating-point numbers.
This function assigns data to a specified column within the current data table of the given SDDS dataset. The column can be identified either by its index or by its name, based on the provided mode
. The data provided must be in the form of single-precision floating-point numbers (float
). If the target column is of a different numeric type, the function will perform the necessary type casting. For string columns, the function converts the float values to strings with appropriate formatting.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | Bitwise flags that determine how the column is identified. Valid flags include:
|
Mode Requirements:
SDDS_SET_BY_INDEX
or SDDS_SET_BY_NAME
must be set.Syntax Based on Mode Combination:
SDDS_SET_BY_INDEX
: int32_t SDDS_SetColumnFromFloats(SDDS_DATASET *SDDS_dataset, int32_t mode, float *data, int64_t rows, int32_t index)
SDDS_SET_BY_NAME
: int32_t SDDS_SetColumnFromFloats(SDDS_DATASET *SDDS_dataset, int32_t mode, float *data, int64_t rows, char *name)
data | Pointer to an array of single-precision floating-point data to be assigned to the column. The array should contain at least rows elements. |
rows | The number of rows (elements) in the column to be set. Must not exceed the allocated memory for the dataset. |
... | Variable arguments specifying either the column index (int32_t ) or column name (char * ), depending on the mode . |
1
on successful assignment of the column data. On failure, returns 0
and records an appropriate error message using SDDS_SetError
.SDDS_STRING
, the function converts each float value to a string with a precision of up to 8 significant digits.SDDS_StartPage
before setting column values.Definition at line 1912 of file SDDS_dataprep.c.
int32_t SDDS_SetColumnFromLongDoubles | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | mode, | ||
long double * | data, | ||
int64_t | rows, | ||
... ) |
Sets the values for a single data column using long double-precision floating-point numbers.
This function assigns data to a specified column within the current data table of the given SDDS dataset. The column can be identified either by its index or by its name, based on the provided mode
. The data provided must be in the form of long double-precision floating-point numbers (long double
). If the target column is of a different numeric type, the function will perform the necessary type casting. For string columns, the function converts the long double values to strings with appropriate formatting.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | Bitwise flags that determine how the column is identified. Valid flags include:
|
Mode Requirements:
SDDS_SET_BY_INDEX
or SDDS_SET_BY_NAME
must be set.Syntax Based on Mode Combination:
SDDS_SET_BY_INDEX
: int32_t SDDS_SetColumnFromLongDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, long double *data, int64_t rows, int32_t index)
SDDS_SET_BY_NAME
: int32_t SDDS_SetColumnFromLongDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, long double *data, int64_t rows, char *name)
data | Pointer to an array of long double-precision floating-point data to be assigned to the column. The array should contain at least rows elements. |
rows | The number of rows (elements) in the column to be set. Must not exceed the allocated memory for the dataset. |
... | Variable arguments specifying either the column index (int32_t ) or column name (char * ), depending on the mode . |
1
on successful assignment of the column data. On failure, returns 0
and records an appropriate error message using SDDS_SetError
.SDDS_STRING
, the function converts each long double value to a string with a precision of up to 18 significant digits if supported, otherwise 15 digits.SDDS_StartPage
before setting column values.Definition at line 1775 of file SDDS_dataprep.c.
int32_t SDDS_SetColumnFromLongs | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | mode, | ||
int32_t * | data, | ||
int64_t | rows, | ||
... ) |
Sets the values for a single data column using long integer numbers.
This function assigns data to a specified column within the current data table of the given SDDS dataset. The column can be identified either by its index or by its name, based on the provided mode
. The data provided must be in the form of long integers (int32_t
). If the target column is of a different numeric type, the function will perform the necessary type casting. For string columns, the function converts the integer values to strings with appropriate formatting.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | Bitwise flags that determine how the column is identified. Valid flags include:
|
Mode Requirements:
SDDS_SET_BY_INDEX
or SDDS_SET_BY_NAME
must be set.Syntax Based on Mode Combination:
SDDS_SET_BY_INDEX
: int32_t SDDS_SetColumnFromLongs(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t *data, int64_t rows, int32_t index)
SDDS_SET_BY_NAME
: int32_t SDDS_SetColumnFromLongs(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t *data, int64_t rows, char *name)
data | Pointer to an array of long integer data to be assigned to the column. The array should contain at least rows elements. |
rows | The number of rows (elements) in the column to be set. Must not exceed the allocated memory for the dataset. |
... | Variable arguments specifying either the column index (int32_t ) or column name (char * ), depending on the mode . |
1
on successful assignment of the column data. On failure, returns 0
and records an appropriate error message using SDDS_SetError
.SDDS_STRING
, the function converts each long integer value to a string using the sprintf
function with the appropriate format specifier.SDDS_StartPage
before setting column values.Definition at line 2045 of file SDDS_dataprep.c.
int32_t SDDS_SetParameter | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | mode, | ||
... ) |
Sets the value of a single parameter in the current data table of an SDDS dataset.
This function assigns a value to a specified parameter in the current data table of the given SDDS dataset. It must be preceded by a call to SDDS_StartPage
to initialize the table. The parameter to be set can be identified either by its index or by its name. The value can be passed either by value or by reference, depending on the specified mode.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | A bitwise combination of the following constants:
|
Mode Requirements:
SDDS_SET_BY_INDEX
or SDDS_SET_BY_NAME
must be set.SDDS_PASS_BY_VALUE
or SDDS_PASS_BY_REFERENCE
must be set.Syntax Based on Mode Combination:
SDDS_SET_BY_INDEX
+ SDDS_PASS_BY_VALUE
: int32_t SDDS_SetParameter(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t index, value)
SDDS_SET_BY_INDEX
+ SDDS_PASS_BY_REFERENCE
: int32_t SDDS_SetParameter(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t index, void *data)
SDDS_SET_BY_NAME
+ SDDS_PASS_BY_VALUE
: int32_t SDDS_SetParameter(SDDS_DATASET *SDDS_dataset, int32_t mode, char *name, value)
SDDS_SET_BY_NAME
+ SDDS_PASS_BY_REFERENCE
: int32_t SDDS_SetParameter(SDDS_DATASET *SDDS_dataset, int32_t mode, char *name, void *data)
Note: For parameters of type SDDS_STRING
, passing by value means passing a char *
, whereas passing by reference means passing a char **
.
1
on successful assignment of the parameter value. On failure, returns 0
and records an appropriate error message.Definition at line 533 of file SDDS_dataprep.c.
int32_t SDDS_SetParameters | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | mode, | ||
... ) |
Sets the values of one or more parameters for the current data table in an SDDS dataset.
This function assigns values to parameters in the current data table of the specified SDDS dataset. It must be preceded by a call to SDDS_StartPage
to initialize the table. The function can be called multiple times to set parameters for different tables, but SDDS_WriteTable
should be used to write each table to disk.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | A bitwise combination of the following constants:
|
Exactly one of SDDS_SET_BY_INDEX
or SDDS_SET_BY_NAME
must be set to indicate how parameters are identified. Additionally, exactly one of SDDS_PASS_BY_VALUE
or SDDS_PASS_BY_REFERENCE
must be set to indicate how parameter values are provided.
The syntax for the four possible mode combinations is as follows:
SDDS_SET_BY_INDEX
+ SDDS_PASS_BY_VALUE
: int32_t SDDS_SetParameters(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t index1, value1, int32_t index2, value2, ..., -1)
SDDS_SET_BY_INDEX
+ SDDS_PASS_BY_REFERENCE
: int32_t SDDS_SetParameters(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t index1, void *data1, int32_t index2, void *data2, ..., -1)
SDDS_SET_BY_NAME
+ SDDS_PASS_BY_VALUE
: int32_t SDDS_SetParameters(SDDS_DATASET *SDDS_dataset, int32_t mode, char *name1, value1, char *name2, value2, ..., NULL)
SDDS_SET_BY_NAME
+ SDDS_PASS_BY_REFERENCE
: int32_t SDDS_SetParameters(SDDS_DATASET *SDDS_dataset, int32_t mode, char *name1, void *data1, char *name2, void *data2, ..., NULL)
Note: For parameters of type SDDS_STRING
, passing by value means passing a char *
, whereas passing by reference means passing a char **
.
Definition at line 369 of file SDDS_dataprep.c.
int32_t SDDS_SetParametersFromDoubles | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | mode, | ||
... ) |
Sets the values of one or more parameters in the current data table of an SDDS dataset using double-precision floating-point numbers.
This function assigns double-precision floating-point values to specified parameters in the current data table of the given SDDS dataset. It must be preceded by a call to SDDS_StartPage
to initialize the table. Parameters can be identified either by their index or by their name. The values can be passed either by value or by reference, depending on the specified mode.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | A bitwise combination of the following constants:
|
Mode Requirements:
SDDS_SET_BY_INDEX
or SDDS_SET_BY_NAME
must be set.SDDS_PASS_BY_VALUE
or SDDS_PASS_BY_REFERENCE
must be set.Syntax Based on Mode Combination:
SDDS_SET_BY_INDEX
+ SDDS_PASS_BY_VALUE
: int32_t SDDS_SetParametersFromDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t index, double value)
SDDS_SET_BY_INDEX
+ SDDS_PASS_BY_REFERENCE
: int32_t SDDS_SetParametersFromDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t index, double *data)
SDDS_SET_BY_NAME
+ SDDS_PASS_BY_VALUE
: int32_t SDDS_SetParametersFromDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, char *name, double value)
SDDS_SET_BY_NAME
+ SDDS_PASS_BY_REFERENCE
: int32_t SDDS_SetParametersFromDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, char *name, double *data)
Note: For parameters of type SDDS_STRING
, setting values using this function is not supported and will result in an error.
1
on successful assignment of all specified parameter values. On failure, returns 0
and records an appropriate error message.Definition at line 697 of file SDDS_dataprep.c.
int32_t SDDS_SetParametersFromLongDoubles | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | mode, | ||
... ) |
Sets the values of one or more parameters in the current data table of an SDDS dataset using long double-precision floating-point numbers.
This function assigns long double-precision floating-point values to specified parameters in the current data table of the given SDDS dataset. It must be preceded by a call to SDDS_StartPage
to initialize the table. Parameters can be identified either by their index or by their name. The values can be passed either by value or by reference, depending on the specified mode.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | A bitwise combination of the following constants:
|
Mode Requirements:
SDDS_SET_BY_INDEX
or SDDS_SET_BY_NAME
must be set.SDDS_PASS_BY_VALUE
or SDDS_PASS_BY_REFERENCE
must be set.Syntax Based on Mode Combination:
SDDS_SET_BY_INDEX
+ SDDS_PASS_BY_VALUE
: int32_t SDDS_SetParametersFromLongDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t index, long double value)
SDDS_SET_BY_INDEX
+ SDDS_PASS_BY_REFERENCE
: int32_t SDDS_SetParametersFromLongDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, int32_t index, long double *data)
SDDS_SET_BY_NAME
+ SDDS_PASS_BY_VALUE
: int32_t SDDS_SetParametersFromLongDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, char *name, long double value)
SDDS_SET_BY_NAME
+ SDDS_PASS_BY_REFERENCE
: int32_t SDDS_SetParametersFromLongDoubles(SDDS_DATASET *SDDS_dataset, int32_t mode, char *name, long double *data)
Note: For parameters of type SDDS_STRING
, setting values using this function is not supported and will result in an error.
1
on successful assignment of all specified parameter values. On failure, returns 0
and records an appropriate error message.Definition at line 838 of file SDDS_dataprep.c.
int32_t SDDS_SetRowValues | ( | SDDS_DATASET * | SDDS_dataset, |
int32_t | mode, | ||
int64_t | row, | ||
... ) |
Sets the values of one or more columns in a specified row of the current data table of an SDDS dataset.
This function assigns values to specified columns in a particular row of the current data table within the given SDDS dataset. It must be preceded by a call to SDDS_StartPage
to initialize the table. Columns can be identified either by their index or by their name. The values can be passed either by value or by reference, depending on the specified mode.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
mode | A bitwise combination of the following constants:
|
Mode Requirements:
SDDS_SET_BY_INDEX
or SDDS_SET_BY_NAME
must be set.SDDS_PASS_BY_VALUE
or SDDS_PASS_BY_REFERENCE
must be set.Syntax Based on Mode Combination:
SDDS_SET_BY_INDEX
+ SDDS_PASS_BY_VALUE
: int32_t SDDS_SetRowValues(SDDS_DATASET *SDDS_dataset, int32_t mode, int64_t row, int32_t index, value, ..., -1)
SDDS_SET_BY_INDEX
+ SDDS_PASS_BY_REFERENCE
: int32_t SDDS_SetRowValues(SDDS_DATASET *SDDS_dataset, int32_t mode, int64_t row, int32_t index, void *data, ..., -1)
SDDS_SET_BY_NAME
+ SDDS_PASS_BY_VALUE
: int32_t SDDS_SetRowValues(SDDS_DATASET *SDDS_dataset, int32_t mode, int64_t row, char *name, value, ..., NULL)
SDDS_SET_BY_NAME
+ SDDS_PASS_BY_REFERENCE
: int32_t SDDS_SetRowValues(SDDS_DATASET *SDDS_dataset, int32_t mode, int64_t row, char *name, void *data, ..., NULL)
Note: For columns of type SDDS_STRING
, passing by value means passing a char *
, whereas passing by reference means passing a char **
.
row | The row number in the data table where the column values will be set. Row numbering starts from 1. |
1
on successful assignment of all specified column values. On failure, returns 0
and records an appropriate error message.Definition at line 988 of file SDDS_dataprep.c.
int32_t SDDS_ShortenTable | ( | SDDS_DATASET * | SDDS_dataset, |
int64_t | rows ) |
Shortens the data table in the SDDS dataset to a specified number of rows.
This function reduces the number of allocated rows in the specified SDDS dataset to the given rows
count. It reallocates memory for each column's data array and the row flags, freeing existing data as necessary. All data is reset, and the number of rows is set to zero.
SDDS_dataset | Pointer to the SDDS_DATASET structure whose table will be shortened. |
rows | The new number of rows to allocate in the table. If rows is less than or equal to zero, it defaults to 1. |
Definition at line 238 of file SDDS_dataprep.c.
int32_t SDDS_StartPage | ( | SDDS_DATASET * | SDDS_dataset, |
int64_t | expected_n_rows ) |
Initializes an SDDS_DATASET structure in preparation for inserting data into a new table.
This function prepares the specified SDDS dataset for data insertion by initializing necessary data structures and allocating memory based on the expected number of rows. It must be preceded by a call to SDDS_InitializeOutput
. SDDS_StartPage
can be called multiple times to begin writing additional tables within the dataset. After initializing a page, SDDS_WriteTable
should be used to write the table to disk.
SDDS_dataset | Pointer to the SDDS_DATASET structure representing the data set. |
expected_n_rows | The expected number of rows in the data table. This value is used to preallocate memory for storing data values. If expected_n_rows is less than or equal to zero, it defaults to 1. |
Definition at line 64 of file SDDS_dataprep.c.