Since the user may wish to read or write SDDS data sets without using the SDDS function library, a more detailed description of the structure of the data pages is provided.
The first SDDS data page begins immediately following the data command and the optional additional header lines, the number of which is specified by the additional_header_lines parameter of the data command.
All binary data is stored in the machine representation, except for strings. Strings are stored in a variable-record format that consists of a long signed integers followed by a sequence of characters. The number of characters is equal to the value in the signed integer. Note that the SDDS library has features that allow recognition and interpretation of big- and little-endian data representations, which are not described here.
The first element in the data page is the row count, which is a long signed integer. This exists even in files that do not contain any columns.
If parameters have been defined, then their values follow in the order that the parameter definitions appear in the header. Note that if a parameter is define as “fixed-value” in the parameter definition, then its value will not appear.
If arrays have been defined, then they follow next, in the order that the array definitions appear in the header. For each array, a series of long signed integers is first given, one for each dimension of the array. For example, a two-dimensional array would have two integers, specifying the size of the array in the first and second dimension. If the two integers are, say, n and m in that order, then the declaration of the array in a C program would be, for example, a[n][m]. Elements of the array are put in the file in C storage order, which means that the outermost index varies fastest as the data is accessed in storage order.
If tabular-data columns have been defined, then the table data follows. Data is stored as rows, so that data for columns is intermixed by default. The order of the columns is the same as the order of the column definitions in the header. If however column_major_order is non-zero, then the data for each column is stored in a single stream and not intermixed.