1 #ifndef QueryCallbacks_H
2 #define QueryCallbacks_H
4 typedef struct HashVector HashVector;
8 * This state tells the "next" function that it should capture the
9 * incoming BindingTable state and provide the initial Binding of
10 * a new sucession of bindings.
14 * This state tells the "next" function that it should update the
15 * bidning table with a subsequent Binding in the current
16 * succession of bindings.
20 * This state tells the "next" function that it should just
21 * restore the Binding table to its incoming state.
27 * A struct Query_callbacks record defines the callbacks for a
28 * specific Query type.
30 struct QueryCallbacks {
32 * \brief Callback function to reclaim the Query memory for a
35 * \param this is the specific \ref Query concerned.
37 * Ground queries recalim their own state memory. Composite
38 * queries first propagate the reclaim call to its components, and
39 * thereafter reclaim their local state memory.
41 void (*reclaim)(Query *this);
43 * \brief Callback function to update the Binding table with a
44 * succession of alternative bindings.
46 * \param this is the specific \ref Query concerned.
48 * \param bt is the Binding table to set bindings in.
50 * \param s is the call "sub-command" for the function.
52 * \returns 1 if a new Binding is provided and 0 otherwise.
54 * This function is called repeatedly for successively obtaining
55 * the alternative bindings that satisfy the Query. The "initial"
56 * state sub-command tells the function to capture the incoming
57 * BindingTable state so that the function can later restore it
58 * upon the "restore" sub-command. Upon the "initial" command, the
59 * function also sets up the Binding table with its first Binding
60 * alternative. This is followed by a series of "subsequent"
61 * sub-command calls for the function to change the BindingTable
62 * for its succession of Binding alternatives. The function should
63 * return 1 after any successful Binding setup, and return 0 when
64 * it cannot setup any (more) Binding.
66 int (*next)(Query *this,BindingTable *bt,enum NextState state);
68 * \brief This callback function adds its binding names to the
71 void (*variables)(Query *this,HashVector *hv);