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

Execute statement until statement terminates loop via an exit statement. More...

#include <Loop.h>

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

Public Member Functions

void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
Loopclone () const override
 Create a clone (i.e. More...
 
const StatementgetBody () const
 Get loop body. More...
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
 Loop (Own< Statement > b)
 
- 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::Statement
void print (std::ostream &os) const override
 Print RAM node. More...
 

Protected Attributes

Own< Statementbody
 Loop body. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from souffle::ram::Statement
static void print (const Statement *statement, std::ostream &os, int tabpos)
 Pretty print jump-bed. More...
 

Detailed Description

Execute statement until statement terminates loop via an exit statement.

For example:

LOOP
PARALLEL
...
END PARALLEL
END LOOP

Definition at line 48 of file Loop.h.

Constructor & Destructor Documentation

◆ Loop()

souffle::ram::Loop::Loop ( Own< Statement b)
inline

Definition at line 50 of file Loop.h.

51  {
52  return *body;

References body.

Referenced by getChildNodes().

Member Function Documentation

◆ apply()

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

Apply the mapper to all child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 67 of file Loop.h.

67  :
68  void print(std::ostream& os, int tabpos) const override {
69  os << times(" ", tabpos) << "LOOP" << std::endl;

References body, souffle::ram::Statement::print(), and souffle::times().

Here is the call graph for this function:

◆ clone()

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

Create a clone (i.e.

deep copy) of this node

Implements souffle::ram::Statement.

Definition at line 63 of file Loop.h.

63  {
64  body = map(std::move(body));
65  }

References body, and souffle::map().

Here is the call graph for this function:

◆ equal()

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

◆ getBody()

const Statement& souffle::ram::Loop::getBody ( ) const
inline

Get loop body.

Definition at line 55 of file Loop.h.

55  {
56  return {body.get()};
57  }

References body.

◆ getChildNodes()

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

Obtain list of all embedded child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 59 of file Loop.h.

59  {
60  return new Loop(souffle::clone(body));
61  }

References body, souffle::clone(), and Loop().

Here is the call graph for this function:

◆ print()

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

Pretty print with indentation.

Implements souffle::ram::Statement.

Definition at line 72 of file Loop.h.

74  {
75  const auto& other = static_cast<const Loop&>(node);
76  return equal_ptr(body, other.body);

Field Documentation

◆ body

Own<Statement> souffle::ram::Loop::body
protected

Loop body.

Definition at line 84 of file Loop.h.

Referenced by apply(), clone(), getBody(), getChildNodes(), and Loop().


The documentation for this class was generated from the following file:
souffle::ram::Loop::Loop
Loop(Own< Statement > b)
Definition: Loop.h:50
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::clone
auto clone(const std::vector< A * > &xs)
Definition: ContainerUtil.h:172
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_ptr
bool equal_ptr(const T *a, const T *b)
Compares two values referenced by a pointer where the case where both pointers are null is also consi...
Definition: MiscUtil.h:130
souffle::ram::Loop::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: Loop.h:72
souffle::ram::Loop::body
Own< Statement > body
Loop body.
Definition: Loop.h:84