pl_search_cpp 1.4
|
Constructs a predicate that loops over (instances of) a predicate while some condition (loop_continues) is satisfied. More...
#include <pred.hpp>
Public Member Functions | |
Loop (Engine *eng, LoopBodyFactory *bf) | |
Constructs a predicate that loops over (instances of) a predicate while some condition (loop_continues) is satisfied. | |
void | initialize_call () override |
Initializes the predicate call. | |
bool | apply_choice () override |
Applies a choice for the loop predicate. | |
void | set_continuation (PredPtr cont) |
Sets the continuation for the loop predicate. | |
![]() | |
DetPred (Engine *eng) | |
Represents a deterministic predicate. | |
![]() | |
SemiDetPred (Engine *eng) | |
Represents a semi-deterministic predicate. | |
bool | more_choices () override |
Applies a choice. | |
bool | is_non_det () |
![]() | |
Pred (Engine *eng) | |
Default constructor. | |
PredPtr | get_continuation () |
Gets the continuation of the predicate. | |
PredPtr | last_pred () |
Follows the continuation chain to the last predicate. | |
bool | is_non_det () |
Determines if the predicate is non-deterministic. | |
void | wrap_with_once () |
Wraps the predicate with a once. | |
virtual | ~Pred ()=default |
Virtual destructor for proper cleanup. | |
std::string | get_name () |
For debugging. | |
Public Attributes | |
LoopBodyFactory * | body_factory |
Protected Attributes | |
PredPtr | saved_continuation |
![]() | |
PredPtr | continuation |
The continuation of the predicate. | |
Engine * | engine |
Constructs a predicate that loops over (instances of) a predicate while some condition (loop_continues) is satisfied.
|
inline |
Constructs a predicate that loops over (instances of) a predicate while some condition (loop_continues) is satisfied.
eng | Pointer to the engine. |
bf | a subclass of LoopBodyFactory that is used to generate body predicates to call and to test if the loop should continue. |
|
overridevirtual |
Applies a choice for the loop predicate.
Reimplemented from pl_search::DetPred.
|
overridevirtual |
Initializes the predicate call.
Reimplemented from pl_search::Pred.
|
virtual |
Sets the continuation for the loop predicate.
cont | A shared pointer to the continuation predicate. |
When the loop body predicate is created in apply_choice, continuation is set to the newely created predicate. When the loop exits continuation is reset to the original continuation (the predicate to call after the loop body). Therefore the set continuation needs to be saved.
Reimplemented from pl_search::Pred.
LoopBodyFactory* pl_search::Loop::body_factory |
|
protected |