libpressio 0.93.0
Loading...
Searching...
No Matches
pressio_options.h
Go to the documentation of this file.
1#ifdef __cplusplus
2extern "C" {
3#endif
4
5
6#ifndef LIBPRESSIO_OPTIONS_H
10#define LIBPRESSIO_OPTIONS_H
11#include "pressio_dtype.h"
12#include "pressio_compressor.h"
13#include <stddef.h>
14#include <stdint.h>
15#include <stdbool.h>
16
21struct pressio_options;
22struct pressio_options_iter;
23struct pressio_option;
24struct pressio_data;
25
30
33
36};
37
44
49
54};
55
76};
77
78
100struct pressio_options* pressio_options_merge(struct pressio_options const* lhs, struct pressio_options const* rhs);
107
113enum pressio_options_key_status pressio_options_exists(struct pressio_options const* options, const char* key);
114
115
122struct pressio_option* pressio_options_get(struct pressio_options const* options, const char* key);
129void pressio_options_set(struct pressio_options* options, const char* key, struct pressio_option* option);
130
140enum pressio_options_key_status pressio_options_cast_set(struct pressio_options* options, const char* key, struct pressio_option const* option, enum pressio_conversion_safety safety);
141
150enum pressio_options_key_status pressio_options_as_set(struct pressio_options* options, const char* key, struct pressio_option* option);
151
159void pressio_options_set_type(struct pressio_options* options, const char* key, enum pressio_option_type type);
160
170void pressio_options_clear(struct pressio_options* options, const char* key);
171
176size_t pressio_options_size(struct pressio_options const* options);
177
182size_t pressio_options_num_set(struct pressio_options const* options);
183
184
185
187#define pressio_options_define_type_set(name, type) \
188 \
193 void pressio_options_set_##name(struct pressio_options* options, const char* key, type value);
194
196#define pressio_options_define_type_get(name, type) \
197 \
206 enum pressio_options_key_status pressio_options_get_##name(struct pressio_options \
207 const* options, const char* key, type * value);
208
210#define pressio_options_define_type_cast(name, type) \
211 \
219 enum pressio_options_key_status pressio_options_cast_##name(struct pressio_options \
220 const* options, const char* key, const enum pressio_conversion_safety safety, \
221 type * value);
224#define pressio_options_define_type_as(name, type) \
232 enum pressio_options_key_status pressio_options_as_##name(struct pressio_options \
233 const* options, const char* key, type * value);
240#define pressio_options_define_type(name, type) \
241 pressio_options_define_type_set(name, type) \
242 pressio_options_define_type_get(name, type) \
243 pressio_options_define_type_cast(name, type) \
244 pressio_options_define_type_as(name, type)
245
246pressio_options_define_type(uinteger8, uint8_t)
247pressio_options_define_type(integer8, int8_t)
248pressio_options_define_type(uinteger16, uint16_t)
249pressio_options_define_type(integer16, int16_t)
250pressio_options_define_type(uinteger64, uint64_t)
251pressio_options_define_type(integer64, int64_t)
252pressio_options_define_type(uinteger, uint32_t)
254pressio_options_define_type(float, float)
255pressio_options_define_type(double, double)
257pressio_options_define_type(userptr, void*)
261
262//special case string -- prefer const on get/set
263pressio_options_define_type_get(string, const char*)
264pressio_options_define_type_set(string, const char*)
279 const char* key,
280 void* value,
281 void* metadata,
282 void(*deleter)(void*, void*),
283 void(*copy)(void**, void**, const void*, const void*));
284
285//special case strings -- to also pass/get length information
292void pressio_options_set_strings(struct pressio_options* options, const char* key, size_t size, const char* const* values);
303enum pressio_options_key_status pressio_options_get_strings(struct pressio_options const* options, const char* key, size_t* size, const char*** values); \
314 const* options, const char* key, const enum pressio_conversion_safety safety, \
315 size_t* size, char*** values); \
325 const* options, const char* key, size_t* size, char*** values);
326
341char* pressio_options_to_string(struct pressio_options const* options);
342
343//undefine the type macro so it is not used by implementations
344#undef pressio_options_define_type
345#undef pressio_options_define_type_set
346#undef pressio_options_define_type_get
347#undef pressio_options_define_type_as
348#undef pressio_options_define_type_cast
349
350#endif
351
352#ifdef __cplusplus
353}
354#endif
Compress, decompress, and configure pressio and lossless compressors.
pressio_thread_safety
Definition: pressio_compressor.h:268
Information on types used by libpressio.
pressio_dtype
Definition: pressio_dtype.h:16
enum pressio_options_key_status pressio_options_cast_strings(struct pressio_options const *options, const char *key, const enum pressio_conversion_safety safety, size_t *size, char ***values)
enum pressio_options_key_status pressio_options_as_strings(struct pressio_options const *options, const char *key, size_t *size, char ***values)
enum pressio_options_key_status pressio_options_cast_set(struct pressio_options *options, const char *key, struct pressio_option const *option, enum pressio_conversion_safety safety)
struct pressio_options * pressio_options_copy(struct pressio_options const *options)
enum pressio_options_key_status pressio_options_exists(struct pressio_options const *options, const char *key)
#define pressio_options_define_type_as(name, type)
Definition: pressio_options.h:205
size_t pressio_options_size(struct pressio_options const *options)
struct pressio_option * pressio_options_get(struct pressio_options const *options, const char *key)
char * pressio_options_to_string(struct pressio_options const *options)
#define pressio_options_define_type(name, type)
Definition: pressio_options.h:215
size_t pressio_options_num_set(struct pressio_options const *options)
void pressio_options_free(struct pressio_options *options)
pressio_option_type
Definition: pressio_options.h:57
@ pressio_option_uint8_type
Definition: pressio_options.h:67
@ pressio_option_charptr_array_type
Definition: pressio_options.h:65
@ pressio_option_charptr_type
Definition: pressio_options.h:62
@ pressio_option_data_type
Definition: pressio_options.h:66
@ pressio_option_int64_type
Definition: pressio_options.h:72
@ pressio_option_uint64_type
Definition: pressio_options.h:71
@ pressio_option_unset_type
Definition: pressio_options.h:64
@ pressio_option_float_type
Definition: pressio_options.h:60
@ pressio_option_bool_type
Definition: pressio_options.h:73
@ pressio_option_double_type
Definition: pressio_options.h:61
@ pressio_option_uint32_type
Definition: pressio_options.h:58
@ pressio_option_int32_type
Definition: pressio_options.h:59
@ pressio_option_int16_type
Definition: pressio_options.h:70
@ pressio_option_userptr_type
Definition: pressio_options.h:63
@ pressio_option_int8_type
Definition: pressio_options.h:68
@ pressio_option_uint16_type
Definition: pressio_options.h:69
@ pressio_option_threadsafety_type
Definition: pressio_options.h:75
@ pressio_option_dtype_type
Definition: pressio_options.h:74
#define pressio_options_define_type_cast(name, type)
Definition: pressio_options.h:198
void pressio_options_clear(struct pressio_options *options, const char *key)
struct pressio_options * pressio_options_new()
enum pressio_options_key_status pressio_options_get_strings(struct pressio_options const *options, const char *key, size_t *size, const char ***values)
enum pressio_options_key_status pressio_options_as_set(struct pressio_options *options, const char *key, struct pressio_option *option)
pressio_conversion_safety
Definition: pressio_options.h:39
@ pressio_conversion_implicit
Definition: pressio_options.h:43
@ pressio_conversion_special
Definition: pressio_options.h:53
@ pressio_conversion_explicit
Definition: pressio_options.h:48
void pressio_options_set_userptr_managed(struct pressio_options *options, const char *key, void *value, void *metadata, void(*deleter)(void *, void *), void(*copy)(void **, void **, const void *, const void *))
#define pressio_options_define_type_get(name, type)
Definition: pressio_options.h:192
void pressio_options_set_strings(struct pressio_options *options, const char *key, size_t size, const char *const *values)
pressio_options_key_status
Definition: pressio_options.h:27
@ pressio_options_key_does_not_exist
Definition: pressio_options.h:35
@ pressio_options_key_set
Definition: pressio_options.h:29
@ pressio_options_key_exists
Definition: pressio_options.h:32
void pressio_options_set_type(struct pressio_options *options, const char *key, enum pressio_option_type type)
#define pressio_options_define_type_set(name, type)
Definition: pressio_options.h:187
struct pressio_options * pressio_options_merge(struct pressio_options const *lhs, struct pressio_options const *rhs)
void pressio_options_set(struct pressio_options *options, const char *key, struct pressio_option *option)
Definition: data.h:52
Definition: options.h:80
enum pressio_option_type type() const
Definition: options.h:352