souffle  2.0.2-371-g6315b36
BinRelationStatement.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 BinRelationStatement.h
12  *
13  ***********************************************************************/
14 
15 #pragma once
16 
17 #include "ram/Node.h"
18 #include "ram/Relation.h"
19 #include "ram/Statement.h"
20 #include "ram/utility/NodeMapper.h"
22 #include <cassert>
23 #include <cstddef>
24 #include <memory>
25 #include <string>
26 #include <utility>
27 #include <vector>
28 
29 namespace souffle::ram {
30 
31 /**
32  * @class BinRelationStatement
33  * @brief Abstract class for a binary relation
34  *
35  * Comprises two Relations
36  */
37 class BinRelationStatement : public Statement {
38 public:
39  BinRelationStatement(std::string f, std::string s) : first(std::move(f)), second(std::move(s)) {}
40 
41  /** @brief Get first relation */
42  const std::string& getFirstRelation() const {
43  return first;
44  }
45 
46  /** @brief Get second relation */
47  const std::string& getSecondRelation() const {
48  return second;
49  }
50 
51 protected:
52  bool equal(const Node& node) const override {
53  const auto& other = static_cast<const BinRelationStatement&>(node);
54  return first == other.first && second == other.second;
55  }
56 
57 protected:
58  /** First relation */
59  const std::string first;
60 
61  /** Second relation */
62  const std::string second;
63 };
64 
65 } // namespace souffle::ram
souffle::ram
Definition: AstToRamTranslator.h:54
souffle::ram::Node
Node is a superclass for all RAM IR classes.
Definition: Node.h:42
NodeMapper.h
ContainerUtil.h
souffle::ram::BinRelationStatement::first
const std::string first
First relation.
Definition: BinRelationStatement.h:63
souffle::ram::BinRelationStatement::BinRelationStatement
BinRelationStatement(std::string f, std::string s)
Definition: BinRelationStatement.h:43
Relation.h
souffle::ram::BinRelationStatement::getSecondRelation
const std::string & getSecondRelation() const
Get second relation.
Definition: BinRelationStatement.h:51
souffle::ram::BinRelationStatement::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition: BinRelationStatement.h:56
souffle::ram::BinRelationStatement
Abstract class for a binary relation.
Definition: BinRelationStatement.h:41
Node.h
std
Definition: Brie.h:3053
Statement.h
souffle::ram::BinRelationStatement::getFirstRelation
const std::string & getFirstRelation() const
Get first relation.
Definition: BinRelationStatement.h:46
souffle::ram::BinRelationStatement::second
const std::string second
Second relation.
Definition: BinRelationStatement.h:66