+#ifndef QueryCallbacks_H
+#define QueryCallbacks_H
+
+enum NextState {
+ /**
+ * This state tells the "next" function that it should capture the
+ * incoming BindingTable state and provide the initial Binding of
+ * a new sucession of bindings.
+ */
+ initial,
+ /**
+ * This state tells the "next" function that it should update the
+ * bidning table with a subsequent Binding in the current
+ * succession of bindings.
+ */
+ subsequent,
+ /**
+ * This state tells the "next" function that it should just
+ * restore the Binding table to its incoming state.
+ */
+ restore
+};
+
+/**
+ * A struct Query_callbacks record defines the callbacks for a
+ * specific Query type.
+ */
+struct QueryCallbacks {
+ /**
+ * \brief Callback function to reclaim the Query memory for a
+ * given Query.
+ *
+ * \param this is the specific \ref Query concerned.
+ *
+ * Ground queries recalim their own state memory. Composite
+ * queries first propagate the reclaim call to its components, and
+ * thereafter reclaim their local state memory.
+ */
+ void (*reclaim)(Query *this);
+ /**
+ * \brief Callback function to update the Binding table with a
+ * succession of alternative bindings.
+ *
+ * \param this is the specific \ref Query concerned.
+ *
+ * \param bt is the Binding table to set bindings in.
+ *
+ * \param s is the call "sub-command" for the function.
+ *
+ * \returns 1 if a new Binding is provided and 0 otherwise.
+ *
+ * This function is called repeatedly for successively obtaining
+ * the alternative bindings that satisfy the Query. The "initial"
+ * state sub-command tells the function to capture the incoming
+ * BindingTable state so that the function can later restore it
+ * upon the "restore" sub-command. Upon the "initial" command, the
+ * function also sets up the Binding table with its first Binding
+ * alternative. This is followed by a series of "subsequent"
+ * sub-command calls for the function to change the BindingTable
+ * for its succession of Binding alternatives. The function should
+ * return 1 after any successful Binding setup, and return 0 when
+ * it cannot setup any (more) Binding.
+ */
+ int (*next)(Query *this,BindingTable *bt,enum NextState state);
+ /**
+ * This callback function adds its binding names to the
+ * hashvector.
+ */
+ void (*bindings)(Query *this,HashVector *hv);
+};
+
+
+#endif