pl_search_cpp 1.4
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
pl_search::Cut Class Reference

Represents a Prolog like cut. When called it pops env_stack thus removing choicepoints. More...

#include <pred.hpp>

Inheritance diagram for pl_search::Cut:
Inheritance graph
[legend]
Collaboration diagram for pl_search::Cut:
Collaboration graph
[legend]

Public Member Functions

 Cut (Engine *eng, int index)
 Constructs a Cut predicate.
 
void initialize_call () override
 Initializes the predicate call.
 
bool apply_choice () override
 Applies a choice for the cut predicate.
 
void set_cut_point (int cut_point)
 
- Public Member Functions inherited from pl_search::DetPred
 DetPred (Engine *eng)
 Represents a deterministic predicate.
 
bool apply_choice () override
 Noop - all the work is done in initialize_call.
 
- Public Member Functions inherited from pl_search::SemiDetPred
 SemiDetPred (Engine *eng)
 Represents a semi-deterministic predicate.
 
bool more_choices () override
 Applies a choice.
 
bool is_non_det ()
 
- Public Member Functions inherited from pl_search::Pred
 Pred (Engine *eng)
 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 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.
 

Protected Attributes

int env_index
 
- Protected Attributes inherited from pl_search::Pred
PredPtr continuation
 The continuation of the predicate.
 
Engineengine
 

Detailed Description

Represents a Prolog like cut. When called it pops env_stack thus removing choicepoints.

Constructor & Destructor Documentation

◆ Cut()

pl_search::Cut::Cut ( Engine eng,
int  index 
)
inline

Constructs a Cut predicate.

Parameters
engPointer to the engine.
indexAn index into env_stack. When called, env_stack is popped to index.

Member Function Documentation

◆ apply_choice()

bool pl_search::Cut::apply_choice ( )
overridevirtual

Applies a choice for the cut predicate.

Returns
True

Reimplemented from pl_search::Pred.

◆ initialize_call()

void pl_search::Cut::initialize_call ( )
inlineoverridevirtual

Initializes the predicate call.

Reimplemented from pl_search::Pred.

◆ set_cut_point()

void pl_search::Cut::set_cut_point ( int  cut_point)
inline

Member Data Documentation

◆ env_index

int pl_search::Cut::env_index
protected

The documentation for this class was generated from the following files: