Clingo
Loading...
Searching...
No Matches

Interact with a running ground call. More...

Classes

struct  clingo_part
 Struct used to specify the program parts that have to be grounded. More...
 
struct  clingo_ground_event_handler
 The ground event handler interface. More...
 

Typedefs

typedef struct clingo_part clingo_part_t
 Struct used to specify the program parts that have to be grounded.
 
typedef unsigned clingo_ground_result_t
 Corresponding type to clingo_ground_result_e.
 
typedef struct clingo_ground_event_handler clingo_ground_event_handler_t
 The ground event handler interface.
 
typedef struct clingo_ground_handle clingo_ground_handle_t
 Handle to an asynchronous ground call.
 

Enumerations

enum  clingo_ground_result_e { clingo_ground_result_ok = 0 , clingo_ground_result_unsatisfiable = 1 , clingo_ground_result_interrupted = 2 }
 Enumeration of ground call results. More...
 

Functions

CLINGO_VISIBILITY_DEFAULT bool clingo_ground_handle_get (clingo_ground_handle_t *handle, clingo_ground_result_t *result)
 Get the ground result.
 
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_VISIBILITY_DEFAULT bool clingo_ground_handle_cancel (clingo_ground_handle_t *handle)
 Stop the running ground call and block until done.
 
CLINGO_VISIBILITY_DEFAULT void clingo_ground_handle_close (clingo_ground_handle_t *handle)
 Release the ground handle.
 

Detailed Description

Interact with a running ground call.

clingo_ground_handle_t objects can be used for asynchronous grounding. They allow for stopping the grounding process and waiting for its completion.

For an example showing how to ground asynchronously, see ground.c.

Typedef Documentation

◆ clingo_ground_handle_t

typedef struct clingo_ground_handle clingo_ground_handle_t

Handle to an asynchronous ground call.

See also
clingo_control_ground()

◆ clingo_part_t

typedef struct clingo_part clingo_part_t

Struct used to specify the program parts that have to be grounded.

Programs may be structured into parts, which can be grounded independently with clingo_control_ground. Program parts are mainly interesting for incremental grounding and multi-shot solving. For single-shot solving, program parts are not needed.

Note
Parts of a logic program without an explicit #program specification are by default put into a program called base without arguments.
See also
clingo_control_ground()

Enumeration Type Documentation

◆ clingo_ground_result_e

Enumeration of ground call results.

Enumerator
clingo_ground_result_ok 

Grounding completed successfully.

clingo_ground_result_unsatisfiable 

Grounding detected unsatisfiability.

clingo_ground_result_interrupted 

Grounding was interrupted.

Function Documentation

◆ clingo_ground_handle_cancel()

CLINGO_VISIBILITY_DEFAULT bool clingo_ground_handle_cancel ( clingo_ground_handle_t handle)

Stop the running ground call and block until done.

Parameters
[in]handlethe target
Returns
whether the call was successful

◆ clingo_ground_handle_close()

CLINGO_VISIBILITY_DEFAULT void clingo_ground_handle_close ( clingo_ground_handle_t handle)

Release the ground handle.

This internally calls clingo_ground_handle_cancel() if grounding has not finished yet.

Parameters
[in]handlethe target

◆ clingo_ground_handle_get()

CLINGO_VISIBILITY_DEFAULT bool clingo_ground_handle_get ( clingo_ground_handle_t handle,
clingo_ground_result_t result 
)

Get the ground result.

Blocks until the result is ready. This function propagates errors encountered during grounding.

Parameters
[in]handlethe target
[out]resultthe ground result
Returns
whether the call was successful

◆ clingo_ground_handle_wait()

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.

If the time is set to zero, this function can be used to poll if grounding is still active. If the time is negative, the function blocks until the grounding is finished.

Parameters
[in]handlethe target
[in]timeoutthe maximum time to wait
[out]resultwhether the ground call has finished
Returns
whether the call was successful