1 /**********************************************************************
3 FILENAME: uiuc_menu_mass.cpp
5 ----------------------------------------------------------------------
7 DESCRIPTION: reads input data for specified aircraft and creates
8 approporiate data storage space
10 ----------------------------------------------------------------------
14 ----------------------------------------------------------------------
16 REFERENCES: based on "menu reader" format of Michael Selig
18 ----------------------------------------------------------------------
20 HISTORY: 04/04/2003 initial release
21 06/30/2003 (RD) replaced istrstream with istringstream
22 to get rid of the annoying warning about
23 using the strstream header
25 ----------------------------------------------------------------------
27 AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
28 Michael Selig <m-selig@uiuc.edu>
30 ----------------------------------------------------------------------
34 ----------------------------------------------------------------------
38 ----------------------------------------------------------------------
42 ----------------------------------------------------------------------
44 CALLED BY: uiuc_menu()
46 ----------------------------------------------------------------------
48 CALLS TO: check_float() if needed
54 ----------------------------------------------------------------------
56 COPYRIGHT: (C) 2003 by Michael Selig
58 This program is free software; you can redistribute it and/or
59 modify it under the terms of the GNU General Public License
60 as published by the Free Software Foundation.
62 This program is distributed in the hope that it will be useful,
63 but WITHOUT ANY WARRANTY; without even the implied warranty of
64 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
65 GNU General Public License for more details.
67 You should have received a copy of the GNU General Public License
68 along with this program; if not, write to the Free Software
69 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
71 **********************************************************************/
73 #include <simgear/compiler.h>
80 #include "uiuc_menu_mass.h"
90 void parse_mass( const string& linetoken2, const string& linetoken3,
91 const string& linetoken4, const string& linetoken5,
92 const string& linetoken6, const string& linetoken7,
93 const string& linetoken8, const string& linetoken9,
94 const string& linetoken10, const string& aircraft_directory,
97 istringstream token3(linetoken3.c_str());
98 istringstream token4(linetoken4.c_str());
99 istringstream token5(linetoken5.c_str());
100 istringstream token6(linetoken6.c_str());
101 istringstream token7(linetoken7.c_str());
102 istringstream token8(linetoken8.c_str());
103 istringstream token9(linetoken9.c_str());
104 istringstream token10(linetoken10.c_str());
106 switch(mass_map[linetoken2])
110 if (check_float(linetoken3))
111 token3 >> token_value;
113 uiuc_warnings_errors(1, *command_line);
115 Weight = token_value;
116 Mass = Weight * INVG;
117 massParts -> storeCommands (*command_line);
122 if (check_float(linetoken3))
123 token3 >> token_value;
125 uiuc_warnings_errors(1, *command_line);
128 massParts -> storeCommands (*command_line);
133 if (check_float(linetoken3))
134 token3 >> token_value;
136 uiuc_warnings_errors(1, *command_line);
139 massParts -> storeCommands (*command_line);
144 if (check_float(linetoken3))
145 token3 >> token_value;
147 uiuc_warnings_errors(1, *command_line);
150 massParts -> storeCommands (*command_line);
155 if (check_float(linetoken3))
156 token3 >> token_value;
158 uiuc_warnings_errors(1, *command_line);
161 massParts -> storeCommands (*command_line);
166 if (check_float(linetoken3))
167 token3 >> token_value;
169 uiuc_warnings_errors(1, *command_line);
172 massParts -> storeCommands (*command_line);
175 case Mass_appMass_ratio_flag:
177 if (check_float(linetoken3))
178 token3 >> token_value;
180 uiuc_warnings_errors(1, *command_line);
182 Mass_appMass_ratio = token_value;
183 massParts -> storeCommands (*command_line);
186 case I_xx_appMass_ratio_flag:
188 if (check_float(linetoken3))
189 token3 >> token_value;
191 uiuc_warnings_errors(1, *command_line);
193 I_xx_appMass_ratio = token_value;
194 massParts -> storeCommands (*command_line);
197 case I_yy_appMass_ratio_flag:
199 if (check_float(linetoken3))
200 token3 >> token_value;
202 uiuc_warnings_errors(1, *command_line);
204 I_yy_appMass_ratio = token_value;
205 massParts -> storeCommands (*command_line);
208 case I_zz_appMass_ratio_flag:
210 if (check_float(linetoken3))
211 token3 >> token_value;
213 uiuc_warnings_errors(1, *command_line);
215 I_zz_appMass_ratio = token_value;
216 massParts -> storeCommands (*command_line);
219 case Mass_appMass_flag:
221 if (check_float(linetoken3))
222 token3 >> token_value;
224 uiuc_warnings_errors(1, *command_line);
226 Mass_appMass = token_value;
227 massParts -> storeCommands (*command_line);
230 case I_xx_appMass_flag:
232 if (check_float(linetoken3))
233 token3 >> token_value;
235 uiuc_warnings_errors(1, *command_line);
237 I_xx_appMass = token_value;
238 massParts -> storeCommands (*command_line);
241 case I_yy_appMass_flag:
243 if (check_float(linetoken3))
244 token3 >> token_value;
246 uiuc_warnings_errors(1, *command_line);
248 I_yy_appMass = token_value;
249 massParts -> storeCommands (*command_line);
252 case I_zz_appMass_flag:
254 if (check_float(linetoken3))
255 token3 >> token_value;
257 uiuc_warnings_errors(1, *command_line);
259 I_zz_appMass = token_value;
260 massParts -> storeCommands (*command_line);
265 if (ignore_unknown_keywords) {
268 // print error message
269 uiuc_warnings_errors(2, *command_line);