NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
procedurecommandline.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2018 Erik Haenel et al.
4
5 This program 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 This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19#include <string>
20
21#ifndef PROCEDURECOMMANDLINE_HPP
22#define PROCEDURECOMMANDLINE_HPP
23
24
25// This class contains a single procedure command line and
26// its corresponding byte code, if it is available. If the
27// current line is a procedure head line, then one may extract
28// the argument list and the flags directly
30{
31 private:
32 int nFlags;
33 int nType;
36 std::string sCommandLine;
37 std::string sArgumentList;
38
39 public:
40 enum Types
41 {
46 };
47
48 enum Flags
49 {
50 FLAG_NONE = 0x0,
53 FLAG_MASK = 0x4,
56 FLAG_EVENT = 0x20,
57 FLAG_MACRO = 0x40,
58 FLAG_TEST = 0x80
59 };
60
62 {
82 BYTECODE_ASSERT = 0x40000
83 };
84
86 {
91 };
92
93 // Possible constructors
96 ProcedureCommandLine(int _nFlags, int _nType, const std::string& _sCommandLine, const std::string& _sArgumentList = "")
97 : nFlags(_nFlags), nType(_nType), nByteCode(BYTECODE_NOT_PARSED), nInlinable(INLINING_UNKNOWN), sCommandLine(_sCommandLine), sArgumentList(_sArgumentList) {}
99 : nFlags(_procCommandLine.nFlags), nType(_procCommandLine.nType), nByteCode(_procCommandLine.nByteCode), nInlinable(_procCommandLine.nInlinable),
100 sCommandLine(_procCommandLine.sCommandLine), sArgumentList(_procCommandLine.sArgumentList) {}
101
102 // Get the command line
103 std::string getCommandLine() const
104 {
105 return sCommandLine;
106 }
107
108 // Get the argument list
109 std::string getArgumentList() const
110 {
111 return sArgumentList;
112 }
113
114 // Get the type of the current command line
115 int getType() const
116 {
117 return nType;
118 }
119
120 // Get the flags
121 int getFlags() const
122 {
123 return nFlags;
124 }
125
126 // Get the byte code
127 int getByteCode() const
128 {
129 return nByteCode;
130 }
131
132 // Set the byte code. This is reasonable only
133 // if set from the procedure element class
134 void setByteCode(int _nByteCode)
135 {
137 nByteCode = _nByteCode;
138 }
139
140 // Get the information on whether the
141 // (whole) procedure is inlinable
142 int isInlineable() const
143 {
144 if (nFlags & FLAG_INLINE)
145 return nInlinable;
146
147 return INLINING_IMPOSSIBLE;
148 }
149
150 // Declare the whole procedure as inlineable
151 void setInlineable(int inlineable)
152 {
153 // do not declare other lines than the
154 // procedure head
156 return;
157
158 if (inlineable && nFlags & FLAG_INLINE)
159 nInlinable = inlineable;
160 else
162 }
163};
164
165
166
167
168
169#endif // PROCEDURECOMMANDLINE_HPP
170
ProcedureCommandLine(int _nFlags, int _nType, const std::string &_sCommandLine, const std::string &_sArgumentList="")
ProcedureCommandLine(const ProcedureCommandLine &_procCommandLine)
void setByteCode(int _nByteCode)
std::string getCommandLine() const
std::string getArgumentList() const
void setInlineable(int inlineable)