MicroModelicaCCompiler  4.5.3
generator.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 <fstream>
23 #include <iostream>
24 #include <list>
25 #include <map>
26 #include <string>
27 
28 #include <ir/class.hpp>
29 #include <ir/stored_definition.hpp>
31 #include <generator/files.hpp>
32 #include <generator/writer.hpp>
33 #include <util/compile_flags.hpp>
34 
35 namespace MicroModelica {
36 namespace Generator {
37 
38 class Generator {
39  public:
40  Generator(const IR::StoredDefinition& std, const Util::CompileFlags& flags);
41  ~Generator() = default;
42  int generate();
43 
44  private:
45  void generateIncludes(const string& name);
46  void calledFunctionHeader(const string& file_name);
47  IR::StoredDefinition _std;
48  IR::Function _function;
49  IR::Package _package;
50  Util::CompileFlags _flags;
53  ofstream _file;
54  std::map<string, string> _includes;
55  list<string> _fheader;
56 };
57 } // namespace Generator
58 } // namespace MicroModelica
MicroModelica::Generator::Generator::_writer
WriterPtr _writer
Definition: generator.hpp:103
MicroModelica::Generator::Generator::_model_instance
ModelInstancePtr _model_instance
Definition: generator.hpp:102
MicroModelica::Generator::Generator::calledFunctionHeader
void calledFunctionHeader(const string &file_name)
Definition: generator.cpp:132
MicroModelica::Generator::Generator::_fheader
list< string > _fheader
Definition: generator.hpp:106
writer.hpp
MicroModelica::Generator::Generator::generate
int generate()
Definition: generator.cpp:66
MicroModelica::Generator::Generator::generateIncludes
void generateIncludes(const string &name)
Definition: generator.cpp:123
files.hpp
MicroModelica::Generator::Generator::_function
IR::Function _function
Definition: generator.hpp:99
MicroModelica::Generator::Generator::_file
ofstream _file
Definition: generator.hpp:104
compile_flags.hpp
MicroModelica::Generator::Generator::_flags
Util::CompileFlags _flags
Definition: generator.hpp:101
MicroModelica::Generator::Generator::_includes
std::map< string, string > _includes
Definition: generator.hpp:105
MicroModelica::Generator::Generator::Generator
Generator(const IR::StoredDefinition &std, const Util::CompileFlags &flags)
Definition: generator.cpp:56
MicroModelica::Generator::Generator::_std
IR::StoredDefinition _std
Definition: generator.hpp:98
model_instance.hpp
MicroModelica
Definition: files.cpp:45
stored_definition.hpp
MicroModelica::Generator::Generator::_package
IR::Package _package
Definition: generator.hpp:100
MicroModelica::Generator::Generator::~Generator
~Generator()=default
MicroModelica::Generator::WriterPtr
std::shared_ptr< Writer > WriterPtr
Definition: writer.hpp:146
class.hpp
MicroModelica::Generator::ModelInstancePtr
std::shared_ptr< ModelInstance > ModelInstancePtr
Definition: model_instance.hpp:197