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

Abstract class for an operator/functor. More...

#include <AbstractOperator.h>

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

Public Member Functions

 AbstractOperator (VecOwn< Expression > args)
 
void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
std::vector< Expression * > getArguments () const
 Get argument values. More...
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
- Public Member Functions inherited from souffle::ram::Expression
Expressionclone () const override=0
 Create a clone (i.e. 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...
 
- Protected Member Functions inherited from souffle::ram::Node
virtual void print (std::ostream &out=std::cout) const =0
 Print RAM node. More...
 

Protected Attributes

VecOwn< Expressionarguments
 Arguments of user defined operator. More...
 

Detailed Description

Abstract class for an operator/functor.

Definition at line 40 of file AbstractOperator.h.

Constructor & Destructor Documentation

◆ AbstractOperator()

souffle::ram::AbstractOperator::AbstractOperator ( VecOwn< Expression args)
inlineexplicit

Definition at line 42 of file AbstractOperator.h.

43  {
44  return toPtrVector(arguments);
45  }
46 

References arguments, and souffle::toPtrVector().

Here is the call graph for this function:

Member Function Documentation

◆ apply()

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

Apply the mapper to all child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 61 of file AbstractOperator.h.

61  :
62  bool equal(const Node& node) const override {
63  const auto& other = static_cast<const AbstractOperator&>(node);
64  return equal_targets(arguments, other.arguments);
65  }

References arguments, and souffle::equal_targets().

Here is the call graph for this function:

◆ equal()

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

Reimplemented in souffle::ram::UserDefinedOperator, and souffle::ram::IntrinsicOperator.

Definition at line 68 of file AbstractOperator.h.

◆ getArguments()

std::vector<Expression*> souffle::ram::AbstractOperator::getArguments ( ) const
inline

Get argument values.

Definition at line 49 of file AbstractOperator.h.

49  : arguments) {
50  res.push_back(cur.get());
51  }

◆ getChildNodes()

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

Obtain list of all embedded child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 53 of file AbstractOperator.h.

55  {
56  for (auto& arg : arguments) {
57  arg = map(std::move(arg));
58  }
59  }

Field Documentation

◆ arguments

VecOwn<Expression> souffle::ram::AbstractOperator::arguments
protected

Arguments of user defined operator.

Definition at line 74 of file AbstractOperator.h.

Referenced by AbstractOperator(), and apply().


The documentation for this class was generated from the following file:
souffle::ram::AbstractOperator::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: AbstractOperator.h:68
souffle::ram::AbstractOperator::arguments
VecOwn< Expression > arguments
Arguments of user defined operator.
Definition: AbstractOperator.h:74
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::AbstractOperator::AbstractOperator
AbstractOperator(VecOwn< Expression > args)
Definition: AbstractOperator.h:42
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::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