souffle  2.0.2-371-g6315b36
Scan.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 Scan.h
12  *
13  ***********************************************************************/
14 
15 #pragma once
16 
17 #include "ram/Operation.h"
18 #include "ram/Relation.h"
19 #include "ram/RelationOperation.h"
22 #include <iosfwd>
23 #include <memory>
24 #include <ostream>
25 #include <string>
26 #include <utility>
27 
28 namespace souffle::ram {
29 
30 /**
31  * @class Scan
32  * @brief Iterate all tuples of a relation
33  *
34  * The following example iterates over all tuples
35  * in the set A:
36  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~
37  * QUERY
38  * ...
39  * FOR t0 IN A
40  * ...
41  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~
42  */
43 class Scan : public RelationOperation {
44 public:
45  Scan(std::string rel, int ident, Own<Operation> nested, std::string profileText = "")
46  : RelationOperation(rel, ident, std::move(nested), std::move(profileText)) {}
47 
48  Scan* clone() const override {
50  }
51 
52 protected:
53  void print(std::ostream& os, int tabpos) const override {
54  os << times(" ", tabpos);
55  os << "FOR t" << getTupleId();
56  os << " IN " << relation << std::endl;
57  RelationOperation::print(os, tabpos + 1);
58  }
59 };
60 
61 } // namespace souffle::ram
souffle::ram::NestedOperation::profileText
const std::string profileText
Text used by the profiler.
Definition: NestedOperation.h:93
souffle::ram::Scan::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: Scan.h:57
souffle::ram::RelationOperation::RelationOperation
RelationOperation(std::string rel, int ident, Own< Operation > nested, std::string profileText="")
Definition: RelationOperation.h:43
souffle::ram::NestedOperation::getOperation
Operation & getOperation() const
Get nested operation.
Definition: NestedOperation.h:62
MiscUtil.h
RelationOperation.h
souffle::ram
Definition: AstToRamTranslator.h:54
souffle::ram::Scan::Scan
Scan(std::string rel, int ident, Own< Operation > nested, std::string profileText="")
Definition: Scan.h:49
souffle::ram::RelationOperation::relation
const std::string relation
Search relation.
Definition: RelationOperation.h:60
souffle::clone
auto clone(const std::vector< A * > &xs)
Definition: ContainerUtil.h:172
souffle::times
detail::multiplying_printer< T > times(const T &value, unsigned num)
A utility printing a given value multiple times.
Definition: StreamUtil.h:322
souffle::ram::NestedOperation::getProfileText
const std::string & getProfileText() const
Get profile text.
Definition: NestedOperation.h:67
Relation.h
souffle::ram::TupleOperation::getTupleId
int getTupleId() const
Get identifier.
Definition: TupleOperation.h:43
souffle::ram::Scan
Iterate all tuples of a relation.
Definition: Scan.h:47
std
Definition: Brie.h:3053
Operation.h
StreamUtil.h
souffle::ram::Scan::clone
Scan * clone() const override
Create a clone (i.e.
Definition: Scan.h:52
rel
void rel(size_t limit, bool showLimit=true)
Definition: Tui.h:1086
souffle::ram::NestedOperation::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: NestedOperation.h:80