souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
45 class Clause :
public Node {
84 this->plan = std::move(
plan);
100 lit =
map(std::move(lit));
105 std::vector<const Node*> res = {
head.get()};
107 res.push_back(cur.get());
113 void print(std::ostream& os)
const override {
114 if (
head !=
nullptr) {
121 if (
plan !=
nullptr) {
126 bool equal(
const Node& node)
const override {
127 const auto& other =
static_cast<const Clause&
>(node);
void addToBody(Own< Literal > literal)
Add a literal to the body of the clause.
const ExecutionPlan * getExecutionPlan() const
Obtains the execution plan associated to this clause or null if there is none.
An abstract class for manipulating AST Nodes by substitution.
auto map(const std::vector< A > &xs, F &&f)
Applies a function to each element of a vector and returns the results.
Own< Atom > head
Head of the clause.
Intermediate representation of a horn clause.
void setHead(Own< Atom > h)
Set the head of clause to h.
Atom * getHead() const
Return the atom that represents the head of the clause.
void clearExecutionPlan()
Resets the execution plan.
bool equal(const Node &node) const override
Abstract equality check for two AST nodes.
auto clone(const std::vector< A * > &xs)
detail::joined_sequence< Iter, Printer > join(const Iter &a, const Iter &b, const std::string &sep, const Printer &p)
Creates an object to be forwarded to some output stream for printing sequences of elements interspers...
bool equal_targets(const Container &a, const Container &b, const Comparator &comp)
A function testing whether two containers are equal with the given Comparator.
bool equal_ptr(const T *a, const T *b)
Compares two values referenced by a pointer where the case where both pointers are null is also consi...
void apply(const NodeMapper &map) override
Apply the mapper to all child nodes.
void setExecutionPlan(Own< ExecutionPlan > plan)
Updates the execution plan associated to this clause.
Own< ExecutionPlan > plan
User defined execution plan (if not defined, plan is null)
std::vector< const Node * > getChildNodes() const override
Obtain a list of all embedded AST child nodes.
void setBodyLiterals(VecOwn< Literal > body)
Set the bodyLiterals of clause to body.
const SrcLocation & getSrcLoc() const
Return source location of the Node.
void print(std::ostream &os) const override
Output to a given output stream.
std::vector< T * > toPtrVector(const std::vector< std::unique_ptr< T >> &v)
A utility function enabling the creation of a vector of pointers.
std::vector< Own< A > > VecOwn
Clause * clone() const override
Create a clone (i.e.
Clause(Own< Atom > head={}, VecOwn< Literal > bodyLiterals={}, Own< ExecutionPlan > plan={}, SrcLocation loc={})
std::vector< Literal * > getBodyLiterals() const
Obtains a copy of the internally maintained body literals.
VecOwn< Literal > bodyLiterals
Body literals of clause.