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

Packs a record's arguments into a reference. More...

#include <PackRecord.h>

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

Public Member Functions

void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
PackRecordclone () const override
 Create a clone (i.e. More...
 
std::vector< Expression * > getArguments () const
 Get record arguments. More...
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
 PackRecord (VecOwn< Expression > args)
 
- 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

VecOwn< Expressionarguments
 Arguments. More...
 

Detailed Description

Packs a record's arguments into a reference.

Definition at line 42 of file PackRecord.h.

Constructor & Destructor Documentation

◆ PackRecord()

souffle::ram::PackRecord::PackRecord ( VecOwn< Expression args)
inline

Definition at line 44 of file PackRecord.h.

45  {
46  return toPtrVector(arguments);
47  }
48 

References arguments, and souffle::toPtrVector().

Here is the call graph for this function:

Member Function Documentation

◆ apply()

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

Apply the mapper to all child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 71 of file PackRecord.h.

71  :
72  void print(std::ostream& os) const override {
73  os << "[" << join(arguments, ",", [](std::ostream& out, const Own<Expression>& arg) { out << *arg; })
74  << "]";
75  }

References arguments, and souffle::join().

Here is the call graph for this function:

◆ clone()

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

Create a clone (i.e.

deep copy) of this node

Implements souffle::ram::Expression.

Definition at line 63 of file PackRecord.h.

65  {
66  for (auto& arg : arguments) {
67  arg = map(std::move(arg));
68  }
69  }

◆ equal()

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

◆ getArguments()

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

Get record arguments.

Definition at line 51 of file PackRecord.h.

51  : arguments) {
52  res.push_back(cur.get());
53  }

◆ getChildNodes()

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

Obtain list of all embedded child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 55 of file PackRecord.h.

57  {
58  auto* res = new PackRecord({});
59  for (auto& cur : arguments) {
60  res->arguments.emplace_back(cur->clone());
61  }

◆ print()

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

Print RAM node.

Implements souffle::ram::Node.

Definition at line 78 of file PackRecord.h.

Field Documentation

◆ arguments

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

Arguments.

Definition at line 89 of file PackRecord.h.

Referenced by apply(), and PackRecord().


The documentation for this class was generated from the following file:
souffle::ram::PackRecord::PackRecord
PackRecord(VecOwn< Expression > args)
Definition: PackRecord.h:44
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::PackRecord::arguments
VecOwn< Expression > arguments
Arguments.
Definition: PackRecord.h:89
souffle::join
detail::joined_sequence< Iter, Printer > join(const Iter &a, const Iter &b, const std::string &sep, const Printer &p)
Creates an object to be forwarded to some output stream for printing sequences of elements interspers...
Definition: StreamUtil.h:175
souffle::ram::PackRecord::print
void print(std::ostream &os) const override
Print RAM node.
Definition: PackRecord.h:78
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