]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/input_output/FGXMLElement.cpp
mingw fix
[flightgear.git] / src / FDM / JSBSim / input_output / FGXMLElement.cpp
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Author:       Jon Berndt
4  Date started: 09/28/2004
5  Purpose:      XML element class
6  Called by:    FGXMLParse
7
8  ------------- Copyright (C) 2001  Jon S. Berndt (jon@jsbsim.org) -------------
9
10  This program is free software; you can redistribute it and/or modify it under
11  the terms of the GNU Lesser General Public License as published by the Free Software
12  Foundation; either version 2 of the License, or (at your option) any later
13  version.
14
15  This program is distributed in the hope that it will be useful, but WITHOUT
16  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
18  details.
19
20  You should have received a copy of the GNU Lesser General Public License along with
21  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22  Place - Suite 330, Boston, MA  02111-1307, USA.
23
24  Further information about the GNU Lesser General Public License can also be found on
25  the world wide web at http://www.gnu.org.
26
27 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28 INCLUDES
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
30
31 #include "FGXMLElement.h"
32
33 #include <cmath>
34 #include <cstdlib>
35 #include <iostream>
36
37 using namespace std;
38
39 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 FORWARD DECLARATIONS
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42
43 namespace JSBSim {
44
45 static const char *IdSrc = "$Id$";
46 static const char *IdHdr = ID_XMLELEMENT;
47
48 bool Element::converterIsInitialized = false;
49 map <string, map <string, double> > Element::convert;
50
51 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 CLASS IMPLEMENTATION
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54
55 Element::Element(const string& nm)
56 {
57   name   = nm;
58   parent = 0L;
59   element_index = 0;
60
61   if (!converterIsInitialized) {
62     converterIsInitialized = true;
63     // convert ["from"]["to"] = factor, so: from * factor = to
64     // Length
65     convert["M"]["FT"] = 3.2808399;
66     convert["FT"]["M"] = 1.0/convert["M"]["FT"];
67     convert["FT"]["IN"] = 12.0;
68     convert["IN"]["FT"] = 1.0/convert["FT"]["IN"];
69     convert["IN"]["M"] = convert["IN"]["FT"] * convert["FT"]["M"];
70     convert["M"]["IN"] = convert["M"]["FT"] * convert["FT"]["IN"];
71     // Area
72     convert["M2"]["FT2"] = convert["M"]["FT"]*convert["M"]["FT"];
73     convert["FT2"]["M2"] = 1.0/convert["M2"]["FT2"];
74     convert["M2"]["IN2"] = convert["M"]["IN"]*convert["M"]["IN"];
75     convert["IN2"]["M2"] = 1.0/convert["M2"]["IN2"];
76     convert["FT2"]["IN2"] = 144.0;
77     convert["IN2"]["FT2"] = 1.0/convert["FT2"]["IN2"];
78     // Volume
79     convert["IN3"]["CC"] = 16.387064;
80     convert["CC"]["IN3"] = 1.0/convert["IN3"]["CC"];
81     convert["FT3"]["IN3"] = 1728.0;
82     convert["IN3"]["FT3"] = 1.0/convert["FT3"]["IN3"];
83     convert["M3"]["FT3"] = 35.3146667;
84     convert["FT3"]["M3"] = 1.0/convert["M3"]["FT3"];
85     convert["LTR"]["IN3"] = 61.0237441;
86     convert["IN3"]["LTR"] = 1.0/convert["LTR"]["IN3"];
87     // Mass & Weight
88     convert["LBS"]["KG"] = 0.45359237;
89     convert["KG"]["LBS"] = 1.0/convert["LBS"]["KG"];
90     convert["SLUG"]["KG"] = 14.59390;
91     convert["KG"]["SLUG"] = 1.0/convert["SLUG"]["KG"];
92     // Moments of Inertia
93     convert["SLUG*FT2"]["KG*M2"] = 1.35594;
94     convert["KG*M2"]["SLUG*FT2"] = 1.0/convert["SLUG*FT2"]["KG*M2"];
95     // Angles
96     convert["RAD"]["DEG"] = 360.0/(2.0*3.1415926);
97     convert["DEG"]["RAD"] = 1.0/convert["RAD"]["DEG"];
98     // Spring force
99     convert["LBS/FT"]["N/M"] = 14.5939;
100     convert["N/M"]["LBS/FT"] = 1.0/convert["LBS/FT"]["N/M"];
101     // Damping force
102     convert["LBS/FT/SEC"]["N/M/SEC"] = 14.5939;
103     convert["N/M/SEC"]["LBS/FT/SEC"] = 1.0/convert["LBS/FT/SEC"]["N/M/SEC"];
104     // Damping force (Square Law)
105     convert["LBS/FT2/SEC2"]["N/M2/SEC2"] = 47.880259;
106     convert["N/M2/SEC2"]["LBS/FT2/SEC2"] = 1.0/convert["LBS/FT2/SEC2"]["N/M2/SEC2"];
107     // Power
108     convert["WATTS"]["HP"] = 0.001341022;
109     convert["HP"]["WATTS"] = 1.0/convert["WATTS"]["HP"];
110     // Force
111     convert["N"]["LBS"] = 0.22482;
112     convert["LBS"]["N"] = 1.0/convert["N"]["LBS"];
113     // Velocity
114     convert["KTS"]["FT/SEC"] = 1.68781;
115     convert["FT/SEC"]["KTS"] = 1.0/convert["KTS"]["FT/SEC"];
116     convert["M/S"]["FT/S"] = 3.2808399;
117     convert["FT/S"]["M/S"] = 1.0/convert["M/S"]["FT/S"];
118     // Torque
119     convert["FT*LBS"]["N*M"] = 1.35581795;
120     convert["N*M"]["FT*LBS"] = 1/convert["FT*LBS"]["N*M"];
121     // Valve
122     convert["M4*SEC/KG"]["FT4*SEC/SLUG"] = convert["M"]["FT"]*convert["M"]["FT"]*
123       convert["M"]["FT"]*convert["M"]["FT"]/convert["KG"]["SLUG"];
124     convert["FT4*SEC/SLUG"]["M4*SEC/KG"] =
125       1.0/convert["M4*SEC/KG"]["FT4*SEC/SLUG"];
126     // Pressure
127     convert["INHG"]["PSF"] = 70.7180803;
128     convert["PSF"]["INHG"] = 1.0/convert["INHG"]["PSF"];
129     convert["ATM"]["INHG"] = 29.9246899;
130     convert["INHG"]["ATM"] = 1.0/convert["ATM"]["INHG"];
131     convert["PSI"]["INHG"] = 2.03625437;
132     convert["INHG"]["PSI"] = 1.0/convert["PSI"]["INHG"];
133     convert["INHG"]["PA"] = 3386.0; // inches Mercury to pascals
134     convert["PA"]["INHG"] = 1.0/convert["INHG"]["PA"];
135     convert["LBS/FT2"]["N/M2"] = 14.5939/convert["FT"]["M"];
136     convert["N/M2"]["LBS/FT2"] = 1.0/convert["LBS/FT2"]["N/M2"];
137     convert["LBS/FT2"]["PA"] = convert["LBS/FT2"]["N/M2"];
138     convert["PA"]["LBS/FT2"] = 1.0/convert["LBS/FT2"]["PA"];
139     // Mass flow
140     convert["KG/MIN"]["LBS/MIN"] = convert["KG"]["LBS"];
141     // Fuel Consumption
142     convert["LBS/HP*HR"]["KG/KW*HR"] = 0.6083;
143     convert["KG/KW*HR"]["LBS/HP*HR"] = 1.0/convert["LBS/HP*HR"]["KG/KW*HR"];
144     // Density
145     convert["KG/L"]["LBS/GAL"] = 8.3454045;
146     convert["LBS/GAL"]["KG/L"] = 1.0/convert["KG/L"]["LBS/GAL"];
147
148     // Length
149     convert["M"]["M"] = 1.00;
150     convert["FT"]["FT"] = 1.00;
151     convert["IN"]["IN"] = 1.00;
152     // Area
153     convert["M2"]["M2"] = 1.00;
154     convert["FT2"]["FT2"] = 1.00;
155     // Volume
156     convert["IN3"]["IN3"] = 1.00;
157     convert["CC"]["CC"] = 1.0;
158     convert["M3"]["M3"] = 1.0;
159     convert["FT3"]["FT3"] = 1.0;
160     convert["LTR"]["LTR"] = 1.0;
161     // Mass & Weight
162     convert["KG"]["KG"] = 1.00;
163     convert["LBS"]["LBS"] = 1.00;
164     // Moments of Inertia
165     convert["KG*M2"]["KG*M2"] = 1.00;
166     convert["SLUG*FT2"]["SLUG*FT2"] = 1.00;
167     // Angles
168     convert["DEG"]["DEG"] = 1.00;
169     convert["RAD"]["RAD"] = 1.00;
170     // Spring force
171     convert["LBS/FT"]["LBS/FT"] = 1.00;
172     convert["N/M"]["N/M"] = 1.00;
173     // Damping force
174     convert["LBS/FT/SEC"]["LBS/FT/SEC"] = 1.00;
175     convert["N/M/SEC"]["N/M/SEC"] = 1.00;
176     // Damping force (Square law)
177     convert["LBS/FT2/SEC2"]["LBS/FT2/SEC2"] = 1.00;
178     convert["N/M2/SEC2"]["N/M2/SEC2"] = 1.00;
179     // Power
180     convert["HP"]["HP"] = 1.00;
181     convert["WATTS"]["WATTS"] = 1.00;
182     // Force
183     convert["N"]["N"] = 1.00;
184     // Velocity
185     convert["FT/SEC"]["FT/SEC"] = 1.00;
186     convert["KTS"]["KTS"] = 1.00;
187     convert["M/S"]["M/S"] = 1.0;
188     // Torque
189     convert["FT*LBS"]["FT*LBS"] = 1.00;
190     convert["N*M"]["N*M"] = 1.00;
191     // Valve
192     convert["M4*SEC/KG"]["M4*SEC/KG"] = 1.0;
193     convert["FT4*SEC/SLUG"]["FT4*SEC/SLUG"] = 1.0;
194     // Pressure
195     convert["PSI"]["PSI"] = 1.00;
196     convert["PSF"]["PSF"] = 1.00;
197     convert["INHG"]["INHG"] = 1.00;
198     convert["ATM"]["ATM"] = 1.0;
199     convert["PA"]["PA"] = 1.0;
200     convert["N/M2"]["N/M2"] = 1.00;
201     convert["LBS/FT2"]["LBS/FT2"] = 1.00;
202     // Mass flow
203     convert["LBS/SEC"]["LBS/SEC"] = 1.00;
204     convert["KG/MIN"]["KG/MIN"] = 1.0;
205     convert["LBS/MIN"]["LBS/MIN"] = 1.0;
206     // Fuel Consumption
207     convert["LBS/HP*HR"]["LBS/HP*HR"] = 1.0;
208     convert["KG/KW*HR"]["KG/KW*HR"] = 1.0;
209     // Density
210     convert["KG/L"]["KG/L"] = 1.0;
211     convert["LBS/GAL"]["LBS/GAL"] = 1.0;
212   }
213 }
214
215 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
216
217 Element::~Element(void)
218 {
219   for (unsigned int i=0; i<children.size(); i++) delete children[i];
220   data_lines.clear();
221   attributes.clear();
222   attribute_key.clear();
223 }
224
225 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
226
227 string Element::GetAttributeValue(const string& attr)
228 {
229   int select=-1;
230   for (unsigned int i=0; i<attribute_key.size(); i++) {
231     if (attribute_key[i] == attr) select = i;
232   }
233   if (select < 0) return string("");
234   else return attributes[attr];
235 }
236
237 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238
239 double Element::GetAttributeValueAsNumber(const string& attr)
240 {
241   string attribute = GetAttributeValue(attr);
242
243   if (attribute.empty()) return HUGE_VAL;
244   else return (atof(attribute.c_str()));
245 }
246
247 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
248
249 Element* Element::GetElement(unsigned int el)
250 {
251   if (children.size() > el) {
252     element_index = el;
253     return children[el];
254   }
255   else {
256     element_index = 0;
257     return 0L;
258   }
259 }
260
261 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
262
263 Element* Element::GetNextElement(void)
264 {
265   if (children.size() > element_index+1) {
266     element_index++;
267     return children[element_index];
268   } else {
269     element_index = 0;
270     return 0L;
271   }
272 }
273
274 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
275
276 string Element::GetDataLine(unsigned int i)
277 {
278   if (data_lines.size() > 0) return data_lines[i];
279   else return string("");
280 }
281
282 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
283
284 double Element::GetDataAsNumber(void)
285 {
286   if (data_lines.size() == 1) {
287     return atof(data_lines[0].c_str());
288   } else if (data_lines.size() == 0) {
289     return HUGE_VAL;
290   } else {
291     cerr << "Attempting to get single data value from multiple lines in element " << name << endl;
292     return HUGE_VAL;
293   }
294 }
295
296 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
297
298 unsigned int Element::GetNumElements(const string& element_name)
299 {
300   unsigned int number_of_elements=0;
301   Element* el=FindElement(element_name);
302   while (el) {
303     number_of_elements++;
304     el=FindNextElement(element_name);
305   }
306   return number_of_elements;
307 }
308
309 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
310
311 Element* Element::FindElement(const string& el)
312 {
313   if (el.empty() && children.size() >= 1) {
314     element_index = 1;
315     return children[0];
316   }
317   for (unsigned int i=0; i<children.size(); i++) {
318     if (el == children[i]->GetName()) {
319       element_index = i+1;
320       return children[i];
321     }
322   }
323   element_index = 0;
324   return 0L;
325 }
326
327 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
328
329 Element* Element::FindNextElement(const string& el)
330 {
331   if (el.empty()) {
332     if (element_index < children.size()) {
333       return children[element_index++];
334     } else {
335       element_index = 0;
336       return 0L;
337     }
338   }
339   for (unsigned int i=element_index; i<children.size(); i++) {
340     if (el == children[i]->GetName()) {
341       element_index = i+1;
342       return children[i];
343     }
344   }
345   element_index = 0;
346   return 0L;
347 }
348
349 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350
351 double Element::FindElementValueAsNumber(const string& el)
352 {
353   Element* element = FindElement(el);
354   if (element) {
355     return element->GetDataAsNumber();
356   } else {
357     cerr << "Attempting to get single data value from multiple lines" << endl;
358     return 0;
359   }
360 }
361
362 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
363
364 string Element::FindElementValue(const string& el)
365 {
366   Element* element = FindElement(el);
367   if (element) {
368     return element->GetDataLine();
369   } else {
370     return "";
371   }
372 }
373
374 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
375
376 double Element::FindElementValueAsNumberConvertTo(const string& el, const string& target_units)
377 {
378   Element* element = FindElement(el);
379
380   if (!element) {
381     cerr << "Attempting to get non-existent element " << el << endl;
382     exit(0);
383   }
384
385   string supplied_units = element->GetAttributeValue("unit");
386
387   if (!supplied_units.empty()) {
388     if (convert.find(supplied_units) == convert.end()) {
389       cerr << endl << "Supplied unit: \"" << supplied_units << "\" does not exist (typo?). Add new unit"
390            << " conversion in FGXMLElement.cpp." << endl;
391       exit(-1);
392     }
393     if (convert[supplied_units].find(target_units) == convert[supplied_units].end()) {
394       cerr << endl << "Supplied unit: \"" << supplied_units << "\" cannot be converted to "
395                    << target_units << ". Add new unit conversion in FGXMLElement.cpp or fix typo" << endl;
396       exit(-1);
397     }
398   }
399
400   double value = element->GetDataAsNumber();
401   if (!supplied_units.empty()) {
402     value *= convert[supplied_units][target_units];
403   }
404
405   return value;
406 }
407
408 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
409
410 double Element::FindElementValueAsNumberConvertFromTo( const string& el,
411                                                        const string& supplied_units,
412                                                        const string& target_units)
413 {
414   Element* element = FindElement(el);
415
416   if (!element) {
417     cerr << "Attempting to get non-existent element " << el << endl;
418     exit(0);
419   }
420
421   if (!supplied_units.empty()) {
422     if (convert.find(supplied_units) == convert.end()) {
423       cerr << endl << "Supplied unit: \"" << supplied_units << "\" does not exist (typo?). Add new unit"
424            << " conversion in FGXMLElement.cpp." << endl;
425       exit(-1);
426     }
427     if (convert[supplied_units].find(target_units) == convert[supplied_units].end()) {
428       cerr << endl << "Supplied unit: \"" << supplied_units << "\" cannot be converted to "
429                    << target_units << ". Add new unit conversion in FGXMLElement.cpp or fix typo" << endl;
430       exit(-1);
431     }
432   }
433
434   double value = element->GetDataAsNumber();
435   if (!supplied_units.empty()) {
436     value *= convert[supplied_units][target_units];
437   }
438
439   return value;
440 }
441
442 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
443
444 FGColumnVector3 Element::FindElementTripletConvertTo( const string& target_units)
445 {
446   FGColumnVector3 triplet;
447   Element* item;
448   double value=0.0;
449   string supplied_units = GetAttributeValue("unit");
450
451   if (!supplied_units.empty()) {
452     if (convert.find(supplied_units) == convert.end()) {
453       cerr << endl << "Supplied unit: \"" << supplied_units << "\" does not exist (typo?). Add new unit"
454            << " conversion in FGXMLElement.cpp." << endl;
455       exit(-1);
456     }
457     if (convert[supplied_units].find(target_units) == convert[supplied_units].end()) {
458       cerr << endl << "Supplied unit: \"" << supplied_units << "\" cannot be converted to "
459                    << target_units << ". Add new unit conversion in FGXMLElement.cpp or fix typo" << endl;
460       exit(-1);
461     }
462   }
463
464   item = FindElement("x");
465   if (!item) item = FindElement("roll");
466   if (item) {
467     value = item->GetDataAsNumber();
468     if (!supplied_units.empty()) value *= convert[supplied_units][target_units];
469   } else {
470     value = 0.0;
471     cerr << "Could not find an X triplet item for this column vector." << endl;
472   }
473   triplet(1) = value;
474
475   item = FindElement("y");
476   if (!item) item = FindElement("pitch");
477   if (item) {
478     value = item->GetDataAsNumber();
479     if (!supplied_units.empty()) value *= convert[supplied_units][target_units];
480   } else {
481     value = 0.0;
482     cerr << "Could not find a Y triplet item for this column vector." << endl;
483   }
484   triplet(2) = value;
485
486   item = FindElement("z");
487   if (!item) item = FindElement("yaw");
488   if (item) {
489     value = item->GetDataAsNumber();
490     if (!supplied_units.empty()) value *= convert[supplied_units][target_units];
491   } else {
492     value = 0.0;
493     cerr << "Could not find a Z triplet item for this column vector." << endl;
494   }
495   triplet(3) = value;
496
497   return triplet;
498 }
499
500 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
501
502 void Element::Print(unsigned int level)
503 {
504   unsigned int i, spaces;
505
506   level+=2;
507   for (spaces=0; spaces<=level; spaces++) cout << " "; // format output
508   cout << "Element Name: " << name;
509   for (i=0; i<attributes.size(); i++) {
510     cout << "  " << attribute_key[i] << " = " << attributes[attribute_key[i]];
511   }
512   cout << endl;
513   for (i=0; i<data_lines.size(); i++) {
514     for (spaces=0; spaces<=level; spaces++) cout << " "; // format output
515     cout << data_lines[i] << endl;
516   }
517   for (i=0; i<children.size(); i++) {
518     children[i]->Print(level);
519   }
520 }
521
522 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
523
524 void Element::AddAttribute(const string& name, const string& value)
525 {
526   attribute_key.push_back(name);
527   attributes[name] = value;
528 }
529
530 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
531
532 void Element::AddData(string d)
533 {
534   string::size_type string_start = d.find_first_not_of(" \t");
535   if (string_start != string::npos && string_start > 0) {
536     d.erase(0,string_start);
537   }
538   data_lines.push_back(d);
539 }
540
541 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
542
543 } // end namespace JSBSim