souffle  2.0.2-371-g6315b36
Relation.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2020, The Souffle Developers. 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 Relation.h
12  *
13  * Analysis that looks up a relation by name.
14  *
15  ***********************************************************************/
16 
17 #pragma once
18 
19 #include "ram/Node.h"
20 #include "ram/TranslationUnit.h"
21 #include "ram/analysis/Analysis.h"
22 
23 namespace souffle::ram::analysis {
24 
25 /**
26  * @class RelationAnalysis
27  * @brief A RAM Analysis for finding relations by name
28  *
29  */
30 class RelationAnalysis : public Analysis {
31 public:
32  RelationAnalysis(const char* id) : Analysis(id) {}
33 
34  static constexpr const char* name = "relation-analysis";
35 
36  void run(const TranslationUnit&) override;
37 
38  const ram::Relation& lookup(const std::string& name) const;
39 
40 protected:
41  std::map<std::string, const ram::Relation*> relationMap;
42 };
43 
44 } // namespace souffle::ram::analysis
souffle::ram::analysis
Definition: Analysis.h:32
souffle::ram::analysis::RelationAnalysis::name
static constexpr const char * name
Definition: Relation.h:40
souffle::ram::TranslationUnit
Translating a RAM program.
Definition: TranslationUnit.h:55
souffle::ram::Relation
An abstract class for performing indexed operations.
Definition: Relation.h:40
souffle::ram::analysis::RelationAnalysis::run
void run(const TranslationUnit &) override
Run analysis for a RAM translation unit.
Definition: Relation.cpp:39
Analysis.h
TranslationUnit.h
souffle::ram::analysis::Analysis::Analysis
Analysis(const char *id)
Definition: Analysis.h:40
souffle::ram::analysis::RelationAnalysis::RelationAnalysis
RelationAnalysis(const char *id)
Definition: Relation.h:38
Node.h
souffle::ram::analysis::RelationAnalysis::relationMap
std::map< std::string, const ram::Relation * > relationMap
Definition: Relation.h:47
souffle::ram::analysis::RelationAnalysis::lookup
const ram::Relation & lookup(const std::string &name) const
Definition: Relation.cpp:33
id
void id(std::string col)
Definition: Tui.h:1124