Clingo
Loading...
Searching...
No Matches
ground.h
1#ifndef CLINGO_GROUND_H
2#define CLINGO_GROUND_H
3
4#include <clingo/core.h>
5#include <clingo/model.h>
6#include <clingo/stats.h>
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
22
32
44typedef struct clingo_part {
45 char const *name;
46 size_t name_size;
48 size_t params_size;
50
59typedef unsigned clingo_ground_result_t;
60
71 bool (*callable)(char const *name, size_t name_size, size_t arguments_size, void *data, bool *result);
116 bool (*call)(clingo_lib_t *lib, clingo_location_t const *location, char const *name, size_t name_size,
117 clingo_symbol_t const *arguments, size_t arguments_size, void *data,
118 clingo_symbol_callback_t symbol_callback, void *symbol_callback_data);
126 void (*finish)(clingo_ground_result_t result, void *data);
130 void (*free)(void *data);
132
136typedef struct clingo_ground_handle clingo_ground_handle_t;
137
146CLINGO_VISIBILITY_DEFAULT bool clingo_ground_handle_get(clingo_ground_handle_t *handle, clingo_ground_result_t *result);
157CLINGO_VISIBILITY_DEFAULT bool clingo_ground_handle_wait(clingo_ground_handle_t *handle, double timeout, bool *result);
162CLINGO_VISIBILITY_DEFAULT bool clingo_ground_handle_cancel(clingo_ground_handle_t *handle);
169CLINGO_VISIBILITY_DEFAULT void clingo_ground_handle_close(clingo_ground_handle_t *handle);
170
172
173#ifdef __cplusplus
174}
175#endif
176
177#endif
struct clingo_lib clingo_lib_t
A library object storing global information.
Definition core.h:171
struct clingo_location clingo_location_t
Represents a source code location marking its beginning and end.
Definition core.h:354
struct clingo_ground_handle clingo_ground_handle_t
Handle to an asynchronous ground call.
Definition ground.h:136
CLINGO_VISIBILITY_DEFAULT bool clingo_ground_handle_get(clingo_ground_handle_t *handle, clingo_ground_result_t *result)
Get the ground result.
struct clingo_ground_event_handler clingo_ground_event_handler_t
The ground event handler interface.
struct clingo_part clingo_part_t
Struct used to specify the program parts that have to be grounded.
unsigned clingo_ground_result_t
Corresponding type to clingo_ground_result_e.
Definition ground.h:59
CLINGO_VISIBILITY_DEFAULT void clingo_ground_handle_close(clingo_ground_handle_t *handle)
Release the ground handle.
CLINGO_VISIBILITY_DEFAULT bool clingo_ground_handle_cancel(clingo_ground_handle_t *handle)
Stop the running ground call and block until done.
clingo_ground_result_e
Enumeration of ground call results.
Definition ground.h:53
CLINGO_VISIBILITY_DEFAULT bool clingo_ground_handle_wait(clingo_ground_handle_t *handle, double timeout, bool *result)
Wait for the specified amount of time to check if the result is ready.
@ clingo_ground_result_ok
Grounding completed successfully.
Definition ground.h:54
@ clingo_ground_result_unsatisfiable
Grounding detected unsatisfiability.
Definition ground.h:55
@ clingo_ground_result_interrupted
Grounding was interrupted.
Definition ground.h:56
bool(* clingo_symbol_callback_t)(clingo_symbol_t const *symbols, size_t symbols_size, void *data)
Callback function to inject symbols.
Definition symbol.h:60
uint64_t clingo_symbol_t
Type to represent a symbol.
Definition symbol.h:51
The ground event handler interface.
Definition ground.h:62
bool(* call)(clingo_lib_t *lib, clingo_location_t const *location, char const *name, size_t name_size, clingo_symbol_t const *arguments, size_t arguments_size, void *data, clingo_symbol_callback_t symbol_callback, void *symbol_callback_data)
Callback function to implement external functions.
Definition ground.h:116
bool(* callable)(char const *name, size_t name_size, size_t arguments_size, void *data, bool *result)
Check if the function with the given name and number of arguments is callable.
Definition ground.h:71
void(* finish)(clingo_ground_result_t result, void *data)
Callback to notify that the grounding has finished.
Definition ground.h:126
void(* free)(void *data)
Callback to free the userdata of the handler.
Definition ground.h:130
Struct used to specify the program parts that have to be grounded.
Definition ground.h:44
char const * name
name of the program part
Definition ground.h:45
clingo_symbol_t const * params
array of parameters
Definition ground.h:47
size_t params_size
number of parameters
Definition ground.h:48
size_t name_size
the size of the name
Definition ground.h:46