16#include <sdfio/sdfio_export.h>
134#define SDFIO_BAD_INT8 INT8_MIN
136#define SDFIO_BAD_INT16 INT16_MIN
138#define SDFIO_BAD_INT32 INT32_MIN
140#define SDFIO_BAD_FLOAT (-FLT_MAX)
142#define SDFIO_BAD_DOUBLE (-DBL_MAX)
146#define SDFIO_NO_TIME ((time_t)-1)
152#define SDFIO_AUTO_Z_SCALE 0.0
160#define SDFIO_NO_RESOLUTION (-1.0)
166#define SDFIO_MANUFACTURER_ID_MAX 10
187 void *(*allocate)(
void *
user,
size_t size);
200#define SDFIO_STREAM_ERROR ((size_t)-1)
222 size_t (*
read)(
void *
user,
void *data,
size_t size);
227 size_t (*
write)(
void *
user,
const void *data,
size_t size);
Memory management callbacks that replace malloc() and free(), for example with a pool or a bump alloc...
Definition types.h:180
void * user
Opaque pointer passed as the first argument of both callbacks.
Definition types.h:182
void(* release)(void *user, void *memory)
Releases a block returned by allocate.
Definition types.h:189
Calendar fields of a date and the time of day, with a resolution of one minute.
Definition types.h:251
int year
The year, 1 to 9999.
Definition types.h:253
int minute
The minute, 0 to 59.
Definition types.h:261
int hour
The hour, 0 to 23.
Definition types.h:259
int day
The day of the month, 1 to 31.
Definition types.h:257
int month
The month, 1 to 12.
Definition types.h:255
Callbacks that provide or accept the bytes of a file.
Definition types.h:213
size_t(* read)(void *user, void *data, size_t size)
Reads up to size bytes into data.
Definition types.h:222
size_t(* write)(void *user, const void *data, size_t size)
Writes size bytes from data.
Definition types.h:227
void * user
Opaque pointer passed as the first argument of every callback.
Definition types.h:215
Conversion of the dates of ISO-1.0 files between the local clock of the writer and UTC.
Definition types.h:311
time_t(* local_to_utc)(void *user, const sdfio_date *local)
Converts the clock reading local of a file to the UTC time.
Definition types.h:319
bool(* utc_to_local)(void *user, time_t utc, sdfio_date *local)
Converts the UTC time utc to the clock reading to store, and returns it in local.
Definition types.h:325
void * user
Opaque pointer passed as the first argument of both callbacks.
Definition types.h:313
sdfio_revision
Revision of the SDF format that a file follows.
Definition types.h:72
@ SDFIO_ISO_1_0
Revision ISO-1.0.
Definition types.h:74
@ SDFIO_ISO_2_0
Revision ISO-2.0.
Definition types.h:76
const char * sdfio_status_string(sdfio_status status)
Returns a constant description of a status.
void sdfio_stream_init(sdfio_stream *stream)
Initializes a stream: every field is null, so the stream has no callback.
sdfio_format
Format of a file.
Definition types.h:81
@ SDFIO_BINARY
Binary format.
Definition types.h:83
@ SDFIO_ASCII
ASCII format.
Definition types.h:85
sdfio_status
Result of a function call.
Definition types.h:31
@ SDFIO_ERR_IO
The stream failed, or a file could not be opened.
Definition types.h:45
@ SDFIO_ERR_UNSUPPORTED
The file needs a format that has not been added to the handle.
Definition types.h:51
@ SDFIO_ERR_FORMAT
The data is not an SDF file, is damaged or is truncated.
Definition types.h:47
@ SDFIO_OK
The call succeeded.
Definition types.h:33
@ SDFIO_ERR_STATE
The call is not valid in the current state of the handle, for example opening a reader a second time.
Definition types.h:43
@ SDFIO_ERR_RANGE
A number does not fit the type that has to store it.
Definition types.h:53
@ SDFIO_ERR_BAD_VALUE
A height equals the bad value of the data type, so it would be read as a point that is not measured.
Definition types.h:58
@ SDFIO_ERR_MEMORY
An allocation failed.
Definition types.h:60
@ SDFIO_ERR_ARGUMENT
An argument is invalid, for example a null pointer or a row count that exceeds the rows remaining.
Definition types.h:38
const sdfio_allocator * sdfio_default_allocator(void)
Returns the allocator that uses malloc() and free().
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
@ SDFIO_TYPE_DOUBLE
double: IEEE 754 binary64.
Definition types.h:122
@ SDFIO_TYPE_FLOAT
float: IEEE 754 binary32.
Definition types.h:114
@ SDFIO_TYPE_INT16
int16_t.
Definition types.h:118
@ SDFIO_TYPE_INT8
int8_t.
Definition types.h:116
@ SDFIO_TYPE_INT32
int32_t.
Definition types.h:120
const sdfio_time_zone * sdfio_system_time_zone(void)
Returns the time zone of the machine, as its C library knows it.
sdfio_status sdfio_date_to_time(const sdfio_date *date, time_t *utc)
Converts the fields of a date to a time, as if they were UTC.
sdfio_status sdfio_date_from_time(time_t utc, sdfio_date *date)
Converts a time to the fields of its UTC date.
void sdfio_time_zone_init(sdfio_time_zone *time_zone)
Initializes a time zone: every field is null, so it performs no conversion.