MicroModelicaCCompiler  4.5.3
function.hpp
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  This file is part of QSS Solver.
4 
5  QSS Solver is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  QSS Solver is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QSS Solver. If not, see <http://www.gnu.org/licenses/>.
17 
18  ******************************************************************************/
19 
20 #pragma once
21 
22 #include <boost/variant/variant.hpp>
23 
24 #include <generator/writer.hpp>
25 #include <ir/class.hpp>
26 #include <util/compile_flags.hpp>
27 #include <util/util.hpp>
28 
29 namespace MicroModelica {
30 namespace Generator {
31 class Function {
32  public:
33  Function(IR::Function& function, Util::CompileFlags& flags, WriterPtr writer);
34  ~Function();
35  void definition();
36  std::string header();
37  void setPrefix(std::string prefix);
38  void addInclude(std::string include);
40 
41  private:
42  void includes();
43  void body();
44  void localSymbols();
45  std::string prototype();
46  IR::Function _function;
47  Util::CompileFlags _flags;
49  std::string _prefix;
51  std::string _return_variable;
52  Util::VarSymbolTable _symbols;
53  bool _void_function;
54 };
55 } // namespace Generator
56 } // namespace MicroModelica
MicroModelica::Generator::Function::_prefix
std::string _prefix
Definition: function.hpp:100
MicroModelica::Generator::Function::_return_variable
std::string _return_variable
Definition: function.hpp:102
MicroModelica::Generator::Function::addInclude
void addInclude(std::string include)
MicroModelica::Generator::Function::_flags
Util::CompileFlags _flags
Definition: function.hpp:98
MicroModelica::Generator::Function::definition
void definition()
Definition: function.cpp:63
MicroModelica::Generator::Function::prototype
std::string prototype()
Definition: function.cpp:90
MicroModelica::Generator::Function::includes
void includes()
Definition: function.cpp:69
writer.hpp
MicroModelica::Generator::Function::Function
Function(IR::Function &function, Util::CompileFlags &flags, WriterPtr writer)
Definition: function.cpp:47
MicroModelica::Generator::Function::_include
Util::SymbolTable _include
Definition: function.hpp:101
MicroModelica::Util::SymbolTable
ModelTable< std::string, std::string > SymbolTable
Definition: equation.hpp:62
MicroModelica::Generator::Function::~Function
~Function()
Definition: function.cpp:56
MicroModelica::Generator::Function::_writer
WriterPtr _writer
Definition: function.hpp:99
MicroModelica::Generator::Function::header
std::string header()
Definition: function.cpp:131
MicroModelica::Generator::Function::_function
IR::Function _function
Definition: function.hpp:97
MicroModelica::Generator::Function::setPrefix
void setPrefix(std::string prefix)
Definition: function.cpp:183
MicroModelica::Generator::Function::_symbols
Util::VarSymbolTable _symbols
Definition: function.hpp:103
compile_flags.hpp
MicroModelica
Definition: files.cpp:45
MicroModelica::Generator::Function::_void_function
bool _void_function
Definition: function.hpp:104
MicroModelica::Generator::Function::localSymbols
void localSymbols()
Definition: function.cpp:158
MicroModelica::Generator::WriterPtr
std::shared_ptr< Writer > WriterPtr
Definition: writer.hpp:146
class.hpp
MicroModelica::Generator::Function::body
void body()
Definition: function.cpp:133
util.hpp