Clingo
Loading...
Searching...
No Matches
theory.h
1#ifndef CLINGO_THEORY_H
2#define CLINGO_THEORY_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
12
28
29#include <clingo/app.h>
30#include <clingo/ast.h>
31#include <clingo/core.h>
32#include <clingo/stats.h>
33#include <clingo/symbol.h>
34
59
61typedef bool (*clingo_theory_ast_callback_t)(clingo_ast_t *ast, void *data);
62
64typedef struct clingo_theory {
73 bool (*info)(void *self, clingo_string_t *name, int *major, int *minor, int *revision);
77 void (*destroy)(void *self);
85 bool (*register_theory)(void *self, clingo_control_t *control);
95 bool (*rewrite_ast)(void *self, clingo_ast_t *statement, clingo_theory_ast_callback_t callback, void *data);
103 bool (*prepare)(void *self, clingo_control_t *control);
109 bool (*register_options)(void *self, clingo_options_t *options);
114 bool (*validate_options)(void *self);
123 bool (*configure)(void *self, char const *key, size_t key_size, char const *value, size_t value_size);
129 bool (*on_model)(void *self, clingo_model_t *model);
135 bool (*on_stats)(void *self, clingo_stats_t *stats);
145 bool (*lookup_symbol)(void *self, clingo_symbol_t symbol, size_t *index, bool *found);
160 bool (*assignment_next)(void *self, uint32_t thread_id, bool *init, size_t *index, bool *has_value);
172 bool (*assignment_get_value)(void *self, uint32_t thread_id, size_t index, clingo_symbol_t *symbol,
173 clingo_theory_value_t *value, bool *has_value);
174
176 void *self;
178
180
181#ifdef __cplusplus
182}
183#endif
184
185#endif
struct clingo_options clingo_options_t
Object to add command-line options.
Definition app.h:46
struct clingo_ast clingo_ast_t
This struct provides a view to nodes in the AST.
Definition ast.h:163
struct clingo_model clingo_model_t
Object representing a model.
Definition model.h:43
struct clingo_statistic clingo_stats_t
Handle for the solver stats.
Definition stats.h:59
uint64_t clingo_symbol_t
Type to represent a symbol.
Definition symbol.h:51
clingo_theory_value_type_e
The available value types.
Definition theory.h:36
bool(* clingo_theory_ast_callback_t)(clingo_ast_t *ast, void *data)
A callback to rewrite asts.
Definition theory.h:61
int clingo_theory_value_type_t
Corresponding type to clingo_theory_value_type.
Definition theory.h:45
struct clingo_theory clingo_theory_t
A theory object to extend solving.
struct clingo_theory_value clingo_theory_value_t
A struct to hold values assigned by a theory.
@ clingo_theory_value_type_double
A double value.
Definition theory.h:40
@ clingo_theory_value_type_symbol
A symbol value.
Definition theory.h:42
@ clingo_theory_value_type_int
An integer value.
Definition theory.h:38
Struct to capture strings that are not null-terminated.
Definition core.h:91
A struct to hold values assigned by a theory.
Definition theory.h:47
clingo_symbol_t symbol
The symbolic value.
Definition theory.h:56
double double_number
The double value.
Definition theory.h:54
clingo_theory_value_type_t type
The type of the value.
Definition theory.h:49
int int_number
The integer value.
Definition theory.h:52
A theory object to extend solving.
Definition theory.h:64
bool(* assignment_get_value)(void *self, uint32_t thread_id, size_t index, clingo_symbol_t *symbol, clingo_theory_value_t *value, bool *has_value)
Get the value assigned to the given index.
Definition theory.h:172
bool(* assignment_next)(void *self, uint32_t thread_id, bool *init, size_t *index, bool *has_value)
Get the next index that has a value.
Definition theory.h:160
bool(* validate_options)(void *self)
Validate the options of the theory.
Definition theory.h:114
bool(* prepare)(void *self, clingo_control_t *control)
Prepare the theory.
Definition theory.h:103
bool(* register_options)(void *self, clingo_options_t *options)
Register the theory's options with the given application options object.
Definition theory.h:109
bool(* register_theory)(void *self, clingo_control_t *control)
Register the theory with the given control object.
Definition theory.h:85
void(* destroy)(void *self)
Destroy the theory.
Definition theory.h:77
bool(* rewrite_ast)(void *self, clingo_ast_t *statement, clingo_theory_ast_callback_t callback, void *data)
Rewrite the given ast for the theory.
Definition theory.h:95
bool(* info)(void *self, clingo_string_t *name, int *major, int *minor, int *revision)
Get the name and version of the theory.
Definition theory.h:73
bool(* on_model)(void *self, clingo_model_t *model)
Inform the theory that a model has been found.
Definition theory.h:129
bool(* configure)(void *self, char const *key, size_t key_size, char const *value, size_t value_size)
Configure the theory passing key value pairs.
Definition theory.h:123
bool(* on_stats)(void *self, clingo_stats_t *stats)
Add the theory's statistics to the given maps.
Definition theory.h:135
bool(* lookup_symbol)(void *self, clingo_symbol_t symbol, size_t *index, bool *found)
Get the integer index of a symbol assigned by the theory when a model is found.
Definition theory.h:145
void * self
The userdata for the first value to the callabcks in this struct.
Definition theory.h:176