souffle  2.0.2-371-g6315b36
TupleOperation.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 TupleOperation.h
12  *
13  ***********************************************************************/
14 
15 #pragma once
16 
17 #include "ram/NestedOperation.h"
18 #include "ram/Node.h"
19 #include "ram/Operation.h"
20 #include <memory>
21 #include <string>
22 #include <utility>
23 #include <vector>
24 
25 namespace souffle::ram {
26 
27 /**
28  * @class TupleOperation
29  * @brief Abstract class for relation searches and lookups
30  */
31 class TupleOperation : public NestedOperation {
32 public:
33  TupleOperation(int ident, Own<Operation> nested, std::string profileText = "")
34  : NestedOperation(std::move(nested), std::move(profileText)), identifier(ident) {}
35 
36  TupleOperation* clone() const override = 0;
37 
38  /** @brief Get identifier */
39  int getTupleId() const {
40  return identifier;
41  }
42 
43  /** @brief Set identifier */
44  void setTupleId(int id) {
45  identifier = id;
46  }
47 
48  std::vector<const Node*> getChildNodes() const override {
50  }
51 
52 protected:
53  bool equal(const Node& node) const override {
54  const auto& other = static_cast<const TupleOperation&>(node);
55  return NestedOperation::equal(other) && identifier == other.identifier;
56  }
57 
58  /**
59  * Identifier for the tuple, corresponding to
60  * its position in the loop nest
61  */
62  int identifier;
63 };
64 
65 } // namespace souffle::ram
souffle::ram::NestedOperation::profileText
const std::string profileText
Text used by the profiler.
Definition: NestedOperation.h:93
NestedOperation.h
souffle::ram::NestedOperation::NestedOperation
NestedOperation(Own< Operation > nested, std::string profileText="")
Definition: NestedOperation.h:54
souffle::ram::TupleOperation::getChildNodes
std::vector< const Node * > getChildNodes() const override
Obtain list of all embedded child nodes.
Definition: TupleOperation.h:52
souffle::ram::TupleOperation::TupleOperation
TupleOperation(int ident, Own< Operation > nested, std::string profileText="")
Definition: TupleOperation.h:37
souffle::ram::TupleOperation::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: TupleOperation.h:57
souffle::ram
Definition: AstToRamTranslator.h:54
souffle::ram::Node
Node is a superclass for all RAM IR classes.
Definition: Node.h:42
souffle::ram::TupleOperation::clone
TupleOperation * clone() const override=0
Create a clone (i.e.
souffle::ram::NestedOperation::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: NestedOperation.h:84
souffle::ram::TupleOperation::getTupleId
int getTupleId() const
Get identifier.
Definition: TupleOperation.h:43
souffle::ram::TupleOperation
Abstract class for relation searches and lookups.
Definition: TupleOperation.h:35
souffle::ram::TupleOperation::identifier
int identifier
Identifier for the tuple, corresponding to its position in the loop nest.
Definition: TupleOperation.h:66
Node.h
std
Definition: Brie.h:3053
Operation.h
souffle::ram::TupleOperation::setTupleId
void setTupleId(int id)
Set identifier.
Definition: TupleOperation.h:48
id
void id(std::string col)
Definition: Tui.h:1124
souffle::ram::NestedOperation::getChildNodes
std::vector< const Node * > getChildNodes() const override
Obtain list of all embedded child nodes.
Definition: NestedOperation.h:71