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

Exit statement for a loop. More...

#include <Exit.h>

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

Public Member Functions

void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
Exitclone () const override
 Create a clone (i.e. More...
 
 Exit (Own< Condition > c)
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
const ConditiongetCondition () const
 Get exit condition. 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, 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< Conditioncondition
 Exit condition. 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

Exit statement for a loop.

Exits a loop if exit condition holds.

The following example will exit the loop given that A is the empty set:

EXIT (A = ∅)

Definition at line 48 of file Exit.h.

Constructor & Destructor Documentation

◆ Exit()

souffle::ram::Exit::Exit ( Own< Condition c)
inline

Definition at line 50 of file Exit.h.

51  {
52  return *condition;

References condition.

Referenced by getChildNodes().

Member Function Documentation

◆ apply()

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

Apply the mapper to all child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 67 of file Exit.h.

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

References getCondition(), and souffle::times().

Here is the call graph for this function:

◆ clone()

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

Create a clone (i.e.

deep copy) of this node

Implements souffle::ram::Statement.

Definition at line 63 of file Exit.h.

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

References condition, and souffle::map().

Here is the call graph for this function:

◆ equal()

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

◆ getChildNodes()

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

Obtain list of all embedded child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 59 of file Exit.h.

59  {
60  return new Exit(souffle::clone(condition));
61  }

References souffle::clone(), condition, and Exit().

Here is the call graph for this function:

◆ getCondition()

const Condition& souffle::ram::Exit::getCondition ( ) const
inline

Get exit condition.

Definition at line 55 of file Exit.h.

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

References condition.

Referenced by apply().

◆ print()

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

Pretty print with indentation.

Implements souffle::ram::Statement.

Definition at line 72 of file Exit.h.

72  {
73  const auto& other = static_cast<const Exit&>(node);
74  return equal_ptr(condition, other.condition);

References condition, and souffle::equal_ptr().

Here is the call graph for this function:

Field Documentation

◆ condition

Own<Condition> souffle::ram::Exit::condition
protected

Exit condition.

Definition at line 82 of file Exit.h.

Referenced by clone(), Exit(), getChildNodes(), getCondition(), and print().


The documentation for this class was generated from the following file:
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::Exit::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: Exit.h:72
souffle::ram::Exit::condition
Own< Condition > condition
Exit condition.
Definition: Exit.h:82
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::Exit::getCondition
const Condition & getCondition() const
Get exit condition.
Definition: Exit.h:55
souffle::ram::Exit::Exit
Exit(Own< Condition > c)
Definition: Exit.h:50