souffle  2.0.2-371-g6315b36
RelationOperation.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 RelationOperation.h
12  *
13  ***********************************************************************/
14 
15 #pragma once
16 
17 #include "ram/Node.h"
18 #include "ram/Operation.h"
19 #include "ram/Relation.h"
20 #include "ram/TupleOperation.h"
21 #include "ram/utility/NodeMapper.h"
23 #include <cassert>
24 #include <memory>
25 #include <string>
26 #include <utility>
27 #include <vector>
28 
29 namespace souffle::ram {
30 
31 /**
32  * @class RelationOperation
33  * @brief Abstract class for operations on relations
34  *
35  * One such operation is a for loop
36  */
37 class RelationOperation : public TupleOperation {
38 public:
39  RelationOperation(std::string rel, int ident, Own<Operation> nested, std::string profileText = "")
40  : TupleOperation(ident, std::move(nested), std::move(profileText)), relation(std::move(rel)) {}
41 
42  RelationOperation* clone() const override = 0;
43 
44  /** @brief Get search relation */
45  const std::string& getRelation() const {
46  return relation;
47  }
48 
49 protected:
50  bool equal(const Node& node) const override {
51  const auto& other = static_cast<const RelationOperation&>(node);
52  return TupleOperation::equal(other) && relation == other.relation;
53  }
54 
55  /** Search relation */
56  const std::string relation;
57 };
58 
59 } // namespace souffle::ram
souffle::ram::NestedOperation::profileText
const std::string profileText
Text used by the profiler.
Definition: NestedOperation.h:93
souffle::ram::TupleOperation::TupleOperation
TupleOperation(int ident, Own< Operation > nested, std::string profileText="")
Definition: TupleOperation.h:37
souffle::ram::RelationOperation::RelationOperation
RelationOperation(std::string rel, int ident, Own< Operation > nested, std::string profileText="")
Definition: RelationOperation.h:43
souffle::ram::TupleOperation::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: TupleOperation.h:57
souffle::ram::RelationOperation::getRelation
const std::string & getRelation() const
Get search relation.
Definition: RelationOperation.h:49
TupleOperation.h
souffle::ram
Definition: AstToRamTranslator.h:54
souffle::ram::RelationOperation::relation
const std::string relation
Search relation.
Definition: RelationOperation.h:60
souffle::ram::Node
Node is a superclass for all RAM IR classes.
Definition: Node.h:42
NodeMapper.h
ContainerUtil.h
Relation.h
souffle::ram::RelationOperation::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: RelationOperation.h:54
souffle::ram::RelationOperation
Abstract class for operations on relations.
Definition: RelationOperation.h:41
souffle::ram::RelationOperation::clone
RelationOperation * clone() const override=0
Create a clone (i.e.
Node.h
std
Definition: Brie.h:3053
Operation.h
rel
void rel(size_t limit, bool showLimit=true)
Definition: Tui.h:1086