souffle
2.0.2-371-g6315b36
ram
Call.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 Call.h
12
*
13
***********************************************************************/
14
15
#pragma once
16
17
#include "
ram/Node.h
"
18
#include "
ram/Statement.h
"
19
#include "
souffle/utility/StreamUtil.h
"
20
#include <ostream>
21
#include <string>
22
#include <utility>
23
24
namespace
souffle::ram
{
25
26
/**
27
* @class Call
28
* @brief Call a subroutine
29
*
30
* Calls a subroutine
31
*
32
* The following example shows how subroutine A is invoked
33
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~
34
* CALL A
35
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~
36
*/
37
38
class
Call :
public
Statement {
39
public
:
40
Call
(std::string
name
) :
name
(
std
::move(
name
)) {}
41
42
/** @brief Get call name */
43
const
std::string&
getName
()
const
{
44
return
name
;
45
}
46
47
Call
*
clone
()
const override
{
48
return
new
Call
(
name
);
49
}
50
51
protected
:
52
void
print
(std::ostream& os,
int
tabpos)
const override
{
53
os <<
times
(
" "
, tabpos) <<
"CALL "
<<
name
<< std::endl;
54
}
55
56
bool
equal
(
const
Node
& node)
const override
{
57
const
auto
& other =
static_cast<
const
Call
&
>
(node);
58
return
name
== other.name;
59
}
60
61
/** Name of subroutine */
62
const
std::string
name
;
63
};
64
65
}
// namespace souffle::ram
souffle::ram::Call::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition:
Call.h:56
souffle::ram::Call
Call a subroutine.
Definition:
Call.h:42
souffle::ram
Definition:
AstToRamTranslator.h:54
souffle::ram::Node
Node is a superclass for all RAM IR classes.
Definition:
Node.h:42
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::Call::name
const std::string name
Name of subroutine.
Definition:
Call.h:66
Node.h
std
Definition:
Brie.h:3053
souffle::ram::Call::getName
const std::string & getName() const
Get call name.
Definition:
Call.h:47
souffle::ram::Call::equal
bool equal(const Node &node) const override
Equality check for two RAM nodes.
Definition:
Call.h:60
StreamUtil.h
Statement.h
souffle::ram::Call::clone
Call * clone() const override
Create a clone (i.e.
Definition:
Call.h:51
souffle::ram::Call::Call
Call(std::string name)
Definition:
Call.h:44
Generated by
1.8.17