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

Find a tuple in a relation such that a given condition holds. More...

#include <Choice.h>

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

Public Member Functions

void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
 Choice (std::string rel, size_t ident, Own< Condition > cond, Own< Operation > nested, std::string profileText="")
 
Choiceclone () const override
 Create a clone (i.e. More...
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
- Public Member Functions inherited from souffle::ram::RelationOperation
const std::string & getRelation () const
 Get search relation. More...
 
 RelationOperation (std::string rel, int ident, Own< Operation > nested, std::string profileText="")
 
- Public Member Functions inherited from souffle::ram::TupleOperation
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
int getTupleId () const
 Get identifier. More...
 
void setTupleId (int id)
 Set identifier. More...
 
 TupleOperation (int ident, Own< Operation > nested, std::string profileText="")
 
- Public Member Functions inherited from souffle::ram::NestedOperation
void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
OperationgetOperation () const
 Get nested operation. More...
 
const std::string & getProfileText () const
 Get profile text. More...
 
 NestedOperation (Own< Operation > nested, std::string profileText="")
 
- 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
 
- Public Member Functions inherited from souffle::ram::AbstractChoice
 AbstractChoice (Own< Condition > cond)
 
void apply (const NodeMapper &map)
 
std::vector< const Node * > getChildNodes () const
 
const ConditiongetCondition () const
 Getter for the condition. More...
 

Protected Member Functions

bool equal (const Node &node) const override
 Equality check for two RAM nodes. More...
 
void print (std::ostream &os, int tabpos) const override
 Pretty print with indentation. More...
 
- Protected Member Functions inherited from souffle::ram::RelationOperation
bool equal (const Node &node) const override
 Equality check for two RAM nodes. More...
 
- Protected Member Functions inherited from souffle::ram::TupleOperation
bool equal (const Node &node) const override
 Equality check for two RAM nodes. More...
 
- Protected Member Functions inherited from souffle::ram::NestedOperation
void print (std::ostream &os, int tabpos) const override
 Pretty print with indentation. More...
 
- Protected Member Functions inherited from souffle::ram::Operation
void print (std::ostream &os) const override
 Print RAM node. More...
 
- Protected Member Functions inherited from souffle::ram::AbstractChoice
bool equal (const Node &node) const
 

Additional Inherited Members

- Static Protected Member Functions inherited from souffle::ram::Operation
static void print (const Operation *operation, std::ostream &os, int tabpos)
 Pretty print jump-bed. More...
 
- Protected Attributes inherited from souffle::ram::RelationOperation
const std::string relation
 Search relation. More...
 
- Protected Attributes inherited from souffle::ram::TupleOperation
int identifier
 Identifier for the tuple, corresponding to its position in the loop nest. More...
 
- Protected Attributes inherited from souffle::ram::NestedOperation
Own< OperationnestedOperation
 Nested operation. More...
 
const std::string profileText
 Text used by the profiler. More...
 
- Protected Attributes inherited from souffle::ram::AbstractChoice
Own< Conditioncondition
 Condition for which a tuple in the relation may hold. More...
 

Detailed Description

Find a tuple in a relation such that a given condition holds.

Only one tuple is returned (if one exists), even if multiple tuples satisfying the condition exist.

For example:

QUERY
...
CHOICE t1 IN A WHERE (t1.x, t1.y) NOT IN A
...

Definition at line 59 of file Choice.h.

Constructor & Destructor Documentation

◆ Choice()

souffle::ram::Choice::Choice ( std::string  rel,
size_t  ident,
Own< Condition cond,
Own< Operation nested,
std::string  profileText = "" 
)
inline

Definition at line 61 of file Choice.h.

65  {

Member Function Documentation

◆ apply()

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

Apply the mapper to all child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 66 of file Choice.h.

◆ clone()

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

Create a clone (i.e.

deep copy) of this node

Implements souffle::ram::RelationOperation.

Reimplemented in souffle::ram::ParallelChoice.

Definition at line 71 of file Choice.h.

72  }
73 
74 protected:

References souffle::ram::AbstractChoice::getChildNodes(), and souffle::ram::NestedOperation::nestedOperation.

Here is the call graph for this function:

◆ equal()

bool souffle::ram::Choice::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 90 of file Choice.h.

◆ getChildNodes()

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

Obtain list of all embedded child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 76 of file Choice.h.

◆ print()

void souffle::ram::Choice::print ( std::ostream &  os,
int  tabpos 
) const
inlineoverrideprotectedvirtual

Pretty print with indentation.

Implements souffle::ram::Operation.

Reimplemented in souffle::ram::ParallelChoice.

Definition at line 81 of file Choice.h.

84  {
85  const auto& other = static_cast<const Choice&>(node);
86  return RelationOperation::equal(other) && AbstractChoice::equal(other);
87  }
88 };

The documentation for this class was generated from the following file:
souffle::ram::AbstractChoice::equal
bool equal(const Node &node) const
Definition: AbstractChoice.h:59
souffle::ram::Choice::Choice
Choice(std::string rel, size_t ident, Own< Condition > cond, Own< Operation > nested, std::string profileText="")
Definition: Choice.h:61
souffle::ram::RelationOperation::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: RelationOperation.h:54
souffle::ram::AbstractChoice::getChildNodes
std::vector< const Node * > getChildNodes() const
Definition: AbstractChoice.h:54
CHOICE
#define CHOICE(Structure, Arity,...)
souffle::ram::NestedOperation::nestedOperation
Own< Operation > nestedOperation
Nested operation.
Definition: NestedOperation.h:90