souffle  2.0.2-371-g6315b36
Statement.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved
4  * Licensed under the Universal Permissive License v 1.0 as shown at:
5  * - https://opensource.org/licenses/UPL
6  * - <souffle root>/licenses/SOUFFLE-UPL.txt
7  */
8 
9 /************************************************************************
10  *
11  * @file Statement.h
12  *
13  * Defines abstract class Statement and sub-classes for implementing the
14  * Relational Algebra Machine (RAM), which is an abstract machine.
15  *
16  ***********************************************************************/
17 
18 #pragma once
19 
20 #include "ram/Node.h"
21 #include <cassert>
22 #include <ostream>
23 
24 namespace souffle::ram {
25 
26 /**
27  * @class Statement
28  * @brief Abstract class for RAM statements
29  */
30 class Statement : public Node {
31 public:
32  Statement* clone() const override = 0;
33 
34 protected:
35  void print(std::ostream& os) const override {
36  print(os, 0);
37  }
38  /** @brief Pretty print with indentation */
39  virtual void print(std::ostream& os, int tabpos) const = 0;
40 
41  /** @brief Pretty print jump-bed */
42  static void print(const Statement* statement, std::ostream& os, int tabpos) {
43  assert(statement != nullptr && "statement is a null-pointer");
44  statement->print(os, tabpos);
45  }
46 
47  friend class Program;
48 };
49 
50 } // namespace souffle::ram
souffle::ram::Program
RAM program relation declaration and functions.
Definition: Program.h:58
souffle::ram
Definition: AstToRamTranslator.h:54
souffle::ram::Statement::print
void print(std::ostream &os) const override
Print RAM node.
Definition: Statement.h:42
souffle::ram::Statement
Abstract class for RAM statements.
Definition: Statement.h:37
Node.h
souffle::ram::Statement::clone
Statement * clone() const override=0
Create a clone (i.e.