souffle  2.0.2-371-g6315b36
Clear.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 Clear.h
12  *
13  * Defines abstract class Statement and sub-classes for implementing the
14  * Relational Algebra Machine (RAM), which is an abstract machine.
15  *
16  ***********************************************************************/
17 
18 #pragma once
19 
20 #include "ram/Relation.h"
21 #include "ram/RelationStatement.h"
24 #include <memory>
25 #include <ostream>
26 #include <string>
27 #include <utility>
28 
29 namespace souffle::ram {
30 
31 /**
32  * @class Clear
33  * @brief Delete tuples of a relation
34  *
35  * This retains the target relation, but cleans its content
36  *
37  * For example:
38  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~
39  * CLEAR A
40  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~
41  */
42 
43 class Clear : public RelationStatement {
44 public:
45  Clear(std::string rel) : RelationStatement(rel) {}
46 
47  Clear* clone() const override {
48  return new Clear(relation);
49  }
50 
51 protected:
52  void print(std::ostream& os, int tabpos) const override {
53  os << times(" ", tabpos);
54  os << "CLEAR " << relation << std::endl;
55  }
56 };
57 
58 } // namespace souffle::ram
RelationStatement.h
souffle::ram::RelationStatement::RelationStatement
RelationStatement(std::string rel)
Definition: RelationStatement.h:39
souffle::ram::RelationStatement::relation
std::string relation
Relation.
Definition: RelationStatement.h:54
MiscUtil.h
souffle::ram::Clear::clone
Clear * clone() const override
Create a clone (i.e.
Definition: Clear.h:54
souffle::ram
Definition: AstToRamTranslator.h:54
souffle::times
detail::multiplying_printer< T > times(const T &value, unsigned num)
A utility printing a given value multiple times.
Definition: StreamUtil.h:322
Relation.h
souffle::ram::Clear::Clear
Clear(std::string rel)
Definition: Clear.h:52
souffle::ram::Clear::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: Clear.h:59
StreamUtil.h
rel
void rel(size_t limit, bool showLimit=true)
Definition: Tui.h:1086