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