[][src]Struct clingo_sys::clingo_ground_program_observer

#[repr(C)]
pub struct clingo_ground_program_observer {
    pub init_program: Option<unsafe extern "C" fn(incremental: bool, data: *mut c_void) -> bool>,
    pub begin_step: Option<unsafe extern "C" fn(data: *mut c_void) -> bool>,
    pub end_step: Option<unsafe extern "C" fn(data: *mut c_void) -> bool>,
    pub rule: Option<unsafe extern "C" fn(choice: bool, head: *const clingo_atom_t, head_size: usize, body: *const clingo_literal_t, body_size: usize, data: *mut c_void) -> bool>,
    pub weight_rule: Option<unsafe extern "C" fn(choice: bool, head: *const clingo_atom_t, head_size: usize, lower_bound: clingo_weight_t, body: *const clingo_weighted_literal_t, body_size: usize, data: *mut c_void) -> bool>,
    pub minimize: Option<unsafe extern "C" fn(priority: clingo_weight_t, literals: *const clingo_weighted_literal_t, size: usize, data: *mut c_void) -> bool>,
    pub project: Option<unsafe extern "C" fn(atoms: *const clingo_atom_t, size: usize, data: *mut c_void) -> bool>,
    pub output_atom: Option<unsafe extern "C" fn(symbol: clingo_symbol_t, atom: clingo_atom_t, data: *mut c_void) -> bool>,
    pub output_term: Option<unsafe extern "C" fn(symbol: clingo_symbol_t, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>,
    pub output_csp: Option<unsafe extern "C" fn(symbol: clingo_symbol_t, value: c_int, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>,
    pub external: Option<unsafe extern "C" fn(atom: clingo_atom_t, type_: clingo_external_type_t, data: *mut c_void) -> bool>,
    pub assume: Option<unsafe extern "C" fn(literals: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>,
    pub heuristic: Option<unsafe extern "C" fn(atom: clingo_atom_t, type_: clingo_heuristic_type_t, bias: c_int, priority: c_uint, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>,
    pub acyc_edge: Option<unsafe extern "C" fn(node_u: c_int, node_v: c_int, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>,
    pub theory_term_number: Option<unsafe extern "C" fn(term_id: clingo_id_t, number: c_int, data: *mut c_void) -> bool>,
    pub theory_term_string: Option<unsafe extern "C" fn(term_id: clingo_id_t, name: *const c_char, data: *mut c_void) -> bool>,
    pub theory_term_compound: Option<unsafe extern "C" fn(term_id: clingo_id_t, name_id_or_type: c_int, arguments: *const clingo_id_t, size: usize, data: *mut c_void) -> bool>,
    pub theory_element: Option<unsafe extern "C" fn(element_id: clingo_id_t, terms: *const clingo_id_t, terms_size: usize, condition: *const clingo_literal_t, condition_size: usize, data: *mut c_void) -> bool>,
    pub theory_atom: Option<unsafe extern "C" fn(atom_id_or_zero: clingo_id_t, term_id: clingo_id_t, elements: *const clingo_id_t, size: usize, data: *mut c_void) -> bool>,
    pub theory_atom_with_guard: Option<unsafe extern "C" fn(atom_id_or_zero: clingo_id_t, term_id: clingo_id_t, elements: *const clingo_id_t, size: usize, operator_id: clingo_id_t, right_hand_side_id: clingo_id_t, data: *mut c_void) -> bool>,
}

! 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, grounding is stopped. ! If a non-recoverable clingo API call fails, a callback must return false. ! Otherwise ::clingo_error_unknown should be set and false returned. ! ! @see clingo_control_register_observer()

Fields

init_program: Option<unsafe extern "C" fn(incremental: bool, data: *mut c_void) -> bool>

! Called once in the beginning. ! ! If the incremental flag is true, there can be multiple calls to @ref clingo_control_solve(). ! ! @param[in] incremental whether the program is incremental ! @param[in] data user data for the callback ! @return whether the call was successful

begin_step: Option<unsafe extern "C" fn(data: *mut c_void) -> bool>

! Marks the beginning of a block of directives passed to the solver. ! ! @see @ref end_step ! ! @param[in] data user data for the callback ! @return whether the call was successful

end_step: Option<unsafe extern "C" fn(data: *mut c_void) -> bool>

! Marks the end of a block of directives passed to the solver. ! ! This function is called before solving starts. ! ! @see @ref begin_step ! ! @param[in] data user data for the callback ! @return whether the call was successful

rule: Option<unsafe extern "C" fn(choice: bool, head: *const clingo_atom_t, head_size: usize, body: *const clingo_literal_t, body_size: usize, data: *mut c_void) -> bool>

! Observe rules passed to the solver. ! ! @param[in] choice determines if the head is a choice or a disjunction ! @param[in] head the head atoms ! @param[in] head_size the number of atoms in the head ! @param[in] body the body literals ! @param[in] body_size the number of literals in the body ! @param[in] data user data for the callback ! @return whether the call was successful

weight_rule: Option<unsafe extern "C" fn(choice: bool, head: *const clingo_atom_t, head_size: usize, lower_bound: clingo_weight_t, body: *const clingo_weighted_literal_t, body_size: usize, data: *mut c_void) -> bool>

! Observe weight rules passed to the solver. ! ! @param[in] choice determines if the head is a choice or a disjunction ! @param[in] head the head atoms ! @param[in] head_size the number of atoms in the head ! @param[in] lower_bound the lower bound of the weight rule ! @param[in] body the weighted body literals ! @param[in] body_size the number of weighted literals in the body ! @param[in] data user data for the callback ! @return whether the call was successful

minimize: Option<unsafe extern "C" fn(priority: clingo_weight_t, literals: *const clingo_weighted_literal_t, size: usize, data: *mut c_void) -> bool>

! Observe minimize constraints (or weak constraints) passed to the solver. ! ! @param[in] priority the priority of the constraint ! @param[in] literals the weighted literals whose sum to minimize ! @param[in] size the number of weighted literals ! @param[in] data user data for the callback ! @return whether the call was successful

project: Option<unsafe extern "C" fn(atoms: *const clingo_atom_t, size: usize, data: *mut c_void) -> bool>

! Observe projection directives passed to the solver. ! ! @param[in] atoms the atoms to project on ! @param[in] size the number of atoms ! @param[in] data user data for the callback ! @return whether the call was successful

output_atom: Option<unsafe extern "C" fn(symbol: clingo_symbol_t, atom: clingo_atom_t, data: *mut c_void) -> bool>

! Observe shown atoms passed to the solver. ! \note Facts do not have an associated aspif atom. ! The value of the atom is set to zero. ! ! @param[in] symbol the symbolic representation of the atom ! @param[in] atom the aspif atom (0 for facts) ! @param[in] data user data for the callback ! @return whether the call was successful

output_term: Option<unsafe extern "C" fn(symbol: clingo_symbol_t, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>

! Observe shown terms passed to the solver. ! ! @param[in] symbol the symbolic representation of the term ! @param[in] condition the literals of the condition ! @param[in] size the size of the condition ! @param[in] data user data for the callback ! @return whether the call was successful

output_csp: Option<unsafe extern "C" fn(symbol: clingo_symbol_t, value: c_int, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>

! Observe shown csp variables passed to the solver. ! ! @param[in] symbol the symbolic representation of the variable ! @param[in] value the value of the variable ! @param[in] condition the literals of the condition ! @param[in] size the size of the condition ! @param[in] data user data for the callback ! @return whether the call was successful

external: Option<unsafe extern "C" fn(atom: clingo_atom_t, type_: clingo_external_type_t, data: *mut c_void) -> bool>

! Observe external statements passed to the solver. ! ! @param[in] atom the external atom ! @param[in] type the type of the external statement ! @param[in] data user data for the callback ! @return whether the call was successful

assume: Option<unsafe extern "C" fn(literals: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>

! Observe assumption directives passed to the solver. ! ! @param[in] literals the literals to assume (positive literals are true and negative literals false for the next solve call) ! @param[in] size the number of atoms ! @param[in] data user data for the callback ! @return whether the call was successful

heuristic: Option<unsafe extern "C" fn(atom: clingo_atom_t, type_: clingo_heuristic_type_t, bias: c_int, priority: c_uint, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>

! Observe heuristic directives passed to the solver. ! ! @param[in] atom the target atom ! @param[in] type the type of the heuristic modification ! @param[in] bias the heuristic bias ! @param[in] priority the heuristic priority ! @param[in] condition the condition under which to apply the heuristic modification ! @param[in] size the number of atoms in the condition ! @param[in] data user data for the callback ! @return whether the call was successful

acyc_edge: Option<unsafe extern "C" fn(node_u: c_int, node_v: c_int, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>

! Observe edge directives passed to the solver. ! ! @param[in] node_u the start vertex of the edge ! @param[in] node_v the end vertex of the edge ! @param[in] condition the condition under which the edge is part of the graph ! @param[in] size the number of atoms in the condition ! @param[in] data user data for the callback ! @return whether the call was successful

theory_term_number: Option<unsafe extern "C" fn(term_id: clingo_id_t, number: c_int, data: *mut c_void) -> bool>

! Observe numeric theory terms. ! ! @param[in] term_id the id of the term ! @param[in] number the value of the term ! @param[in] data user data for the callback ! @return whether the call was successful

theory_term_string: Option<unsafe extern "C" fn(term_id: clingo_id_t, name: *const c_char, data: *mut c_void) -> bool>

! Observe string theory terms. ! ! @param[in] term_id the id of the term ! @param[in] name the value of the term ! @param[in] data user data for the callback ! @return whether the call was successful

theory_term_compound: Option<unsafe extern "C" fn(term_id: clingo_id_t, name_id_or_type: c_int, arguments: *const clingo_id_t, size: usize, data: *mut c_void) -> bool>

! Observe compound theory terms. ! ! The name_id_or_type gives the type of the compound term: ! - if it is -1, then it is a tuple ! - if it is -2, then it is a set ! - if it is -3, then it is a list ! - otherwise, it is a function and name_id_or_type refers to the id of the name (in form of a string term) ! ! @param[in] term_id the id of the term ! @param[in] name_id_or_type the name or type of the term ! @param[in] arguments the arguments of the term ! @param[in] size the number of arguments ! @param[in] data user data for the callback ! @return whether the call was successful

theory_element: Option<unsafe extern "C" fn(element_id: clingo_id_t, terms: *const clingo_id_t, terms_size: usize, condition: *const clingo_literal_t, condition_size: usize, data: *mut c_void) -> bool>

! Observe theory elements. ! ! @param element_id the id of the element ! @param terms the term tuple of the element ! @param terms_size the number of terms in the tuple ! @param condition the condition of the elemnt ! @param condition_size the number of literals in the condition ! @param[in] data user data for the callback ! @return whether the call was successful

theory_atom: Option<unsafe extern "C" fn(atom_id_or_zero: clingo_id_t, term_id: clingo_id_t, elements: *const clingo_id_t, size: usize, data: *mut c_void) -> bool>

! Observe theory atoms without guard. ! ! @param[in] atom_id_or_zero the id of the atom or zero for directives ! @param[in] term_id the term associated with the atom ! @param[in] elements the elements of the atom ! @param[in] size the number of elements ! @param[in] data user data for the callback ! @return whether the call was successful

theory_atom_with_guard: Option<unsafe extern "C" fn(atom_id_or_zero: clingo_id_t, term_id: clingo_id_t, elements: *const clingo_id_t, size: usize, operator_id: clingo_id_t, right_hand_side_id: clingo_id_t, data: *mut c_void) -> bool>

! Observe theory atoms with guard. ! ! @param[in] atom_id_or_zero the id of the atom or zero for directives ! @param[in] term_id the term associated with the atom ! @param[in] elements the elements of the atom ! @param[in] size the number of elements ! @param[in] operator_id the id of the operator (a string term) ! @param[in] right_hand_side_id the id of the term on the right hand side of the atom ! @param[in] data user data for the callback ! @return whether the call was successful

Trait Implementations

impl Clone for clingo_ground_program_observer[src]

impl Copy for clingo_ground_program_observer[src]

impl Debug for clingo_ground_program_observer[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]