MicroModelicaCCompiler  4.5.3
compile_flags.cpp
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 #include "compile_flags.hpp"
21 
22 #include <utility>
23 
24 #include "util.hpp"
25 
26 namespace MicroModelica {
27 namespace Util {
28 
30  : _store(true),
31  _externalStructureFiles(false),
32  _output(true),
33  _debug(0),
34  _outputFile(),
35  _path(),
36  _libraryPaths(),
37  _objects(),
38  _incidenceMatrices(false),
39  _externalFunctions(false),
40  _lps(0),
41  _debugOptions()
42 {
43  _debugOptions["SD_DBG_VarChanges"] = 1 << 0;
44  _debugOptions["SD_DBG_InitValues"] = 1 << 1;
45  _debugOptions["SD_DBG_StepInfo"] = 1 << 2;
46  _debugOptions["SD_DBG_Weights"] = 1 << 3;
47  _debugOptions["SD_DBG_Memory"] = 1 << 4;
48  _debugOptions["SD_DBG_ExternalEvent"] = 1 << 5;
49  _debugOptions["SD_DBG_Synchronize"] = 1 << 6;
50  _debugOptions["SD_DBG_WaitFor"] = 1 << 7;
51  _debugOptions["SD_DBG_Dt"] = 1 << 8;
52 }
53 
54 bool CompileFlags::store() { return _store; }
55 
56 void CompileFlags::setStore(bool s) { _store = s; }
57 
58 void CompileFlags::setIncidenceMatrices(bool im) { _incidenceMatrices = im; }
59 
60 bool CompileFlags::incidenceMatrices() { return _incidenceMatrices; }
61 
62 bool CompileFlags::output() { return _output; }
63 
64 void CompileFlags::setOutput(bool s) { _output = s; }
65 
66 bool CompileFlags::externalFunctions() { return _externalFunctions; }
67 
68 void CompileFlags::setExternalFunctions(bool s) { _externalFunctions = s; }
69 
70 int CompileFlags::debug() { return _debug; }
71 
72 void CompileFlags::setDebug(int s) { _debug |= s; }
73 
74 void CompileFlags::setOutputFile(string outputFile) { _outputFile = outputFile; }
75 
76 string CompileFlags::outputFileName() { return Utils::instance().getFileName(_outputFile); }
77 
78 string CompileFlags::outputFilePath() { return Utils::instance().getFilePath(_outputFile); }
79 
80 string CompileFlags::outputFile() { return _outputFile; }
81 
82 bool CompileFlags::hasOutputFile() { return !_outputFile.empty(); }
83 
84 void CompileFlags::setPath(string p) { _path = p; }
85 
86 string CompileFlags::path() { return _path; }
87 
88 list<string> CompileFlags::libraryPaths() { return _libraryPaths; }
89 
90 void CompileFlags::addLibraryPath(string l) { _libraryPaths.push_back(l); }
91 
92 void CompileFlags::addObject(string o) { _objects.insert(pair<string, string>(o, o)); }
93 
94 list<string> CompileFlags::objects()
95 {
96  list<string> ret;
97  for (map<string, string>::iterator it = _objects.begin(); it != _objects.end(); it++) {
98  ret.push_back(it->second);
99  }
100  return ret;
101 }
102 
103 bool CompileFlags::hasObjects() { return !_objects.empty(); }
104 
105 bool CompileFlags::externalStructureFile() { return _externalStructureFiles; }
106 
107 void CompileFlags::setExternalStructureFile(bool s) { _externalStructureFiles = s; }
108 
109 void CompileFlags::setDebug(string s)
110 {
111  if (_debugOptions.find(s) != _debugOptions.end()) {
112  _debug |= _debugOptions[s];
113  if (!s.compare("SD_DBG_Weights")) {
114  _debug |= _debugOptions["SD_DBG_VarChanges"];
115  }
116  }
117 }
118 
119 void CompileFlags::setTesting(bool testing) { _testing = testing; }
120 
121 bool CompileFlags::testing() { return _testing; }
122 
123 } // namespace Util
124 } // namespace MicroModelica
compile_flags.hpp
MicroModelica
Definition: files.cpp:45
util.hpp
MicroModelica::Util::CompileFlags::CompileFlags
CompileFlags()
Definition: compile_flags.cpp:63