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

Operator that represents an extrinsic (user-defined) functor. More...

#include <UserDefinedOperator.h>

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

Public Member Functions

UserDefinedOperatorclone () const override
 Create a clone (i.e. More...
 
const std::vector< TypeAttribute > & getArgsTypes () const
 Get types of arguments. More...
 
const std::string & getName () const
 Get operator name. More...
 
TypeAttribute getReturnType () const
 Get return type. More...
 
bool isStateful () const
 Is functor stateful? More...
 
 UserDefinedOperator (std::string n, std::vector< TypeAttribute > argsTypes, TypeAttribute returnType, bool stateful, VecOwn< Expression > args)
 
- Public Member Functions inherited from souffle::ram::AbstractOperator
 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::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

const std::vector< TypeAttributeargsTypes
 Argument types. More...
 
const std::string name
 Name of user-defined operator. More...
 
const TypeAttribute returnType
 Return type. More...
 
const bool stateful
 Stateful. More...
 
- Protected Attributes inherited from souffle::ram::AbstractOperator
VecOwn< Expressionarguments
 Arguments of user defined operator. More...
 

Detailed Description

Operator that represents an extrinsic (user-defined) functor.

Definition at line 43 of file UserDefinedOperator.h.

Constructor & Destructor Documentation

◆ UserDefinedOperator()

souffle::ram::UserDefinedOperator::UserDefinedOperator ( std::string  n,
std::vector< TypeAttribute argsTypes,
TypeAttribute  returnType,
bool  stateful,
VecOwn< Expression args 
)
inline

Definition at line 45 of file UserDefinedOperator.h.

47  {
48  return name;
49  }
50 

References name.

Member Function Documentation

◆ clone()

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

Create a clone (i.e.

deep copy) of this node

Implements souffle::ram::Expression.

Definition at line 72 of file UserDefinedOperator.h.

75  :
76  void print(std::ostream& os) const override {
77  os << "@" << name << "_" << argsTypes;
78  os << "_" << returnType;
79  if (stateful) {

◆ equal()

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

Equality check for two RAM nodes.

Default action is that nothing needs to be checked.

Reimplemented from souffle::ram::AbstractOperator.

Definition at line 92 of file UserDefinedOperator.h.

◆ getArgsTypes()

const std::vector<TypeAttribute>& souffle::ram::UserDefinedOperator::getArgsTypes ( ) const
inline

Get types of arguments.

Definition at line 58 of file UserDefinedOperator.h.

62  {

◆ getName()

const std::string& souffle::ram::UserDefinedOperator::getName ( ) const
inline

Get operator name.

Definition at line 53 of file UserDefinedOperator.h.

57  {

◆ getReturnType()

TypeAttribute souffle::ram::UserDefinedOperator::getReturnType ( ) const
inline

Get return type.

Definition at line 63 of file UserDefinedOperator.h.

66  {

◆ isStateful()

bool souffle::ram::UserDefinedOperator::isStateful ( ) const
inline

Is functor stateful?

Definition at line 68 of file UserDefinedOperator.h.

68  : arguments) {
69  Expression* arg = cur->clone();
70  res->arguments.emplace_back(arg);

References souffle::ram::Expression::clone().

Here is the call graph for this function:

◆ print()

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

Print RAM node.

Implements souffle::ram::Node.

Definition at line 82 of file UserDefinedOperator.h.

82  { out << *arg; })
83  << ")";
84  }
85 
86  bool equal(const Node& node) const override {
87  const auto& other = static_cast<const UserDefinedOperator&>(node);
88  return AbstractOperator::equal(node) && name == other.name && argsTypes == other.argsTypes &&
89  returnType == other.returnType && stateful == other.stateful;
90  }

Field Documentation

◆ argsTypes

const std::vector<TypeAttribute> souffle::ram::UserDefinedOperator::argsTypes
protected

Argument types.

Definition at line 102 of file UserDefinedOperator.h.

◆ name

const std::string souffle::ram::UserDefinedOperator::name
protected

Name of user-defined operator.

Definition at line 99 of file UserDefinedOperator.h.

Referenced by UserDefinedOperator().

◆ returnType

const TypeAttribute souffle::ram::UserDefinedOperator::returnType
protected

Return type.

Definition at line 105 of file UserDefinedOperator.h.

◆ stateful

const bool souffle::ram::UserDefinedOperator::stateful
protected

Stateful.

Definition at line 108 of file UserDefinedOperator.h.


The documentation for this class was generated from the following file:
souffle::ram::UserDefinedOperator::UserDefinedOperator
UserDefinedOperator(std::string n, std::vector< TypeAttribute > argsTypes, TypeAttribute returnType, bool stateful, VecOwn< Expression > args)
Definition: UserDefinedOperator.h:45
souffle::ram::AbstractOperator::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: AbstractOperator.h:68
souffle::ram::UserDefinedOperator::stateful
const bool stateful
Stateful.
Definition: UserDefinedOperator.h:108
souffle::ram::UserDefinedOperator::argsTypes
const std::vector< TypeAttribute > argsTypes
Argument types.
Definition: UserDefinedOperator.h:102
souffle::ram::AbstractOperator::arguments
VecOwn< Expression > arguments
Arguments of user defined operator.
Definition: AbstractOperator.h:74
souffle::ram::UserDefinedOperator::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: UserDefinedOperator.h:92
souffle::ram::UserDefinedOperator::returnType
const TypeAttribute returnType
Return type.
Definition: UserDefinedOperator.h:105
souffle::ram::UserDefinedOperator::name
const std::string name
Name of user-defined operator.
Definition: UserDefinedOperator.h:99
souffle::ram::UserDefinedOperator::print
void print(std::ostream &os) const override
Print RAM node.
Definition: UserDefinedOperator.h:82