Clingo C API
C API for clingo providing high level functions to control grounding and solving.
|
Configuration of search and enumeration algorithms.
Entries in a configuration are organized hierarchically. Subentries are either accessed by name for map entries or by offset for array entries. Value entries have a string value that can be inspected or modified.
For an example, see configuration.c.
Typedefs | |
typedef unsigned | clingo_configuration_type_bitset_t |
Bitset for values of type clingo_configuration_type. | |
typedef struct clingo_configuration | clingo_configuration_t |
Handle for to the solver configuration. | |
Enumerations | |
enum | clingo_configuration_type_e { clingo_configuration_type_value = 1, clingo_configuration_type_array = 2, clingo_configuration_type_map = 4 } |
Enumeration for entries of the configuration. More... | |
Functions | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_root (clingo_configuration_t const *configuration, clingo_id_t *key) |
Get the root key of the configuration. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_type (clingo_configuration_t const *configuration, clingo_id_t key, clingo_configuration_type_bitset_t *type) |
Get the type of a key. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_description (clingo_configuration_t const *configuration, clingo_id_t key, char const **description) |
Get the description of an entry. More... | |
Functions to access arrays | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_array_size (clingo_configuration_t const *configuration, clingo_id_t key, size_t *size) |
Get the size of an array entry. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_array_at (clingo_configuration_t const *configuration, clingo_id_t key, size_t offset, clingo_id_t *subkey) |
Get the subkey at the given offset of an array entry. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_statistics_array_size (clingo_statistics_t const *statistics, uint64_t key, size_t *size) |
Get the size of an array entry. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_statistics_array_at (clingo_statistics_t const *statistics, uint64_t key, size_t offset, uint64_t *subkey) |
Get the subkey at the given offset of an array entry. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_statistics_array_push (clingo_statistics_t *statistics, uint64_t key, clingo_statistics_type_t type, uint64_t *subkey) |
Create the subkey at the end of an array entry. More... | |
Functions to access maps | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_map_size (clingo_configuration_t const *configuration, clingo_id_t key, size_t *size) |
Get the number of subkeys of a map entry. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_map_has_subkey (clingo_configuration_t const *configuration, clingo_id_t key, char const *name, bool *result) |
Query whether the map has a key. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_map_subkey_name (clingo_configuration_t const *configuration, clingo_id_t key, size_t offset, char const **name) |
Get the name associated with the offset-th subkey. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_map_at (clingo_configuration_t const *configuration, clingo_id_t key, char const *name, clingo_id_t *subkey) |
Lookup a subkey under the given name. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_statistics_map_size (clingo_statistics_t const *statistics, uint64_t key, size_t *size) |
Get the number of subkeys of a map entry. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_statistics_map_has_subkey (clingo_statistics_t const *statistics, uint64_t key, char const *name, bool *result) |
Test if the given map contains a specific subkey. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_statistics_map_subkey_name (clingo_statistics_t const *statistics, uint64_t key, size_t offset, char const **name) |
Get the name associated with the offset-th subkey. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_statistics_map_at (clingo_statistics_t const *statistics, uint64_t key, char const *name, uint64_t *subkey) |
Lookup a subkey under the given name. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_statistics_map_add_subkey (clingo_statistics_t *statistics, uint64_t key, char const *name, clingo_statistics_type_t type, uint64_t *subkey) |
Add a subkey with the given name. More... | |
Functions to access values | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_value_is_assigned (clingo_configuration_t const *configuration, clingo_id_t key, bool *assigned) |
Check whether a entry has a value. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_value_get_size (clingo_configuration_t const *configuration, clingo_id_t key, size_t *size) |
Get the size of the string value of the given entry. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_value_get (clingo_configuration_t const *configuration, clingo_id_t key, char *value, size_t size) |
Get the string value of the given entry. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_configuration_value_set (clingo_configuration_t *configuration, clingo_id_t key, char const *value) |
Set the value of an entry. More... | |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_array_at | ( | clingo_configuration_t const * | configuration, |
clingo_id_t | key, | ||
size_t | offset, | ||
clingo_id_t * | subkey | ||
) |
Get the subkey at the given offset of an array entry.
[in] | configuration | the target configuration |
[in] | key | the key |
[in] | offset | the offset in the array |
[out] | subkey | the resulting subkey |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_array_size | ( | clingo_configuration_t const * | configuration, |
clingo_id_t | key, | ||
size_t * | size | ||
) |
Get the size of an array entry.
[in] | configuration | the target configuration |
[in] | key | the key |
[out] | size | the resulting size |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_description | ( | clingo_configuration_t const * | configuration, |
clingo_id_t | key, | ||
char const ** | description | ||
) |
Get the description of an entry.
[in] | configuration | the target configuration |
[in] | key | the key |
[out] | description | the description |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_at | ( | clingo_configuration_t const * | configuration, |
clingo_id_t | key, | ||
char const * | name, | ||
clingo_id_t * | subkey | ||
) |
Lookup a subkey under the given name.
[in] | configuration | the target configuration |
[in] | key | the key |
[in] | name | the name to lookup the subkey |
[out] | subkey | the resulting subkey |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_has_subkey | ( | clingo_configuration_t const * | configuration, |
clingo_id_t | key, | ||
char const * | name, | ||
bool * | result | ||
) |
Query whether the map has a key.
[in] | configuration | the target configuration |
[in] | key | the key |
[in] | name | the name to lookup the subkey |
[out] | result | whether the key is in the map |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_size | ( | clingo_configuration_t const * | configuration, |
clingo_id_t | key, | ||
size_t * | size | ||
) |
Get the number of subkeys of a map entry.
[in] | configuration | the target configuration |
[in] | key | the key |
[out] | size | the resulting number |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_subkey_name | ( | clingo_configuration_t const * | configuration, |
clingo_id_t | key, | ||
size_t | offset, | ||
char const ** | name | ||
) |
Get the name associated with the offset-th subkey.
[in] | configuration | the target configuration |
[in] | key | the key |
[in] | offset | the offset of the name |
[out] | name | the resulting name |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_root | ( | clingo_configuration_t const * | configuration, |
clingo_id_t * | key | ||
) |
Get the root key of the configuration.
[in] | configuration | the target configuration |
[out] | key | the root key |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_type | ( | clingo_configuration_t const * | configuration, |
clingo_id_t | key, | ||
clingo_configuration_type_bitset_t * | type | ||
) |
Get the type of a key.
[in] | configuration | the target configuration |
[in] | key | the key |
[out] | type | the resulting type |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_get | ( | clingo_configuration_t const * | configuration, |
clingo_id_t | key, | ||
char * | value, | ||
size_t | size | ||
) |
Get the string value of the given entry.
[in] | configuration | the target configuration |
[in] | key | the key |
[out] | value | the resulting string value |
[in] | size | the size of the given char array |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_get_size | ( | clingo_configuration_t const * | configuration, |
clingo_id_t | key, | ||
size_t * | size | ||
) |
Get the size of the string value of the given entry.
[in] | configuration | the target configuration |
[in] | key | the key |
[out] | size | the resulting size |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_is_assigned | ( | clingo_configuration_t const * | configuration, |
clingo_id_t | key, | ||
bool * | assigned | ||
) |
Check whether a entry has a value.
[in] | configuration | the target configuration |
[in] | key | the key |
[out] | assigned | whether the entry has a value |
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_set | ( | clingo_configuration_t * | configuration, |
clingo_id_t | key, | ||
char const * | value | ||
) |
Set the value of an entry.
[in] | configuration | the target configuration |
[in] | key | the key |
[in] | value | the value to set |
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_at | ( | clingo_statistics_t const * | statistics, |
uint64_t | key, | ||
size_t | offset, | ||
uint64_t * | subkey | ||
) |
Get the subkey at the given offset of an array entry.
[in] | statistics | the target statistics |
[in] | key | the key |
[in] | offset | the offset in the array |
[out] | subkey | the resulting subkey |
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_push | ( | clingo_statistics_t * | statistics, |
uint64_t | key, | ||
clingo_statistics_type_t | type, | ||
uint64_t * | subkey | ||
) |
Create the subkey at the end of an array entry.
[in] | statistics | the target statistics |
[in] | key | the key |
[in] | type | the type of the new subkey |
[out] | subkey | the resulting subkey |
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_size | ( | clingo_statistics_t const * | statistics, |
uint64_t | key, | ||
size_t * | size | ||
) |
Get the size of an array entry.
[in] | statistics | the target statistics |
[in] | key | the key |
[out] | size | the resulting size |
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_add_subkey | ( | clingo_statistics_t * | statistics, |
uint64_t | key, | ||
char const * | name, | ||
clingo_statistics_type_t | type, | ||
uint64_t * | subkey | ||
) |
Add a subkey with the given name.
[in] | statistics | the target statistics |
[in] | key | the key |
[in] | name | the name of the new subkey |
[in] | type | the type of the new subkey |
[out] | subkey | the index of the resulting subkey |
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_at | ( | clingo_statistics_t const * | statistics, |
uint64_t | key, | ||
char const * | name, | ||
uint64_t * | subkey | ||
) |
Lookup a subkey under the given name.
[in] | statistics | the target statistics |
[in] | key | the key |
[in] | name | the name to lookup the subkey |
[out] | subkey | the resulting subkey |
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_has_subkey | ( | clingo_statistics_t const * | statistics, |
uint64_t | key, | ||
char const * | name, | ||
bool * | result | ||
) |
Test if the given map contains a specific subkey.
[in] | statistics | the target statistics |
[in] | key | the key |
[in] | name | name of the subkey |
[out] | result | true if the map has a subkey with the given name |
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_size | ( | clingo_statistics_t const * | statistics, |
uint64_t | key, | ||
size_t * | size | ||
) |
Get the number of subkeys of a map entry.
[in] | statistics | the target statistics |
[in] | key | the key |
[out] | size | the resulting number |
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_subkey_name | ( | clingo_statistics_t const * | statistics, |
uint64_t | key, | ||
size_t | offset, | ||
char const ** | name | ||
) |
Get the name associated with the offset-th subkey.
[in] | statistics | the target statistics |
[in] | key | the key |
[in] | offset | the offset of the name |
[out] | name | the resulting name |