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

Represents an equivalent of the Prolog call \+\+Pred. The aim is to determine if Pred succeeds without binding any variables in the call. More...

#include <pred.hpp>

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

Public Member Functions

 NotNot (Trail *trail, PredPtr pred)
 Create the equivalent of Prolog's \+\+p call.
 
bool call () override
 Calls the NotNot predicate.
 
- 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.
 
virtual void call_init ()
 Initialize call.
 
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

PredPtr pred
 
- Protected Attributes inherited from pl_search::Pred
PredPtr continuation
 The continuation of the predicate.
 
Trailtrail
 Pointer to the trail for managing variable bindings.
 

Detailed Description

Represents an equivalent of the Prolog call \+\+Pred. The aim is to determine if Pred succeeds without binding any variables in the call.

The NotNot meta-predicate is very similar to the Once predicate except that any variable bindings made by Pred are undone both on failure and success of the Pred call. NotNot is used to determine if Pred would succeed without committing to any variable bindings made by the call to Pred. Note that Pred is a local call - i.e. its continuation is not related to the continuation of the NotNot predicate.

Constructor & Destructor Documentation

◆ NotNot()

pl_search::NotNot::NotNot ( Trail trail,
PredPtr  pred 
)
inline

Create the equivalent of Prolog's \+\+p call.

Parameters
trailPointer to the trail.
predis the predicate called within NotNot.

Member Function Documentation

◆ call()

bool pl_search::NotNot::call ( )
overridevirtual

Calls the NotNot predicate.

Returns
True if the predicate succeeds and the continuation succeeds, false otherwise, removing any choice points and variable bindings made by the predicate.

NotNot is very similar to Once except that any variable bindings made by pred are undone both on failure and success of the pred call.

Reimplemented from pl_search::Pred.

Member Data Documentation

◆ pred

PredPtr pl_search::NotNot::pred
protected

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