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

Project a result into the target relation. More...

#include <Project.h>

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

Public Member Functions

void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
Projectclone () const override
 Create a clone (i.e. More...
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
const std::string & getRelation () const
 Get relation. More...
 
std::vector< Expression * > getValues () const
 Get expressions. More...
 
 Project (std::string rel, VecOwn< Expression > expressions)
 
- 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, 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 Attributes

VecOwn< Expressionexpressions
 
std::string relation
 Relation name. More...
 

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...
 

Detailed Description

Project a result into the target relation.

For example:

FOR t0 IN A
...
PROJECT (t0.a, t0.b, t0.c) INTO @new_X

Definition at line 50 of file Project.h.

Constructor & Destructor Documentation

◆ Project()

souffle::ram::Project::Project ( std::string  rel,
VecOwn< Expression expressions 
)
inline

Definition at line 52 of file Project.h.

56  {
57  return relation;

Member Function Documentation

◆ apply()

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

Apply the mapper to all child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 85 of file Project.h.

87  :
88  void print(std::ostream& os, int tabpos) const override {
89  os << times(" ", tabpos);

◆ clone()

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

Create a clone (i.e.

deep copy) of this node

Implements souffle::ram::Operation.

Definition at line 77 of file Project.h.

81  {
82  for (auto& expr : expressions) {
83  expr = map(std::move(expr));

◆ equal()

bool souffle::ram::Project::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 Project.h.

◆ getChildNodes()

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

Obtain list of all embedded child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 69 of file Project.h.

73  {
74  VecOwn<Expression> newValues;
75  for (auto& expr : expressions) {

◆ getRelation()

const std::string& souffle::ram::Project::getRelation ( ) const
inline

Get relation.

Definition at line 60 of file Project.h.

61  {
62  return toPtrVector(expressions);

References expressions, and souffle::toPtrVector().

Here is the call graph for this function:

◆ getValues()

std::vector<Expression*> souffle::ram::Project::getValues ( ) const
inline

Get expressions.

Definition at line 65 of file Project.h.

65  {
66  std::vector<const Node*> res;
67  for (const auto& expr : expressions) {

References expressions.

◆ print()

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

Pretty print with indentation.

Implements souffle::ram::Operation.

Definition at line 92 of file Project.h.

94  {
95  const auto& other = static_cast<const Project&>(node);
96  return relation == other.relation && equal_targets(expressions, other.expressions);

Field Documentation

◆ expressions

VecOwn<Expression> souffle::ram::Project::expressions
protected

Definition at line 107 of file Project.h.

Referenced by getRelation(), and getValues().

◆ relation

std::string souffle::ram::Project::relation
protected

Relation name.

Definition at line 104 of file Project.h.


The documentation for this class was generated from the following file:
souffle::ram::Project::expressions
VecOwn< Expression > expressions
Definition: Project.h:107
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::ram::Project::relation
std::string relation
Relation name.
Definition: Project.h:104
PROJECT
#define PROJECT(Structure, Arity,...)
souffle::ram::Project::Project
Project(std::string rel, VecOwn< Expression > expressions)
Definition: Project.h:52
souffle::times
detail::multiplying_printer< T > times(const T &value, unsigned num)
A utility printing a given value multiple times.
Definition: StreamUtil.h:322
souffle::equal_targets
bool equal_targets(const Container &a, const Container &b, const Comparator &comp)
A function testing whether two containers are equal with the given Comparator.
Definition: ContainerUtil.h:433
souffle::ram::Project::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: Project.h:92
souffle::toPtrVector
std::vector< T * > toPtrVector(const std::vector< std::unique_ptr< T >> &v)
A utility function enabling the creation of a vector of pointers.
Definition: ContainerUtil.h:146