|
pl_search_cpp 2.2
|
Represents a choice predicate that makes choices for a variable from a set of terms. More...
#include <pred.hpp>


Public Member Functions | |
| VarChoicePred (Trail *trail, PVarPtr v, std::vector< TermPtr > choices) | |
| Constructs a VarChoicePred with the given trail, variable, and choices. | |
| void | call_init () override |
| Reset index so that all choices are considered when the predicate is (re)called. | |
| bool | has_next () override |
| Checks if there are more choices available. | |
| bool | make_choice () override |
| Makes a choice from the available options. | |
Public Member Functions inherited from pl_search::ChoicePred | |
| ChoicePred (Trail *trail) | |
| Constructs a ChoicePred that tries available choices. | |
| bool | call () override |
| Calls the choice predicate. | |
| virtual bool | test_choice () |
| Tests the current choice for validity. | |
Public Member Functions inherited from pl_search::Pred | |
| Pred (Trail *trail) | |
| Default constructor. | |
| PredPtr | get_continuation () |
| Gets the continuation of the predicate. | |
| virtual void | set_continuation (PredPtr cont) |
| Sets the continuation of the predicate. | |
| PredPtr | last_pred () |
| Follows the continuation chain to the last predicate. | |
| bool | call_continuation () |
| Calls the continuation of the predicate - first call_init and then call. | |
| virtual | ~Pred ()=default |
| Virtual destructor for proper cleanup. | |
| virtual std::string | get_name () |
| For debugging. | |
Protected Attributes | |
| PVarPtr | var |
| The variable for which choices are made. | |
| std::vector< TermPtr > | choices |
| The available choices for the variable. | |
| size_t | index |
| The current index in the choices vector. | |
Protected Attributes inherited from pl_search::Pred | |
| PredPtr | continuation |
| The continuation of the predicate. | |
| Trail * | trail |
| Pointer to the trail for managing variable bindings. | |
Represents a choice predicate that makes choices for a variable from a set of terms.
The VarChoicePred class is a specific implementation of a choice predicate that makes choices for a variable from a set of terms. It uses the unify function to bind the variable to a term and tests the choice for validity.
|
inline |
Constructs a VarChoicePred with the given trail, variable, and choices.
| trail | Pointer to the trail. |
| v | The variable for which choices are made. |
| choices | A vector of terms representing the available choices for the variable. |
|
inlineoverridevirtual |
Reset index so that all choices are considered when the predicate is (re)called.
Reimplemented from pl_search::Pred.
|
inlineoverridevirtual |
Checks if there are more choices available.
Implements pl_search::ChoicePred.
|
inlineoverridevirtual |
Makes a choice from the available options.
Implements pl_search::ChoicePred.
|
protected |
The available choices for the variable.
|
protected |
The current index in the choices vector.
|
protected |
The variable for which choices are made.