Clingo
Loading...
Searching...
No Matches
config.h
1#ifndef CLINGO_CONFIG_H
2#define CLINGO_CONFIG_H
3
4#include <clingo/core.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10typedef struct clingo_control clingo_control_t;
11
24
35
44
46typedef struct clingo_config clingo_config_t;
47
62typedef struct clingo_config_entry {
70 bool (*get)(size_t const *index, void *data, clingo_string_t *value, bool *has_value);
71
79 bool (*set)(size_t const *index, char const *value, size_t size, void *data);
80
87 bool (*size)(void *data, size_t *size, bool *has_size);
88
92 void (*free)(void *data);
94
110CLINGO_VISIBILITY_DEFAULT bool clingo_config_add(clingo_config_t *config, clingo_id_t parent, char const *name,
111 size_t name_size, char const *description, size_t description_size,
112 clingo_config_entry_t const *entry, void *data);
113
119CLINGO_VISIBILITY_DEFAULT bool clingo_config_root(clingo_config_t const *config, clingo_id_t *key);
120
129CLINGO_VISIBILITY_DEFAULT bool clingo_config_type(clingo_config_t const *config, clingo_id_t key,
137CLINGO_VISIBILITY_DEFAULT bool clingo_config_description(clingo_config_t const *config, clingo_id_t key,
138 clingo_string_t *description);
139
142
150CLINGO_VISIBILITY_DEFAULT bool clingo_config_array_size(clingo_config_t const *config, clingo_id_t key, size_t *size);
161CLINGO_VISIBILITY_DEFAULT bool clingo_config_array_at(clingo_config_t const *config, clingo_id_t key, size_t offset,
162 clingo_id_t *subkey);
164
167
175CLINGO_VISIBILITY_DEFAULT bool clingo_config_map_size(clingo_config_t const *config, clingo_id_t key, size_t *size);
184CLINGO_VISIBILITY_DEFAULT bool clingo_config_map_subkey_name(clingo_config_t const *config, clingo_id_t key,
185 size_t offset, clingo_string_t *name);
197CLINGO_VISIBILITY_DEFAULT bool clingo_config_map_at(clingo_config_t const *config, clingo_id_t key, char const *name,
198 size_t size, clingo_id_t *subkey, bool *has_subkey);
200
203
212CLINGO_VISIBILITY_DEFAULT bool clingo_config_value_get(clingo_config_t const *config, clingo_id_t key,
213 clingo_string_t *value, bool *has_value);
222CLINGO_VISIBILITY_DEFAULT bool clingo_config_value_set(clingo_config_t *config, clingo_id_t key, char const *value,
223 size_t size);
224
231CLINGO_VISIBILITY_DEFAULT bool clingo_config_to_string(clingo_config_t const *config, clingo_id_t key,
232 clingo_string_builder_t *builder);
233
235
241CLINGO_VISIBILITY_DEFAULT bool clingo_control_config(clingo_control_t *control, clingo_config_t **config);
242
244
245#ifdef __cplusplus
246}
247#endif
248
249#endif
struct clingo_config clingo_config_t
Handle for to the solver configuration.
Definition config.h:46
CLINGO_VISIBILITY_DEFAULT bool clingo_config_array_at(clingo_config_t const *config, clingo_id_t key, size_t offset, clingo_id_t *subkey)
Get the subkey at the given offset of an array entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_config_value_get(clingo_config_t const *config, clingo_id_t key, clingo_string_t *value, bool *has_value)
Get the string value of the given entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_config_root(clingo_config_t const *config, clingo_id_t *key)
Get the root key of the configuration.
CLINGO_VISIBILITY_DEFAULT bool clingo_config_type(clingo_config_t const *config, clingo_id_t key, clingo_config_type_bitset_t *type)
Get the type of a key.
unsigned clingo_config_type_bitset_t
Bitset for values of type clingo_config_type_e.
Definition config.h:43
CLINGO_VISIBILITY_DEFAULT bool clingo_config_map_subkey_name(clingo_config_t const *config, clingo_id_t key, size_t offset, clingo_string_t *name)
Get the name associated with the offset-th subkey.
clingo_config_type_e
Enumeration for entries of the configuration.
Definition config.h:37
CLINGO_VISIBILITY_DEFAULT bool clingo_control_config(clingo_control_t *control, clingo_config_t **config)
Get the configuration object.
CLINGO_VISIBILITY_DEFAULT bool clingo_config_map_size(clingo_config_t const *config, clingo_id_t key, size_t *size)
Get the number of subkeys of a map entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_config_add(clingo_config_t *config, clingo_id_t parent, char const *name, size_t name_size, char const *description, size_t description_size, clingo_config_entry_t const *entry, void *data)
Add a custom configuration entry under a parent key.
CLINGO_VISIBILITY_DEFAULT bool clingo_config_description(clingo_config_t const *config, clingo_id_t key, clingo_string_t *description)
Get the description of an entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_config_value_set(clingo_config_t *config, clingo_id_t key, char const *value, size_t size)
Set the value of an entry.
struct clingo_config_entry clingo_config_entry_t
Callback interface for custom configuration entries.
CLINGO_VISIBILITY_DEFAULT bool clingo_config_map_at(clingo_config_t const *config, clingo_id_t key, char const *name, size_t size, clingo_id_t *subkey, bool *has_subkey)
Lookup a subkey under the given name.
CLINGO_VISIBILITY_DEFAULT bool clingo_config_to_string(clingo_config_t const *config, clingo_id_t key, clingo_string_builder_t *builder)
Get the string representation of the given theory element.
CLINGO_VISIBILITY_DEFAULT bool clingo_config_array_size(clingo_config_t const *config, clingo_id_t key, size_t *size)
Get the size of an array entry.
@ clingo_config_type_array
the entry is an array
Definition config.h:39
@ clingo_config_type_map
the entry is a map
Definition config.h:40
@ clingo_config_type_value
the entry is a (string) value
Definition config.h:38
struct clingo_string_builder clingo_string_builder_t
A builder for strings.
Definition core.h:252
uint32_t clingo_id_t
Unsigned integer type used in various places.
Definition core.h:77
Callback interface for custom configuration entries.
Definition config.h:62
bool(* get)(size_t const *index, void *data, clingo_string_t *value, bool *has_value)
Get the value of this entry as a string.
Definition config.h:70
void(* free)(void *data)
Free the user data associated with this entry.
Definition config.h:92
bool(* size)(void *data, size_t *size, bool *has_size)
Get the size of this entry if it is an array.
Definition config.h:87
bool(* set)(size_t const *index, char const *value, size_t size, void *data)
Set the value of this entry from a string.
Definition config.h:79
Struct to capture strings that are not null-terminated.
Definition core.h:86