Clingo
Loading...
Searching...
No Matches
Ground Program Inspection

Functions and data structures to inspect ground programs. More...

Classes

struct  clingo_observer
 An instance of this struct has to be registered with a solver to observe ground directives as they are passed to the solver. More...
 

Typedefs

using clingo_write_aspif_mode_t = unsigned
 Corresponding type to clingo_write_aspif_mode_e.
 
typedef struct clingo_observer clingo_observer_t
 An instance of this struct has to be registered with a solver to observe ground directives as they are passed to the solver.
 

Enumerations

enum  clingo_write_aspif_mode_e {
  clingo_write_aspif_mode_preamble = 1 , clingo_write_aspif_mode_preamble_auto = 2 , clingo_write_aspif_mode_append = 4 , clingo_write_aspif_mode_preprocess = 8 ,
  clingo_write_aspif_mode_symbols = 16
}
 Available write modes for aspif files (bitset). More...
 

Functions

CLINGO_VISIBILITY_DEFAULT bool clingo_control_observe (clingo_control_t *control, clingo_observer_t const *observer, void *data, bool preprocess)
 Get an observer to inspect the ground program.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_control_write_aspif (clingo_control_t *control, char const *path, size_t size, clingo_write_aspif_mode_t mode)
 Write the current logic program in aspif format to a file.
 

Detailed Description

Functions and data structures to inspect ground programs.

Typedef Documentation

◆ clingo_observer_t

An instance of this struct has to be registered with a solver to observe ground directives as they are passed to the solver.

Note
This interface is closely modeled after the aspif format. For more information, please refer to the specification of the aspif format.

Not all callbacks have to be implemented and can be set to NULL if not needed. If one of the callbacks in the struct fails, inspection is stopped.

See also
clingo_control_register_observer()

Enumeration Type Documentation

◆ clingo_write_aspif_mode_e

Available write modes for aspif files (bitset).

Note that the preamble flag preamble_auto toggles the

Enumerator
clingo_write_aspif_mode_preamble 

Write preamble.

clingo_write_aspif_mode_preamble_auto 

Write preamble for newly created files.

clingo_write_aspif_mode_append 

Append to an existing file (or create it).

clingo_write_aspif_mode_preprocess 

Whether to preprocess the program before writing.

clingo_write_aspif_mode_symbols 

Whether to write symbols in a structured format.

Function Documentation

◆ clingo_control_observe()

CLINGO_VISIBILITY_DEFAULT bool clingo_control_observe ( clingo_control_t *  control,
clingo_observer_t const *  observer,
void *  data,
bool  preprocess 
)

Get an observer to inspect the ground program.

Note that the system only maintains the ground program from the current grounding step. Ground programs from previous steps are discarded when calling clingo_control_solve().

Parameters
[in]controlthe control object
[in]observerthe observer to use
[in]datauser data for the observer
[in]preprocesswhether to preprocess the program first
Returns
the result code

◆ clingo_control_write_aspif()

CLINGO_VISIBILITY_DEFAULT bool clingo_control_write_aspif ( clingo_control_t *  control,
char const *  path,
size_t  size,
clingo_write_aspif_mode_t  mode 
)

Write the current logic program in aspif format to a file.

Parameters
controlthe target control
paththe path to the file to write to
sizethe size of the path
modecontrol how to write
Returns
the result code