souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions | Protected Attributes
souffle::ram::Constraint Class Reference

Evaluates a binary constraint with respect to two Expressions. More...

#include <Constraint.h>

Inheritance diagram for souffle::ram::Constraint:
Inheritance graph
Collaboration diagram for souffle::ram::Constraint:
Collaboration graph

Public Member Functions

void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
Constraintclone () const override
 Create a clone (i.e. More...
 
 Constraint (BinaryConstraintOp op, Own< Expression > l, Own< Expression > r)
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
const ExpressiongetLHS () const
 Get left-hand side. More...
 
BinaryConstraintOp getOperator () const
 Get operator symbol. More...
 
const ExpressiongetRHS () const
 Get right-hand side. More...
 
- Public Member Functions inherited from souffle::ram::Node
bool operator!= (const Node &other) const
 Inequality check for two RAM nodes. More...
 
bool operator== (const Node &other) const
 Equivalence check for two RAM nodes. More...
 
virtual void rewrite (const Node *oldNode, Own< Node > newNode)
 Rewrite a child node. More...
 
virtual ~Node ()=default
 

Protected Member Functions

bool equal (const Node &node) const override
 Equality check for two RAM nodes. More...
 
void print (std::ostream &os) const override
 Print RAM node. More...
 

Protected Attributes

Own< Expressionlhs
 Left-hand side of constraint. More...
 
const BinaryConstraintOp op
 Operator. More...
 
Own< Expressionrhs
 Right-hand side of constraint. More...
 

Detailed Description

Evaluates a binary constraint with respect to two Expressions.

Condition is true if the constraint (a logical operator such as "<") holds between the two operands

The following example checks the equality of the two given tuple elements:

t0.1 = t1.0

Definition at line 55 of file Constraint.h.

Constructor & Destructor Documentation

◆ Constraint()

souffle::ram::Constraint::Constraint ( BinaryConstraintOp  op,
Own< Expression l,
Own< Expression r 
)
inline

Definition at line 57 of file Constraint.h.

57  {
58  return *lhs;
59  }
60 
61  /** @brief Get right-hand side */

References lhs.

Referenced by getOperator().

Member Function Documentation

◆ apply()

void souffle::ram::Constraint::apply ( const NodeMapper )
inlineoverridevirtual

Apply the mapper to all child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 86 of file Constraint.h.

91  {

◆ clone()

Constraint* souffle::ram::Constraint::clone ( ) const
inlineoverridevirtual

Create a clone (i.e.

deep copy) of this node

Implements souffle::ram::Condition.

Definition at line 82 of file Constraint.h.

84  :
85  void print(std::ostream& os) const override {

◆ equal()

bool souffle::ram::Constraint::equal ( const Node ) const
inlineoverrideprotectedvirtual

Equality check for two RAM nodes.

Default action is that nothing needs to be checked.

Reimplemented from souffle::ram::Node.

Definition at line 98 of file Constraint.h.

◆ getChildNodes()

std::vector<const Node*> souffle::ram::Constraint::getChildNodes ( ) const
inlineoverridevirtual

Obtain list of all embedded child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 78 of file Constraint.h.

79  {
80  lhs = map(std::move(lhs));

References lhs, souffle::map(), and rhs.

Here is the call graph for this function:

◆ getLHS()

const Expression& souffle::ram::Constraint::getLHS ( ) const
inline

Get left-hand side.

Definition at line 64 of file Constraint.h.

67  {

◆ getOperator()

BinaryConstraintOp souffle::ram::Constraint::getOperator ( ) const
inline

Get operator symbol.

Definition at line 74 of file Constraint.h.

75  {

References souffle::clone(), Constraint(), lhs, op, and rhs.

Here is the call graph for this function:

◆ getRHS()

const Expression& souffle::ram::Constraint::getRHS ( ) const
inline

Get right-hand side.

Definition at line 69 of file Constraint.h.

71  {

◆ print()

void souffle::ram::Constraint::print ( std::ostream &  out) const
inlineoverrideprotectedvirtual

Print RAM node.

Implements souffle::ram::Node.

Definition at line 92 of file Constraint.h.

Field Documentation

◆ lhs

Own<Expression> souffle::ram::Constraint::lhs
protected

Left-hand side of constraint.

Definition at line 107 of file Constraint.h.

Referenced by Constraint(), getChildNodes(), and getOperator().

◆ op

const BinaryConstraintOp souffle::ram::Constraint::op
protected

Operator.

Definition at line 104 of file Constraint.h.

Referenced by getOperator().

◆ rhs

Own<Expression> souffle::ram::Constraint::rhs
protected

Right-hand side of constraint.

Definition at line 110 of file Constraint.h.

Referenced by getChildNodes(), and getOperator().


The documentation for this class was generated from the following file:
souffle::ram::Constraint::print
void print(std::ostream &os) const override
Print RAM node.
Definition: Constraint.h:92
souffle::map
auto map(const std::vector< A > &xs, F &&f)
Applies a function to each element of a vector and returns the results.
Definition: ContainerUtil.h:158
souffle::clone
auto clone(const std::vector< A * > &xs)
Definition: ContainerUtil.h:172
souffle::ram::Constraint::op
const BinaryConstraintOp op
Operator.
Definition: Constraint.h:104
souffle::ram::Constraint::rhs
Own< Expression > rhs
Right-hand side of constraint.
Definition: Constraint.h:110
souffle::ram::Constraint::lhs
Own< Expression > lhs
Left-hand side of constraint.
Definition: Constraint.h:107
souffle::ram::Constraint::Constraint
Constraint(BinaryConstraintOp op, Own< Expression > l, Own< Expression > r)
Definition: Constraint.h:57