souffle  2.0.2-371-g6315b36
ParallelScan.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2018, 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 ParallelScan.h
12  *
13  * Defines the Operation of a relational algebra query.
14  *
15  ***********************************************************************/
16 
17 #pragma once
18 
19 #include "ram/AbstractParallel.h"
20 #include "ram/Operation.h"
21 #include "ram/Relation.h"
22 #include "ram/RelationOperation.h"
23 #include "ram/Scan.h"
26 #include <iosfwd>
27 #include <memory>
28 #include <ostream>
29 #include <string>
30 #include <utility>
31 
32 namespace souffle::ram {
33 
34 /**
35  * @class ParallelScan
36  * @brief Iterate all tuples of a relation in parallel
37  *
38  * An example:
39  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~
40  * QUERY
41  * ...
42  * PARALLEL FOR t0 IN A
43  * ...
44  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~
45  */
46 class ParallelScan : public Scan, public AbstractParallel {
47 public:
48  ParallelScan(std::string rel, int ident, Own<Operation> nested, std::string profileText = "")
49  : Scan(rel, ident, std::move(nested), profileText) {}
50 
51  ParallelScan* clone() const override {
53  }
54 
55 protected:
56  void print(std::ostream& os, int tabpos) const override {
57  os << times(" ", tabpos);
58  os << "PARALLEL FOR t" << getTupleId();
59  os << " IN " << relation << std::endl;
60  RelationOperation::print(os, tabpos + 1);
61  }
62 };
63 } // namespace souffle::ram
souffle::ram::NestedOperation::profileText
const std::string profileText
Text used by the profiler.
Definition: NestedOperation.h:93
souffle::ram::ParallelScan::clone
ParallelScan * clone() const override
Create a clone (i.e.
Definition: ParallelScan.h:57
Scan.h
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::ParallelScan::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: ParallelScan.h:62
AbstractParallel.h
std
Definition: Brie.h:3053
Operation.h
StreamUtil.h
rel
void rel(size_t limit, bool showLimit=true)
Definition: Tui.h:1086
souffle::ram::ParallelScan::ParallelScan
ParallelScan(std::string rel, int ident, Own< Operation > nested, std::string profileText="")
Definition: ParallelScan.h:54
souffle::ram::NestedOperation::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: NestedOperation.h:80