libsdfio 1.0.0
Reader and writer for ISO 25178-71 SDF surface data files in C
Loading...
Searching...
No Matches
header.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Thomas Ascher <thomas.ascher@gmx.at>
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
11
12#ifndef SDFIO_HEADER_H
13#define SDFIO_HEADER_H
14
15#include <sdfio/sdfio_export.h>
16#include <sdfio/types.h>
17
18#include <stdbool.h>
19#include <stdint.h>
20#include <time.h>
21
22#ifdef __cplusplus
23extern "C"
24{
25#endif
26
43
65 sdfio_header **header);
66
77 const sdfio_header *src);
78
85SDFIO_API void sdfio_header_free(sdfio_header *header);
86
93
103 sdfio_revision revision);
104
111
121 sdfio_format format);
122
129
139 sdfio_data_type data_type);
140
146SDFIO_API uint32_t sdfio_header_columns(const sdfio_header *header);
147
157 uint32_t columns);
158
164SDFIO_API uint32_t sdfio_header_rows(const sdfio_header *header);
165
175 uint32_t rows);
176
182SDFIO_API double sdfio_header_x_scale(const sdfio_header *header);
183
192 double x_scale);
193
200SDFIO_API double sdfio_header_y_scale(const sdfio_header *header);
201
211 double y_scale);
212
219SDFIO_API double sdfio_header_z_scale(const sdfio_header *header);
220
233 double z_scale);
234
242SDFIO_API double sdfio_header_z_resolution(const sdfio_header *header);
243
253 double z_resolution);
254
267SDFIO_API time_t sdfio_header_created(const sdfio_header *header);
268
280 time_t created);
281
288SDFIO_API time_t sdfio_header_modified(const sdfio_header *header);
289
301 time_t modified);
302
313 time_t date);
314
323SDFIO_API const char *sdfio_header_manufacturer(const sdfio_header *header);
324
336 const char *manufacturer);
337
344SDFIO_API bool sdfio_revision_allows(sdfio_revision revision,
345 sdfio_data_type type);
346
347#ifdef __cplusplus
348}
349#endif
350
351#endif /* SDFIO_HEADER_H */
struct sdfio_header sdfio_header
Header of a file, with the field names of the standard.
Definition header.h:42
sdfio_status sdfio_header_set_z_scale(sdfio_header *header, double z_scale)
Sets the z-scale factor.
sdfio_status sdfio_header_set_manufacturer(sdfio_header *header, const char *manufacturer)
Sets the manufacturer's identifier.
double sdfio_header_z_resolution(const sdfio_header *header)
Returns the z-resolution: the quantization step of the instrument in metres, or SDFIO_NO_RESOLUTION.
sdfio_status sdfio_header_set_z_resolution(sdfio_header *header, double z_resolution)
Sets the z-resolution.
sdfio_status sdfio_header_set_revision(sdfio_header *header, sdfio_revision revision)
Sets the revision of the format.
sdfio_data_type sdfio_header_data_type(const sdfio_header *header)
Returns the data type of the coded values in the data area.
void sdfio_header_free(sdfio_header *header)
Releases a header that sdfio_header_create() created.
sdfio_format sdfio_header_format(const sdfio_header *header)
Returns the format of the file.
sdfio_revision sdfio_header_revision(const sdfio_header *header)
Returns the revision of the format.
sdfio_status sdfio_header_set_x_scale(sdfio_header *header, double x_scale)
Sets the sampling interval along x in metres.
time_t sdfio_header_modified(const sdfio_header *header)
Returns the last modification date and time.
time_t sdfio_header_created(const sdfio_header *header)
Returns the original creation date and time as a time_t, which is read as integer seconds since 1970-...
bool sdfio_revision_allows(sdfio_revision revision, sdfio_data_type type)
Returns true if a revision permits a data type.
uint32_t sdfio_header_rows(const sdfio_header *header)
Returns the number of rows N of the data matrix: 1 for a profile.
sdfio_status sdfio_header_set_modified(sdfio_header *header, time_t modified)
Sets the last modification date and time.
sdfio_status sdfio_header_create(const sdfio_allocator *allocator, sdfio_header **header)
Creates a header with default values.
sdfio_status sdfio_header_copy(sdfio_header *dst, const sdfio_header *src)
Copies every field of a header into another header, which keeps its allocator.
sdfio_status sdfio_header_set_created(sdfio_header *header, time_t created)
Sets the original creation date and time, rounded down to the minute.
sdfio_status sdfio_header_set_rows(sdfio_header *header, uint32_t rows)
Sets the number of rows N of the data matrix.
uint32_t sdfio_header_columns(const sdfio_header *header)
Returns the number of columns M of the data matrix: the points along x.
double sdfio_header_x_scale(const sdfio_header *header)
Returns the sampling interval along x in metres (X-scale factor).
sdfio_status sdfio_header_set_format(sdfio_header *header, sdfio_format format)
Sets the format of the file.
const char * sdfio_header_manufacturer(const sdfio_header *header)
Returns the manufacturer's identifier: at most SDFIO_MANUFACTURER_ID_MAX bytes, terminated by a null ...
sdfio_status sdfio_header_set_columns(sdfio_header *header, uint32_t columns)
Sets the number of columns M of the data matrix.
sdfio_status sdfio_header_set_dates(sdfio_header *header, time_t date)
Sets the creation date and the modification date to the same time, rounded down to the minute.
sdfio_status sdfio_header_set_y_scale(sdfio_header *header, double y_scale)
Sets the sampling interval along y in metres.
sdfio_status sdfio_header_set_data_type(sdfio_header *header, sdfio_data_type data_type)
Sets the data type of the coded values in the data area.
double sdfio_header_z_scale(const sdfio_header *header)
Returns the z-scale factor: the height in metres that a coded value of 1 in the data area stands for.
double sdfio_header_y_scale(const sdfio_header *header)
Returns the sampling interval along y in metres (Y-scale factor).
Memory management callbacks that replace malloc() and free(), for example with a pool or a bump alloc...
Definition types.h:180
Status codes, enumerations, constants, and the structures for allocator, stream and time zone.
sdfio_revision
Revision of the SDF format that a file follows.
Definition types.h:72
sdfio_format
Format of a file.
Definition types.h:81
sdfio_status
Result of a function call.
Definition types.h:31
sdfio_data_type
Type of the coded values of the data area of a file, and of the elements of a buffer of heights.
Definition types.h:112