Line data Source code
1 :
2 : /*
3 : * ALMA - Atacama Large Millimeter Array
4 : * (c) European Southern Observatory, 2002
5 : * (c) Associated Universities Inc., 2002
6 : * Copyright by ESO (in the framework of the ALMA collaboration),
7 : * Copyright by AUI (in the framework of the ALMA collaboration),
8 : * All rights reserved.
9 : *
10 : * This library is free software; you can redistribute it and/or
11 : * modify it under the terms of the GNU Lesser General Public
12 : * License as published by the Free software Foundation; either
13 : * version 2.1 of the License, or (at your option) any later version.
14 : *
15 : * This library is distributed in the hope that it will be useful,
16 : * but WITHOUT ANY WARRANTY, without even the implied warranty of
17 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 : * Lesser General Public License for more details.
19 : *
20 : * You should have received a copy of the GNU Lesser General Public
21 : * License along with this library; if not, write to the Free Software
22 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 : * MA 02111-1307 USA
24 : *
25 : * /////////////////////////////////////////////////////////////////
26 : * // WARNING! DO NOT MODIFY THIS FILE! //
27 : * // --------------------------------------------------------- //
28 : * // | This is generated code! Do not modify this file. | //
29 : * // | Any changes will be lost when the file is re-generated. | //
30 : * // --------------------------------------------------------- //
31 : * /////////////////////////////////////////////////////////////////
32 : *
33 : * File EnumerationParser.cpp
34 : */
35 :
36 : #include <alma/ASDM/EnumerationParser.h>
37 : #include <sstream>
38 : #include <stdlib.h> // for atoi()
39 : #include <errno.h> // to detect exception raised by atoi.
40 : using namespace std;
41 :
42 : using namespace asdm;
43 :
44 :
45 : using namespace ReceiverBandMod;
46 :
47 : using namespace SBTypeMod;
48 :
49 : using namespace DirectionReferenceCodeMod;
50 :
51 : using namespace CorrelationModeMod;
52 :
53 : using namespace AtmPhaseCorrectionMod;
54 :
55 : using namespace ProcessorTypeMod;
56 :
57 : using namespace SpectralResolutionTypeMod;
58 :
59 : using namespace CalibrationDeviceMod;
60 :
61 : using namespace AntennaMakeMod;
62 :
63 : using namespace AntennaTypeMod;
64 :
65 : using namespace SourceModelMod;
66 :
67 : using namespace FrequencyReferenceCodeMod;
68 :
69 : using namespace StokesParameterMod;
70 :
71 : using namespace RadialVelocityReferenceCodeMod;
72 :
73 : using namespace DopplerReferenceCodeMod;
74 :
75 : using namespace PolarizationTypeMod;
76 :
77 : using namespace BasebandNameMod;
78 :
79 : using namespace NetSidebandMod;
80 :
81 : using namespace SidebandProcessingModeMod;
82 :
83 : using namespace WindowFunctionMod;
84 :
85 : using namespace CorrelationBitMod;
86 :
87 : using namespace ReceiverSidebandMod;
88 :
89 : using namespace ProcessorSubTypeMod;
90 :
91 : using namespace AccumModeMod;
92 :
93 : using namespace AxisNameMod;
94 :
95 : using namespace FilterModeMod;
96 :
97 : using namespace CorrelatorNameMod;
98 :
99 : using namespace WVRMethodMod;
100 :
101 : using namespace ScanIntentMod;
102 :
103 : using namespace CalDataOriginMod;
104 :
105 : using namespace CalibrationFunctionMod;
106 :
107 : using namespace CalibrationSetMod;
108 :
109 : using namespace AntennaMotionPatternMod;
110 :
111 : using namespace SubscanIntentMod;
112 :
113 : using namespace SwitchingModeMod;
114 :
115 : using namespace CorrelatorCalibrationMod;
116 :
117 : using namespace TimeSamplingMod;
118 :
119 : using namespace CalTypeMod;
120 :
121 : using namespace AssociatedCalNatureMod;
122 :
123 : using namespace InvalidatingConditionMod;
124 :
125 : using namespace PositionMethodMod;
126 :
127 : using namespace PointingModelModeMod;
128 :
129 : using namespace PointingMethodMod;
130 :
131 : using namespace SyscalMethodMod;
132 :
133 : using namespace CalCurveTypeMod;
134 :
135 : using namespace StationTypeMod;
136 :
137 : using namespace DetectorBandTypeMod;
138 :
139 : using namespace FocusMethodMod;
140 :
141 : using namespace HolographyChannelTypeMod;
142 :
143 : using namespace FluxCalibrationMethodMod;
144 :
145 : using namespace PrimaryBeamDescriptionMod;
146 :
147 : using namespace TimeScaleMod;
148 :
149 : using namespace DataScaleMod;
150 :
151 : using namespace WeightTypeMod;
152 :
153 : using namespace DifferenceTypeMod;
154 :
155 : using namespace CalibrationModeMod;
156 :
157 : using namespace AssociatedFieldNatureMod;
158 :
159 : using namespace DataContentMod;
160 :
161 : using namespace PrimitiveDataTypeMod;
162 :
163 : using namespace SchedulerModeMod;
164 :
165 : using namespace FieldCodeMod;
166 :
167 : using namespace ACAPolarizationMod;
168 :
169 : using namespace PositionReferenceCodeMod;
170 :
171 : using namespace BaselineReferenceCodeMod;
172 :
173 : using namespace CorrelatorTypeMod;
174 :
175 : using namespace DopplerTrackingModeMod;
176 :
177 : using namespace SynthProfMod;
178 :
179 :
180 : namespace asdm {
181 :
182 178454 : string EnumerationParser::getField(const string &xml, const string &field) {
183 178454 : string::size_type b = xml.find("<" + field + ">");
184 178454 : if (b == string::npos)
185 0 : return "";
186 178454 : b += field.length() + 2;
187 178454 : string::size_type e = xml.find("</" + field + ">",b);
188 178454 : if (e == string::npos)
189 0 : return "";
190 178454 : string s = substring(xml,b,e);
191 178454 : return trim(s);
192 178454 : }
193 :
194 356908 : string EnumerationParser::substring(const string &s, int a, int b) {
195 356908 : return s.substr(a,(b - a));
196 : }
197 :
198 178454 : string EnumerationParser::trim(const string &s) {
199 178454 : string::size_type i = 0;
200 181677 : while (s.at(i) == ' ' && i < s.length())
201 3223 : ++i;
202 178454 : if (i == s.length())
203 0 : return "";
204 178454 : string::size_type j = s.length() - 1;
205 178454 : while (s.at(j) == ' ' && j > i)
206 0 : --j;
207 178454 : return substring(s,i,j + 1);
208 : }
209 :
210 :
211 :
212 :
213 :
214 816 : string EnumerationParser::toXML(const string& elementName, ReceiverBandMod::ReceiverBand e) {
215 1632 : return "<"+elementName+">"+CReceiverBand::name(e)+"</"+elementName+">";
216 : }
217 :
218 0 : string EnumerationParser::toXML(const string& elementName, const vector<ReceiverBandMod::ReceiverBand>& v_e) {
219 0 : ostringstream oss;
220 : oss << "<" << elementName << ">"
221 : << " 1"
222 0 : << " " << v_e.size();
223 :
224 0 : for (unsigned int i = 0; i < v_e.size(); i++)
225 0 : oss << " " << CReceiverBand::name(v_e.at(i));
226 0 : oss << "</" << elementName << ">";
227 0 : return oss.str();
228 0 : }
229 :
230 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<ReceiverBandMod::ReceiverBand> >& vv_e) {
231 0 : ostringstream oss;
232 : oss << "<" << elementName << ">"
233 : << " 2"
234 0 : << " " <<vv_e.size()
235 0 : << " " <<vv_e.at(0).size();
236 :
237 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
238 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
239 0 : oss << " " << CReceiverBand::name(vv_e.at(i).at(j));
240 0 : oss << "</" << elementName << ">";
241 0 : return oss.str();
242 0 : }
243 :
244 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<ReceiverBandMod::ReceiverBand> > >& vvv_e) {
245 0 : ostringstream oss;
246 : oss << "<" << elementName << ">"
247 : << " 3"
248 0 : << " " <<vvv_e.size()
249 0 : << " " <<vvv_e.at(0).size()
250 0 : << " " <<vvv_e.at(0).at(0).size();
251 :
252 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
253 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
254 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
255 0 : oss << " " << CReceiverBand::name(vvv_e.at(i).at(j).at(k));
256 0 : oss << "</" << elementName << ">";
257 0 : return oss.str();
258 0 : }
259 :
260 208 : ReceiverBandMod::ReceiverBand EnumerationParser::getReceiverBand(const string &name, const string &tableName, const string &xmlDoc) {
261 208 : string s = getField(xmlDoc,name);
262 208 : if (s.length() == 0)
263 0 : throw ConversionException("Error: Missing field \"" +
264 0 : name + "\" or invalid syntax",tableName);
265 :
266 : ReceiverBand result;
267 : try {
268 208 : result = CReceiverBand::newReceiverBand(s);
269 : }
270 0 : catch (...) {
271 0 : throw ConversionException("Error: could not convert '"+s+"' into a ReceiverBand.", tableName);
272 0 : }
273 208 : return result;
274 208 : }
275 :
276 0 : vector<ReceiverBandMod::ReceiverBand> EnumerationParser::getReceiverBand1D(const string &name, const string &tableName, const string &xmlDoc) {
277 0 : vector<ReceiverBandMod::ReceiverBand> result;
278 :
279 0 : string s = getField(xmlDoc,name);
280 0 : if (s.length() == 0)
281 0 : throw ConversionException("Error: Missing field \"" +
282 0 : name + "\" or invalid syntax",tableName);
283 :
284 0 : istringstream iss;
285 0 : iss.str(s);
286 0 : vector<string> tokens;
287 :
288 : // Tokenize.
289 0 : string buf;
290 0 : while (iss >> buf) {
291 0 : tokens.push_back(buf);
292 : }
293 :
294 : // The length must be 2 at the minimum (there may be an empty array)
295 0 : if (tokens.size() < 2)
296 0 : throw ConversionException("Error: missing values in field \"" +
297 0 : name + "\" or invalid syntax('" + s +"')",tableName);
298 :
299 :
300 :
301 : // The number of dimension should be 1.
302 0 : if (tokens.at(0) != "1")
303 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
304 0 : name + "\" or invalid syntax('" + s +"')",tableName);
305 :
306 : // Then parse the size of the unique dimension
307 0 : errno = 0;
308 0 : int size1 = atoi(tokens.at(1).c_str());
309 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
310 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
311 :
312 0 : if (size1 < 0)
313 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
314 0 : name + "\" or invalid syntax('" + s +"')",tableName);
315 :
316 0 : if (tokens.size() != (unsigned int) (size1 + 2))
317 0 : throw ConversionException("Error: incorrect number of values in field \"" +
318 0 : name + "\" or invalid syntax('" + s +"')",tableName);
319 :
320 0 : int k = 2;
321 : try {
322 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
323 0 : result.push_back(CReceiverBand::newReceiverBand(tokens.at(k).c_str()));
324 0 : k++;
325 : }
326 : }
327 0 : catch (...) {
328 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ReceiverBand.", tableName);
329 0 : }
330 :
331 0 : return result;
332 0 : }
333 :
334 0 : vector<vector<ReceiverBandMod::ReceiverBand> > EnumerationParser::getReceiverBand2D(const string &name, const string &tableName, const string &xmlDoc) {
335 0 : vector<vector<ReceiverBandMod::ReceiverBand> > result;
336 :
337 0 : string s = getField(xmlDoc,name);
338 0 : if (s.length() == 0)
339 0 : throw ConversionException("Error: Missing field \"" +
340 0 : name + "\" or invalid syntax",tableName);
341 :
342 0 : istringstream iss;
343 0 : iss.str(s);
344 0 : vector<string> tokens;
345 :
346 : // Tokenize.
347 0 : string buf;
348 0 : while (iss >> buf) {
349 0 : tokens.push_back(buf);
350 : }
351 :
352 : // The length must be 3 at the minimum (there may be an empty array)
353 0 : if (tokens.size() < 3)
354 0 : throw ConversionException("Error: missing values in field \"" +
355 0 : name + "\" or invalid syntax(" + s +"')",tableName);
356 :
357 :
358 : // The number of dimension should be 2.
359 0 : if (tokens.at(0) != "2")
360 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
361 0 : name + "\" or invalid syntax('" + s +"')",tableName);
362 :
363 : // Then parse the size of the two dimensions
364 0 : errno = 0;
365 0 : int size1 = atoi(tokens.at(1).c_str());
366 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
367 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
368 :
369 0 : if (size1 <= 0)
370 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
371 0 : name + "\" or invalid syntax('" + s +"')",tableName);
372 0 : errno = 0;
373 0 : int size2 = atoi(tokens.at(2).c_str());
374 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
375 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
376 :
377 0 : if (size2 < 0)
378 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
379 0 : name + "\" or invalid syntax('" + s +"')",tableName);
380 :
381 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
382 0 : throw ConversionException("Error: incorrect number of values in field \"" +
383 0 : name + "\" or invalid syntax('" + s +"')",tableName);
384 :
385 0 : int k = 3;
386 : try {
387 0 : vector<ReceiverBandMod::ReceiverBand> v_aux;
388 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
389 0 : v_aux.clear();
390 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
391 0 : v_aux.push_back(CReceiverBand::newReceiverBand(tokens.at(k).c_str()));
392 0 : k++;
393 : }
394 0 : result.push_back(v_aux);
395 : }
396 0 : }
397 0 : catch (...) {
398 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ReceiverBand.", tableName);
399 0 : }
400 0 : return result;
401 0 : }
402 :
403 :
404 0 : vector<vector<vector<ReceiverBandMod::ReceiverBand> > > EnumerationParser::getReceiverBand3D(const string &name, const string &tableName, const string &xmlDoc) {
405 0 : vector<vector<vector<ReceiverBandMod::ReceiverBand> > >result;
406 :
407 0 : string s = getField(xmlDoc,name);
408 0 : if (s.length() == 0)
409 0 : throw ConversionException("Error: Missing field \"" +
410 0 : name + "\" or invalid syntax",tableName);
411 :
412 0 : istringstream iss;
413 0 : iss.str(s);
414 0 : vector<string> tokens;
415 :
416 : // Tokenize.
417 0 : string buf;
418 0 : while (iss >> buf) {
419 0 : tokens.push_back(buf);
420 : }
421 :
422 : // The length must be 4 at the minimum (there may be an empty array)
423 0 : if (tokens.size() < 4)
424 0 : throw ConversionException("Error: missing values in field \"" +
425 0 : name + "\" or invalid syntax(" + s +"')",tableName);
426 :
427 :
428 : // The number of dimension should be 3.
429 0 : if (tokens.at(0) != "3")
430 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
431 0 : name + "\" or invalid syntax('" + s +"')",tableName);
432 :
433 : // Then parse the size of the three dimensions
434 0 : errno = 0;
435 0 : int size1 = atoi(tokens.at(1).c_str());
436 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
437 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
438 :
439 0 : if (size1 <= 0)
440 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
441 0 : name + "\" or invalid syntax('" + s +"')",tableName);
442 :
443 0 : errno = 0;
444 0 : int size2 = atoi(tokens.at(2).c_str());
445 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
446 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
447 :
448 0 : if (size2 <= 0)
449 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
450 0 : name + "\" or invalid syntax('" + s +"')",tableName);
451 :
452 0 : errno = 0;
453 0 : int size3 = atoi(tokens.at(3).c_str());
454 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
455 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
456 :
457 :
458 0 : if (size3 < 0)
459 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
460 0 : name + "\" or invalid syntax('" + s +"')",tableName);
461 :
462 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
463 0 : throw ConversionException("Error: incorrect number of values in field \"" +
464 0 : name + "\" or invalid syntax('" + s +"')",tableName);
465 :
466 0 : int k = 4;
467 : try {
468 0 : vector<ReceiverBandMod::ReceiverBand> v_aux;
469 0 : vector<vector<ReceiverBandMod::ReceiverBand> > vv_aux;
470 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
471 0 : vv_aux.clear();
472 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
473 0 : v_aux.clear();
474 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
475 0 : v_aux.push_back(CReceiverBand::newReceiverBand(tokens.at(k).c_str()));
476 0 : k++;
477 : }
478 0 : vv_aux.push_back(v_aux);
479 : }
480 0 : result.push_back(vv_aux);
481 : }
482 0 : }
483 0 : catch (...) {
484 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a ReceiverBand.", tableName);
485 0 : }
486 :
487 0 : return result;
488 0 : }
489 :
490 :
491 :
492 :
493 :
494 231 : string EnumerationParser::toXML(const string& elementName, SBTypeMod::SBType e) {
495 462 : return "<"+elementName+">"+CSBType::name(e)+"</"+elementName+">";
496 : }
497 :
498 0 : string EnumerationParser::toXML(const string& elementName, const vector<SBTypeMod::SBType>& v_e) {
499 0 : ostringstream oss;
500 : oss << "<" << elementName << ">"
501 : << " 1"
502 0 : << " " << v_e.size();
503 :
504 0 : for (unsigned int i = 0; i < v_e.size(); i++)
505 0 : oss << " " << CSBType::name(v_e.at(i));
506 0 : oss << "</" << elementName << ">";
507 0 : return oss.str();
508 0 : }
509 :
510 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<SBTypeMod::SBType> >& vv_e) {
511 0 : ostringstream oss;
512 : oss << "<" << elementName << ">"
513 : << " 2"
514 0 : << " " <<vv_e.size()
515 0 : << " " <<vv_e.at(0).size();
516 :
517 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
518 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
519 0 : oss << " " << CSBType::name(vv_e.at(i).at(j));
520 0 : oss << "</" << elementName << ">";
521 0 : return oss.str();
522 0 : }
523 :
524 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<SBTypeMod::SBType> > >& vvv_e) {
525 0 : ostringstream oss;
526 : oss << "<" << elementName << ">"
527 : << " 3"
528 0 : << " " <<vvv_e.size()
529 0 : << " " <<vvv_e.at(0).size()
530 0 : << " " <<vvv_e.at(0).at(0).size();
531 :
532 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
533 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
534 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
535 0 : oss << " " << CSBType::name(vvv_e.at(i).at(j).at(k));
536 0 : oss << "</" << elementName << ">";
537 0 : return oss.str();
538 0 : }
539 :
540 148 : SBTypeMod::SBType EnumerationParser::getSBType(const string &name, const string &tableName, const string &xmlDoc) {
541 148 : string s = getField(xmlDoc,name);
542 148 : if (s.length() == 0)
543 0 : throw ConversionException("Error: Missing field \"" +
544 0 : name + "\" or invalid syntax",tableName);
545 :
546 : SBType result;
547 : try {
548 148 : result = CSBType::newSBType(s);
549 : }
550 0 : catch (...) {
551 0 : throw ConversionException("Error: could not convert '"+s+"' into a SBType.", tableName);
552 0 : }
553 148 : return result;
554 148 : }
555 :
556 0 : vector<SBTypeMod::SBType> EnumerationParser::getSBType1D(const string &name, const string &tableName, const string &xmlDoc) {
557 0 : vector<SBTypeMod::SBType> result;
558 :
559 0 : string s = getField(xmlDoc,name);
560 0 : if (s.length() == 0)
561 0 : throw ConversionException("Error: Missing field \"" +
562 0 : name + "\" or invalid syntax",tableName);
563 :
564 0 : istringstream iss;
565 0 : iss.str(s);
566 0 : vector<string> tokens;
567 :
568 : // Tokenize.
569 0 : string buf;
570 0 : while (iss >> buf) {
571 0 : tokens.push_back(buf);
572 : }
573 :
574 : // The length must be 2 at the minimum (there may be an empty array)
575 0 : if (tokens.size() < 2)
576 0 : throw ConversionException("Error: missing values in field \"" +
577 0 : name + "\" or invalid syntax('" + s +"')",tableName);
578 :
579 :
580 :
581 : // The number of dimension should be 1.
582 0 : if (tokens.at(0) != "1")
583 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
584 0 : name + "\" or invalid syntax('" + s +"')",tableName);
585 :
586 : // Then parse the size of the unique dimension
587 0 : errno = 0;
588 0 : int size1 = atoi(tokens.at(1).c_str());
589 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
590 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
591 :
592 0 : if (size1 < 0)
593 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
594 0 : name + "\" or invalid syntax('" + s +"')",tableName);
595 :
596 0 : if (tokens.size() != (unsigned int) (size1 + 2))
597 0 : throw ConversionException("Error: incorrect number of values in field \"" +
598 0 : name + "\" or invalid syntax('" + s +"')",tableName);
599 :
600 0 : int k = 2;
601 : try {
602 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
603 0 : result.push_back(CSBType::newSBType(tokens.at(k).c_str()));
604 0 : k++;
605 : }
606 : }
607 0 : catch (...) {
608 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SBType.", tableName);
609 0 : }
610 :
611 0 : return result;
612 0 : }
613 :
614 0 : vector<vector<SBTypeMod::SBType> > EnumerationParser::getSBType2D(const string &name, const string &tableName, const string &xmlDoc) {
615 0 : vector<vector<SBTypeMod::SBType> > result;
616 :
617 0 : string s = getField(xmlDoc,name);
618 0 : if (s.length() == 0)
619 0 : throw ConversionException("Error: Missing field \"" +
620 0 : name + "\" or invalid syntax",tableName);
621 :
622 0 : istringstream iss;
623 0 : iss.str(s);
624 0 : vector<string> tokens;
625 :
626 : // Tokenize.
627 0 : string buf;
628 0 : while (iss >> buf) {
629 0 : tokens.push_back(buf);
630 : }
631 :
632 : // The length must be 3 at the minimum (there may be an empty array)
633 0 : if (tokens.size() < 3)
634 0 : throw ConversionException("Error: missing values in field \"" +
635 0 : name + "\" or invalid syntax(" + s +"')",tableName);
636 :
637 :
638 : // The number of dimension should be 2.
639 0 : if (tokens.at(0) != "2")
640 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
641 0 : name + "\" or invalid syntax('" + s +"')",tableName);
642 :
643 : // Then parse the size of the two dimensions
644 0 : errno = 0;
645 0 : int size1 = atoi(tokens.at(1).c_str());
646 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
647 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
648 :
649 0 : if (size1 <= 0)
650 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
651 0 : name + "\" or invalid syntax('" + s +"')",tableName);
652 0 : errno = 0;
653 0 : int size2 = atoi(tokens.at(2).c_str());
654 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
655 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
656 :
657 0 : if (size2 < 0)
658 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
659 0 : name + "\" or invalid syntax('" + s +"')",tableName);
660 :
661 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
662 0 : throw ConversionException("Error: incorrect number of values in field \"" +
663 0 : name + "\" or invalid syntax('" + s +"')",tableName);
664 :
665 0 : int k = 3;
666 : try {
667 0 : vector<SBTypeMod::SBType> v_aux;
668 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
669 0 : v_aux.clear();
670 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
671 0 : v_aux.push_back(CSBType::newSBType(tokens.at(k).c_str()));
672 0 : k++;
673 : }
674 0 : result.push_back(v_aux);
675 : }
676 0 : }
677 0 : catch (...) {
678 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SBType.", tableName);
679 0 : }
680 0 : return result;
681 0 : }
682 :
683 :
684 0 : vector<vector<vector<SBTypeMod::SBType> > > EnumerationParser::getSBType3D(const string &name, const string &tableName, const string &xmlDoc) {
685 0 : vector<vector<vector<SBTypeMod::SBType> > >result;
686 :
687 0 : string s = getField(xmlDoc,name);
688 0 : if (s.length() == 0)
689 0 : throw ConversionException("Error: Missing field \"" +
690 0 : name + "\" or invalid syntax",tableName);
691 :
692 0 : istringstream iss;
693 0 : iss.str(s);
694 0 : vector<string> tokens;
695 :
696 : // Tokenize.
697 0 : string buf;
698 0 : while (iss >> buf) {
699 0 : tokens.push_back(buf);
700 : }
701 :
702 : // The length must be 4 at the minimum (there may be an empty array)
703 0 : if (tokens.size() < 4)
704 0 : throw ConversionException("Error: missing values in field \"" +
705 0 : name + "\" or invalid syntax(" + s +"')",tableName);
706 :
707 :
708 : // The number of dimension should be 3.
709 0 : if (tokens.at(0) != "3")
710 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
711 0 : name + "\" or invalid syntax('" + s +"')",tableName);
712 :
713 : // Then parse the size of the three dimensions
714 0 : errno = 0;
715 0 : int size1 = atoi(tokens.at(1).c_str());
716 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
717 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
718 :
719 0 : if (size1 <= 0)
720 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
721 0 : name + "\" or invalid syntax('" + s +"')",tableName);
722 :
723 0 : errno = 0;
724 0 : int size2 = atoi(tokens.at(2).c_str());
725 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
726 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
727 :
728 0 : if (size2 <= 0)
729 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
730 0 : name + "\" or invalid syntax('" + s +"')",tableName);
731 :
732 0 : errno = 0;
733 0 : int size3 = atoi(tokens.at(3).c_str());
734 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
735 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
736 :
737 :
738 0 : if (size3 < 0)
739 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
740 0 : name + "\" or invalid syntax('" + s +"')",tableName);
741 :
742 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
743 0 : throw ConversionException("Error: incorrect number of values in field \"" +
744 0 : name + "\" or invalid syntax('" + s +"')",tableName);
745 :
746 0 : int k = 4;
747 : try {
748 0 : vector<SBTypeMod::SBType> v_aux;
749 0 : vector<vector<SBTypeMod::SBType> > vv_aux;
750 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
751 0 : vv_aux.clear();
752 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
753 0 : v_aux.clear();
754 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
755 0 : v_aux.push_back(CSBType::newSBType(tokens.at(k).c_str()));
756 0 : k++;
757 : }
758 0 : vv_aux.push_back(v_aux);
759 : }
760 0 : result.push_back(vv_aux);
761 : }
762 0 : }
763 0 : catch (...) {
764 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a SBType.", tableName);
765 0 : }
766 :
767 0 : return result;
768 0 : }
769 :
770 :
771 :
772 :
773 :
774 748 : string EnumerationParser::toXML(const string& elementName, DirectionReferenceCodeMod::DirectionReferenceCode e) {
775 1496 : return "<"+elementName+">"+CDirectionReferenceCode::name(e)+"</"+elementName+">";
776 : }
777 :
778 0 : string EnumerationParser::toXML(const string& elementName, const vector<DirectionReferenceCodeMod::DirectionReferenceCode>& v_e) {
779 0 : ostringstream oss;
780 : oss << "<" << elementName << ">"
781 : << " 1"
782 0 : << " " << v_e.size();
783 :
784 0 : for (unsigned int i = 0; i < v_e.size(); i++)
785 0 : oss << " " << CDirectionReferenceCode::name(v_e.at(i));
786 0 : oss << "</" << elementName << ">";
787 0 : return oss.str();
788 0 : }
789 :
790 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<DirectionReferenceCodeMod::DirectionReferenceCode> >& vv_e) {
791 0 : ostringstream oss;
792 : oss << "<" << elementName << ">"
793 : << " 2"
794 0 : << " " <<vv_e.size()
795 0 : << " " <<vv_e.at(0).size();
796 :
797 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
798 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
799 0 : oss << " " << CDirectionReferenceCode::name(vv_e.at(i).at(j));
800 0 : oss << "</" << elementName << ">";
801 0 : return oss.str();
802 0 : }
803 :
804 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<DirectionReferenceCodeMod::DirectionReferenceCode> > >& vvv_e) {
805 0 : ostringstream oss;
806 : oss << "<" << elementName << ">"
807 : << " 3"
808 0 : << " " <<vvv_e.size()
809 0 : << " " <<vvv_e.at(0).size()
810 0 : << " " <<vvv_e.at(0).at(0).size();
811 :
812 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
813 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
814 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
815 0 : oss << " " << CDirectionReferenceCode::name(vvv_e.at(i).at(j).at(k));
816 0 : oss << "</" << elementName << ">";
817 0 : return oss.str();
818 0 : }
819 :
820 9115 : DirectionReferenceCodeMod::DirectionReferenceCode EnumerationParser::getDirectionReferenceCode(const string &name, const string &tableName, const string &xmlDoc) {
821 9115 : string s = getField(xmlDoc,name);
822 9115 : if (s.length() == 0)
823 0 : throw ConversionException("Error: Missing field \"" +
824 0 : name + "\" or invalid syntax",tableName);
825 :
826 : DirectionReferenceCode result;
827 : try {
828 9115 : result = CDirectionReferenceCode::newDirectionReferenceCode(s);
829 : }
830 0 : catch (...) {
831 0 : throw ConversionException("Error: could not convert '"+s+"' into a DirectionReferenceCode.", tableName);
832 0 : }
833 9115 : return result;
834 9115 : }
835 :
836 0 : vector<DirectionReferenceCodeMod::DirectionReferenceCode> EnumerationParser::getDirectionReferenceCode1D(const string &name, const string &tableName, const string &xmlDoc) {
837 0 : vector<DirectionReferenceCodeMod::DirectionReferenceCode> result;
838 :
839 0 : string s = getField(xmlDoc,name);
840 0 : if (s.length() == 0)
841 0 : throw ConversionException("Error: Missing field \"" +
842 0 : name + "\" or invalid syntax",tableName);
843 :
844 0 : istringstream iss;
845 0 : iss.str(s);
846 0 : vector<string> tokens;
847 :
848 : // Tokenize.
849 0 : string buf;
850 0 : while (iss >> buf) {
851 0 : tokens.push_back(buf);
852 : }
853 :
854 : // The length must be 2 at the minimum (there may be an empty array)
855 0 : if (tokens.size() < 2)
856 0 : throw ConversionException("Error: missing values in field \"" +
857 0 : name + "\" or invalid syntax('" + s +"')",tableName);
858 :
859 :
860 :
861 : // The number of dimension should be 1.
862 0 : if (tokens.at(0) != "1")
863 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
864 0 : name + "\" or invalid syntax('" + s +"')",tableName);
865 :
866 : // Then parse the size of the unique dimension
867 0 : errno = 0;
868 0 : int size1 = atoi(tokens.at(1).c_str());
869 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
870 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
871 :
872 0 : if (size1 < 0)
873 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
874 0 : name + "\" or invalid syntax('" + s +"')",tableName);
875 :
876 0 : if (tokens.size() != (unsigned int) (size1 + 2))
877 0 : throw ConversionException("Error: incorrect number of values in field \"" +
878 0 : name + "\" or invalid syntax('" + s +"')",tableName);
879 :
880 0 : int k = 2;
881 : try {
882 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
883 0 : result.push_back(CDirectionReferenceCode::newDirectionReferenceCode(tokens.at(k).c_str()));
884 0 : k++;
885 : }
886 : }
887 0 : catch (...) {
888 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DirectionReferenceCode.", tableName);
889 0 : }
890 :
891 0 : return result;
892 0 : }
893 :
894 0 : vector<vector<DirectionReferenceCodeMod::DirectionReferenceCode> > EnumerationParser::getDirectionReferenceCode2D(const string &name, const string &tableName, const string &xmlDoc) {
895 0 : vector<vector<DirectionReferenceCodeMod::DirectionReferenceCode> > result;
896 :
897 0 : string s = getField(xmlDoc,name);
898 0 : if (s.length() == 0)
899 0 : throw ConversionException("Error: Missing field \"" +
900 0 : name + "\" or invalid syntax",tableName);
901 :
902 0 : istringstream iss;
903 0 : iss.str(s);
904 0 : vector<string> tokens;
905 :
906 : // Tokenize.
907 0 : string buf;
908 0 : while (iss >> buf) {
909 0 : tokens.push_back(buf);
910 : }
911 :
912 : // The length must be 3 at the minimum (there may be an empty array)
913 0 : if (tokens.size() < 3)
914 0 : throw ConversionException("Error: missing values in field \"" +
915 0 : name + "\" or invalid syntax(" + s +"')",tableName);
916 :
917 :
918 : // The number of dimension should be 2.
919 0 : if (tokens.at(0) != "2")
920 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
921 0 : name + "\" or invalid syntax('" + s +"')",tableName);
922 :
923 : // Then parse the size of the two dimensions
924 0 : errno = 0;
925 0 : int size1 = atoi(tokens.at(1).c_str());
926 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
927 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
928 :
929 0 : if (size1 <= 0)
930 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
931 0 : name + "\" or invalid syntax('" + s +"')",tableName);
932 0 : errno = 0;
933 0 : int size2 = atoi(tokens.at(2).c_str());
934 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
935 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
936 :
937 0 : if (size2 < 0)
938 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
939 0 : name + "\" or invalid syntax('" + s +"')",tableName);
940 :
941 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
942 0 : throw ConversionException("Error: incorrect number of values in field \"" +
943 0 : name + "\" or invalid syntax('" + s +"')",tableName);
944 :
945 0 : int k = 3;
946 : try {
947 0 : vector<DirectionReferenceCodeMod::DirectionReferenceCode> v_aux;
948 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
949 0 : v_aux.clear();
950 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
951 0 : v_aux.push_back(CDirectionReferenceCode::newDirectionReferenceCode(tokens.at(k).c_str()));
952 0 : k++;
953 : }
954 0 : result.push_back(v_aux);
955 : }
956 0 : }
957 0 : catch (...) {
958 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DirectionReferenceCode.", tableName);
959 0 : }
960 0 : return result;
961 0 : }
962 :
963 :
964 0 : vector<vector<vector<DirectionReferenceCodeMod::DirectionReferenceCode> > > EnumerationParser::getDirectionReferenceCode3D(const string &name, const string &tableName, const string &xmlDoc) {
965 0 : vector<vector<vector<DirectionReferenceCodeMod::DirectionReferenceCode> > >result;
966 :
967 0 : string s = getField(xmlDoc,name);
968 0 : if (s.length() == 0)
969 0 : throw ConversionException("Error: Missing field \"" +
970 0 : name + "\" or invalid syntax",tableName);
971 :
972 0 : istringstream iss;
973 0 : iss.str(s);
974 0 : vector<string> tokens;
975 :
976 : // Tokenize.
977 0 : string buf;
978 0 : while (iss >> buf) {
979 0 : tokens.push_back(buf);
980 : }
981 :
982 : // The length must be 4 at the minimum (there may be an empty array)
983 0 : if (tokens.size() < 4)
984 0 : throw ConversionException("Error: missing values in field \"" +
985 0 : name + "\" or invalid syntax(" + s +"')",tableName);
986 :
987 :
988 : // The number of dimension should be 3.
989 0 : if (tokens.at(0) != "3")
990 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
991 0 : name + "\" or invalid syntax('" + s +"')",tableName);
992 :
993 : // Then parse the size of the three dimensions
994 0 : errno = 0;
995 0 : int size1 = atoi(tokens.at(1).c_str());
996 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
997 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
998 :
999 0 : if (size1 <= 0)
1000 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
1001 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1002 :
1003 0 : errno = 0;
1004 0 : int size2 = atoi(tokens.at(2).c_str());
1005 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1006 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1007 :
1008 0 : if (size2 <= 0)
1009 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
1010 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1011 :
1012 0 : errno = 0;
1013 0 : int size3 = atoi(tokens.at(3).c_str());
1014 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1015 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1016 :
1017 :
1018 0 : if (size3 < 0)
1019 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
1020 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1021 :
1022 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
1023 0 : throw ConversionException("Error: incorrect number of values in field \"" +
1024 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1025 :
1026 0 : int k = 4;
1027 : try {
1028 0 : vector<DirectionReferenceCodeMod::DirectionReferenceCode> v_aux;
1029 0 : vector<vector<DirectionReferenceCodeMod::DirectionReferenceCode> > vv_aux;
1030 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
1031 0 : vv_aux.clear();
1032 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
1033 0 : v_aux.clear();
1034 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
1035 0 : v_aux.push_back(CDirectionReferenceCode::newDirectionReferenceCode(tokens.at(k).c_str()));
1036 0 : k++;
1037 : }
1038 0 : vv_aux.push_back(v_aux);
1039 : }
1040 0 : result.push_back(vv_aux);
1041 : }
1042 0 : }
1043 0 : catch (...) {
1044 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a DirectionReferenceCode.", tableName);
1045 0 : }
1046 :
1047 0 : return result;
1048 0 : }
1049 :
1050 :
1051 :
1052 :
1053 :
1054 35 : string EnumerationParser::toXML(const string& elementName, CorrelationModeMod::CorrelationMode e) {
1055 70 : return "<"+elementName+">"+CCorrelationMode::name(e)+"</"+elementName+">";
1056 : }
1057 :
1058 0 : string EnumerationParser::toXML(const string& elementName, const vector<CorrelationModeMod::CorrelationMode>& v_e) {
1059 0 : ostringstream oss;
1060 : oss << "<" << elementName << ">"
1061 : << " 1"
1062 0 : << " " << v_e.size();
1063 :
1064 0 : for (unsigned int i = 0; i < v_e.size(); i++)
1065 0 : oss << " " << CCorrelationMode::name(v_e.at(i));
1066 0 : oss << "</" << elementName << ">";
1067 0 : return oss.str();
1068 0 : }
1069 :
1070 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CorrelationModeMod::CorrelationMode> >& vv_e) {
1071 0 : ostringstream oss;
1072 : oss << "<" << elementName << ">"
1073 : << " 2"
1074 0 : << " " <<vv_e.size()
1075 0 : << " " <<vv_e.at(0).size();
1076 :
1077 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
1078 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
1079 0 : oss << " " << CCorrelationMode::name(vv_e.at(i).at(j));
1080 0 : oss << "</" << elementName << ">";
1081 0 : return oss.str();
1082 0 : }
1083 :
1084 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CorrelationModeMod::CorrelationMode> > >& vvv_e) {
1085 0 : ostringstream oss;
1086 : oss << "<" << elementName << ">"
1087 : << " 3"
1088 0 : << " " <<vvv_e.size()
1089 0 : << " " <<vvv_e.at(0).size()
1090 0 : << " " <<vvv_e.at(0).at(0).size();
1091 :
1092 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
1093 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
1094 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
1095 0 : oss << " " << CCorrelationMode::name(vvv_e.at(i).at(j).at(k));
1096 0 : oss << "</" << elementName << ">";
1097 0 : return oss.str();
1098 0 : }
1099 :
1100 351 : CorrelationModeMod::CorrelationMode EnumerationParser::getCorrelationMode(const string &name, const string &tableName, const string &xmlDoc) {
1101 351 : string s = getField(xmlDoc,name);
1102 351 : if (s.length() == 0)
1103 0 : throw ConversionException("Error: Missing field \"" +
1104 0 : name + "\" or invalid syntax",tableName);
1105 :
1106 : CorrelationMode result;
1107 : try {
1108 351 : result = CCorrelationMode::newCorrelationMode(s);
1109 : }
1110 0 : catch (...) {
1111 0 : throw ConversionException("Error: could not convert '"+s+"' into a CorrelationMode.", tableName);
1112 0 : }
1113 351 : return result;
1114 351 : }
1115 :
1116 0 : vector<CorrelationModeMod::CorrelationMode> EnumerationParser::getCorrelationMode1D(const string &name, const string &tableName, const string &xmlDoc) {
1117 0 : vector<CorrelationModeMod::CorrelationMode> result;
1118 :
1119 0 : string s = getField(xmlDoc,name);
1120 0 : if (s.length() == 0)
1121 0 : throw ConversionException("Error: Missing field \"" +
1122 0 : name + "\" or invalid syntax",tableName);
1123 :
1124 0 : istringstream iss;
1125 0 : iss.str(s);
1126 0 : vector<string> tokens;
1127 :
1128 : // Tokenize.
1129 0 : string buf;
1130 0 : while (iss >> buf) {
1131 0 : tokens.push_back(buf);
1132 : }
1133 :
1134 : // The length must be 2 at the minimum (there may be an empty array)
1135 0 : if (tokens.size() < 2)
1136 0 : throw ConversionException("Error: missing values in field \"" +
1137 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1138 :
1139 :
1140 :
1141 : // The number of dimension should be 1.
1142 0 : if (tokens.at(0) != "1")
1143 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
1144 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1145 :
1146 : // Then parse the size of the unique dimension
1147 0 : errno = 0;
1148 0 : int size1 = atoi(tokens.at(1).c_str());
1149 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1150 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1151 :
1152 0 : if (size1 < 0)
1153 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
1154 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1155 :
1156 0 : if (tokens.size() != (unsigned int) (size1 + 2))
1157 0 : throw ConversionException("Error: incorrect number of values in field \"" +
1158 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1159 :
1160 0 : int k = 2;
1161 : try {
1162 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
1163 0 : result.push_back(CCorrelationMode::newCorrelationMode(tokens.at(k).c_str()));
1164 0 : k++;
1165 : }
1166 : }
1167 0 : catch (...) {
1168 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelationMode.", tableName);
1169 0 : }
1170 :
1171 0 : return result;
1172 0 : }
1173 :
1174 0 : vector<vector<CorrelationModeMod::CorrelationMode> > EnumerationParser::getCorrelationMode2D(const string &name, const string &tableName, const string &xmlDoc) {
1175 0 : vector<vector<CorrelationModeMod::CorrelationMode> > result;
1176 :
1177 0 : string s = getField(xmlDoc,name);
1178 0 : if (s.length() == 0)
1179 0 : throw ConversionException("Error: Missing field \"" +
1180 0 : name + "\" or invalid syntax",tableName);
1181 :
1182 0 : istringstream iss;
1183 0 : iss.str(s);
1184 0 : vector<string> tokens;
1185 :
1186 : // Tokenize.
1187 0 : string buf;
1188 0 : while (iss >> buf) {
1189 0 : tokens.push_back(buf);
1190 : }
1191 :
1192 : // The length must be 3 at the minimum (there may be an empty array)
1193 0 : if (tokens.size() < 3)
1194 0 : throw ConversionException("Error: missing values in field \"" +
1195 0 : name + "\" or invalid syntax(" + s +"')",tableName);
1196 :
1197 :
1198 : // The number of dimension should be 2.
1199 0 : if (tokens.at(0) != "2")
1200 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
1201 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1202 :
1203 : // Then parse the size of the two dimensions
1204 0 : errno = 0;
1205 0 : int size1 = atoi(tokens.at(1).c_str());
1206 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1207 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1208 :
1209 0 : if (size1 <= 0)
1210 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
1211 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1212 0 : errno = 0;
1213 0 : int size2 = atoi(tokens.at(2).c_str());
1214 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1215 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1216 :
1217 0 : if (size2 < 0)
1218 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
1219 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1220 :
1221 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
1222 0 : throw ConversionException("Error: incorrect number of values in field \"" +
1223 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1224 :
1225 0 : int k = 3;
1226 : try {
1227 0 : vector<CorrelationModeMod::CorrelationMode> v_aux;
1228 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
1229 0 : v_aux.clear();
1230 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
1231 0 : v_aux.push_back(CCorrelationMode::newCorrelationMode(tokens.at(k).c_str()));
1232 0 : k++;
1233 : }
1234 0 : result.push_back(v_aux);
1235 : }
1236 0 : }
1237 0 : catch (...) {
1238 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelationMode.", tableName);
1239 0 : }
1240 0 : return result;
1241 0 : }
1242 :
1243 :
1244 0 : vector<vector<vector<CorrelationModeMod::CorrelationMode> > > EnumerationParser::getCorrelationMode3D(const string &name, const string &tableName, const string &xmlDoc) {
1245 0 : vector<vector<vector<CorrelationModeMod::CorrelationMode> > >result;
1246 :
1247 0 : string s = getField(xmlDoc,name);
1248 0 : if (s.length() == 0)
1249 0 : throw ConversionException("Error: Missing field \"" +
1250 0 : name + "\" or invalid syntax",tableName);
1251 :
1252 0 : istringstream iss;
1253 0 : iss.str(s);
1254 0 : vector<string> tokens;
1255 :
1256 : // Tokenize.
1257 0 : string buf;
1258 0 : while (iss >> buf) {
1259 0 : tokens.push_back(buf);
1260 : }
1261 :
1262 : // The length must be 4 at the minimum (there may be an empty array)
1263 0 : if (tokens.size() < 4)
1264 0 : throw ConversionException("Error: missing values in field \"" +
1265 0 : name + "\" or invalid syntax(" + s +"')",tableName);
1266 :
1267 :
1268 : // The number of dimension should be 3.
1269 0 : if (tokens.at(0) != "3")
1270 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
1271 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1272 :
1273 : // Then parse the size of the three dimensions
1274 0 : errno = 0;
1275 0 : int size1 = atoi(tokens.at(1).c_str());
1276 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1277 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1278 :
1279 0 : if (size1 <= 0)
1280 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
1281 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1282 :
1283 0 : errno = 0;
1284 0 : int size2 = atoi(tokens.at(2).c_str());
1285 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1286 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1287 :
1288 0 : if (size2 <= 0)
1289 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
1290 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1291 :
1292 0 : errno = 0;
1293 0 : int size3 = atoi(tokens.at(3).c_str());
1294 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1295 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1296 :
1297 :
1298 0 : if (size3 < 0)
1299 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
1300 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1301 :
1302 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
1303 0 : throw ConversionException("Error: incorrect number of values in field \"" +
1304 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1305 :
1306 0 : int k = 4;
1307 : try {
1308 0 : vector<CorrelationModeMod::CorrelationMode> v_aux;
1309 0 : vector<vector<CorrelationModeMod::CorrelationMode> > vv_aux;
1310 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
1311 0 : vv_aux.clear();
1312 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
1313 0 : v_aux.clear();
1314 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
1315 0 : v_aux.push_back(CCorrelationMode::newCorrelationMode(tokens.at(k).c_str()));
1316 0 : k++;
1317 : }
1318 0 : vv_aux.push_back(v_aux);
1319 : }
1320 0 : result.push_back(vv_aux);
1321 : }
1322 0 : }
1323 0 : catch (...) {
1324 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelationMode.", tableName);
1325 0 : }
1326 :
1327 0 : return result;
1328 0 : }
1329 :
1330 :
1331 :
1332 :
1333 :
1334 0 : string EnumerationParser::toXML(const string& elementName, AtmPhaseCorrectionMod::AtmPhaseCorrection e) {
1335 0 : return "<"+elementName+">"+CAtmPhaseCorrection::name(e)+"</"+elementName+">";
1336 : }
1337 :
1338 35 : string EnumerationParser::toXML(const string& elementName, const vector<AtmPhaseCorrectionMod::AtmPhaseCorrection>& v_e) {
1339 35 : ostringstream oss;
1340 : oss << "<" << elementName << ">"
1341 : << " 1"
1342 35 : << " " << v_e.size();
1343 :
1344 70 : for (unsigned int i = 0; i < v_e.size(); i++)
1345 35 : oss << " " << CAtmPhaseCorrection::name(v_e.at(i));
1346 35 : oss << "</" << elementName << ">";
1347 70 : return oss.str();
1348 35 : }
1349 :
1350 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<AtmPhaseCorrectionMod::AtmPhaseCorrection> >& vv_e) {
1351 0 : ostringstream oss;
1352 : oss << "<" << elementName << ">"
1353 : << " 2"
1354 0 : << " " <<vv_e.size()
1355 0 : << " " <<vv_e.at(0).size();
1356 :
1357 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
1358 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
1359 0 : oss << " " << CAtmPhaseCorrection::name(vv_e.at(i).at(j));
1360 0 : oss << "</" << elementName << ">";
1361 0 : return oss.str();
1362 0 : }
1363 :
1364 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<AtmPhaseCorrectionMod::AtmPhaseCorrection> > >& vvv_e) {
1365 0 : ostringstream oss;
1366 : oss << "<" << elementName << ">"
1367 : << " 3"
1368 0 : << " " <<vvv_e.size()
1369 0 : << " " <<vvv_e.at(0).size()
1370 0 : << " " <<vvv_e.at(0).at(0).size();
1371 :
1372 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
1373 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
1374 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
1375 0 : oss << " " << CAtmPhaseCorrection::name(vvv_e.at(i).at(j).at(k));
1376 0 : oss << "</" << elementName << ">";
1377 0 : return oss.str();
1378 0 : }
1379 :
1380 65 : AtmPhaseCorrectionMod::AtmPhaseCorrection EnumerationParser::getAtmPhaseCorrection(const string &name, const string &tableName, const string &xmlDoc) {
1381 65 : string s = getField(xmlDoc,name);
1382 65 : if (s.length() == 0)
1383 0 : throw ConversionException("Error: Missing field \"" +
1384 0 : name + "\" or invalid syntax",tableName);
1385 :
1386 : AtmPhaseCorrection result;
1387 : try {
1388 65 : result = CAtmPhaseCorrection::newAtmPhaseCorrection(s);
1389 : }
1390 0 : catch (...) {
1391 0 : throw ConversionException("Error: could not convert '"+s+"' into a AtmPhaseCorrection.", tableName);
1392 0 : }
1393 65 : return result;
1394 65 : }
1395 :
1396 351 : vector<AtmPhaseCorrectionMod::AtmPhaseCorrection> EnumerationParser::getAtmPhaseCorrection1D(const string &name, const string &tableName, const string &xmlDoc) {
1397 351 : vector<AtmPhaseCorrectionMod::AtmPhaseCorrection> result;
1398 :
1399 351 : string s = getField(xmlDoc,name);
1400 351 : if (s.length() == 0)
1401 0 : throw ConversionException("Error: Missing field \"" +
1402 0 : name + "\" or invalid syntax",tableName);
1403 :
1404 351 : istringstream iss;
1405 351 : iss.str(s);
1406 351 : vector<string> tokens;
1407 :
1408 : // Tokenize.
1409 351 : string buf;
1410 1420 : while (iss >> buf) {
1411 1069 : tokens.push_back(buf);
1412 : }
1413 :
1414 : // The length must be 2 at the minimum (there may be an empty array)
1415 351 : if (tokens.size() < 2)
1416 0 : throw ConversionException("Error: missing values in field \"" +
1417 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1418 :
1419 :
1420 :
1421 : // The number of dimension should be 1.
1422 351 : if (tokens.at(0) != "1")
1423 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
1424 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1425 :
1426 : // Then parse the size of the unique dimension
1427 351 : errno = 0;
1428 351 : int size1 = atoi(tokens.at(1).c_str());
1429 351 : if (errno != 0) throw ConversionException("Error: Field \"" +
1430 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1431 :
1432 351 : if (size1 < 0)
1433 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
1434 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1435 :
1436 351 : if (tokens.size() != (unsigned int) (size1 + 2))
1437 0 : throw ConversionException("Error: incorrect number of values in field \"" +
1438 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1439 :
1440 351 : int k = 2;
1441 : try {
1442 718 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
1443 367 : result.push_back(CAtmPhaseCorrection::newAtmPhaseCorrection(tokens.at(k).c_str()));
1444 367 : k++;
1445 : }
1446 : }
1447 0 : catch (...) {
1448 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AtmPhaseCorrection.", tableName);
1449 0 : }
1450 :
1451 702 : return result;
1452 351 : }
1453 :
1454 0 : vector<vector<AtmPhaseCorrectionMod::AtmPhaseCorrection> > EnumerationParser::getAtmPhaseCorrection2D(const string &name, const string &tableName, const string &xmlDoc) {
1455 0 : vector<vector<AtmPhaseCorrectionMod::AtmPhaseCorrection> > result;
1456 :
1457 0 : string s = getField(xmlDoc,name);
1458 0 : if (s.length() == 0)
1459 0 : throw ConversionException("Error: Missing field \"" +
1460 0 : name + "\" or invalid syntax",tableName);
1461 :
1462 0 : istringstream iss;
1463 0 : iss.str(s);
1464 0 : vector<string> tokens;
1465 :
1466 : // Tokenize.
1467 0 : string buf;
1468 0 : while (iss >> buf) {
1469 0 : tokens.push_back(buf);
1470 : }
1471 :
1472 : // The length must be 3 at the minimum (there may be an empty array)
1473 0 : if (tokens.size() < 3)
1474 0 : throw ConversionException("Error: missing values in field \"" +
1475 0 : name + "\" or invalid syntax(" + s +"')",tableName);
1476 :
1477 :
1478 : // The number of dimension should be 2.
1479 0 : if (tokens.at(0) != "2")
1480 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
1481 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1482 :
1483 : // Then parse the size of the two dimensions
1484 0 : errno = 0;
1485 0 : int size1 = atoi(tokens.at(1).c_str());
1486 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1487 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1488 :
1489 0 : if (size1 <= 0)
1490 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
1491 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1492 0 : errno = 0;
1493 0 : int size2 = atoi(tokens.at(2).c_str());
1494 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1495 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1496 :
1497 0 : if (size2 < 0)
1498 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
1499 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1500 :
1501 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
1502 0 : throw ConversionException("Error: incorrect number of values in field \"" +
1503 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1504 :
1505 0 : int k = 3;
1506 : try {
1507 0 : vector<AtmPhaseCorrectionMod::AtmPhaseCorrection> v_aux;
1508 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
1509 0 : v_aux.clear();
1510 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
1511 0 : v_aux.push_back(CAtmPhaseCorrection::newAtmPhaseCorrection(tokens.at(k).c_str()));
1512 0 : k++;
1513 : }
1514 0 : result.push_back(v_aux);
1515 : }
1516 0 : }
1517 0 : catch (...) {
1518 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AtmPhaseCorrection.", tableName);
1519 0 : }
1520 0 : return result;
1521 0 : }
1522 :
1523 :
1524 0 : vector<vector<vector<AtmPhaseCorrectionMod::AtmPhaseCorrection> > > EnumerationParser::getAtmPhaseCorrection3D(const string &name, const string &tableName, const string &xmlDoc) {
1525 0 : vector<vector<vector<AtmPhaseCorrectionMod::AtmPhaseCorrection> > >result;
1526 :
1527 0 : string s = getField(xmlDoc,name);
1528 0 : if (s.length() == 0)
1529 0 : throw ConversionException("Error: Missing field \"" +
1530 0 : name + "\" or invalid syntax",tableName);
1531 :
1532 0 : istringstream iss;
1533 0 : iss.str(s);
1534 0 : vector<string> tokens;
1535 :
1536 : // Tokenize.
1537 0 : string buf;
1538 0 : while (iss >> buf) {
1539 0 : tokens.push_back(buf);
1540 : }
1541 :
1542 : // The length must be 4 at the minimum (there may be an empty array)
1543 0 : if (tokens.size() < 4)
1544 0 : throw ConversionException("Error: missing values in field \"" +
1545 0 : name + "\" or invalid syntax(" + s +"')",tableName);
1546 :
1547 :
1548 : // The number of dimension should be 3.
1549 0 : if (tokens.at(0) != "3")
1550 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
1551 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1552 :
1553 : // Then parse the size of the three dimensions
1554 0 : errno = 0;
1555 0 : int size1 = atoi(tokens.at(1).c_str());
1556 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1557 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1558 :
1559 0 : if (size1 <= 0)
1560 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
1561 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1562 :
1563 0 : errno = 0;
1564 0 : int size2 = atoi(tokens.at(2).c_str());
1565 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1566 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1567 :
1568 0 : if (size2 <= 0)
1569 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
1570 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1571 :
1572 0 : errno = 0;
1573 0 : int size3 = atoi(tokens.at(3).c_str());
1574 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1575 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1576 :
1577 :
1578 0 : if (size3 < 0)
1579 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
1580 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1581 :
1582 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
1583 0 : throw ConversionException("Error: incorrect number of values in field \"" +
1584 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1585 :
1586 0 : int k = 4;
1587 : try {
1588 0 : vector<AtmPhaseCorrectionMod::AtmPhaseCorrection> v_aux;
1589 0 : vector<vector<AtmPhaseCorrectionMod::AtmPhaseCorrection> > vv_aux;
1590 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
1591 0 : vv_aux.clear();
1592 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
1593 0 : v_aux.clear();
1594 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
1595 0 : v_aux.push_back(CAtmPhaseCorrection::newAtmPhaseCorrection(tokens.at(k).c_str()));
1596 0 : k++;
1597 : }
1598 0 : vv_aux.push_back(v_aux);
1599 : }
1600 0 : result.push_back(vv_aux);
1601 : }
1602 0 : }
1603 0 : catch (...) {
1604 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a AtmPhaseCorrection.", tableName);
1605 0 : }
1606 :
1607 0 : return result;
1608 0 : }
1609 :
1610 :
1611 :
1612 :
1613 :
1614 48 : string EnumerationParser::toXML(const string& elementName, ProcessorTypeMod::ProcessorType e) {
1615 96 : return "<"+elementName+">"+CProcessorType::name(e)+"</"+elementName+">";
1616 : }
1617 :
1618 0 : string EnumerationParser::toXML(const string& elementName, const vector<ProcessorTypeMod::ProcessorType>& v_e) {
1619 0 : ostringstream oss;
1620 : oss << "<" << elementName << ">"
1621 : << " 1"
1622 0 : << " " << v_e.size();
1623 :
1624 0 : for (unsigned int i = 0; i < v_e.size(); i++)
1625 0 : oss << " " << CProcessorType::name(v_e.at(i));
1626 0 : oss << "</" << elementName << ">";
1627 0 : return oss.str();
1628 0 : }
1629 :
1630 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<ProcessorTypeMod::ProcessorType> >& vv_e) {
1631 0 : ostringstream oss;
1632 : oss << "<" << elementName << ">"
1633 : << " 2"
1634 0 : << " " <<vv_e.size()
1635 0 : << " " <<vv_e.at(0).size();
1636 :
1637 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
1638 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
1639 0 : oss << " " << CProcessorType::name(vv_e.at(i).at(j));
1640 0 : oss << "</" << elementName << ">";
1641 0 : return oss.str();
1642 0 : }
1643 :
1644 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<ProcessorTypeMod::ProcessorType> > >& vvv_e) {
1645 0 : ostringstream oss;
1646 : oss << "<" << elementName << ">"
1647 : << " 3"
1648 0 : << " " <<vvv_e.size()
1649 0 : << " " <<vvv_e.at(0).size()
1650 0 : << " " <<vvv_e.at(0).at(0).size();
1651 :
1652 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
1653 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
1654 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
1655 0 : oss << " " << CProcessorType::name(vvv_e.at(i).at(j).at(k));
1656 0 : oss << "</" << elementName << ">";
1657 0 : return oss.str();
1658 0 : }
1659 :
1660 502 : ProcessorTypeMod::ProcessorType EnumerationParser::getProcessorType(const string &name, const string &tableName, const string &xmlDoc) {
1661 502 : string s = getField(xmlDoc,name);
1662 502 : if (s.length() == 0)
1663 0 : throw ConversionException("Error: Missing field \"" +
1664 0 : name + "\" or invalid syntax",tableName);
1665 :
1666 : ProcessorType result;
1667 : try {
1668 502 : result = CProcessorType::newProcessorType(s);
1669 : }
1670 0 : catch (...) {
1671 0 : throw ConversionException("Error: could not convert '"+s+"' into a ProcessorType.", tableName);
1672 0 : }
1673 502 : return result;
1674 502 : }
1675 :
1676 0 : vector<ProcessorTypeMod::ProcessorType> EnumerationParser::getProcessorType1D(const string &name, const string &tableName, const string &xmlDoc) {
1677 0 : vector<ProcessorTypeMod::ProcessorType> result;
1678 :
1679 0 : string s = getField(xmlDoc,name);
1680 0 : if (s.length() == 0)
1681 0 : throw ConversionException("Error: Missing field \"" +
1682 0 : name + "\" or invalid syntax",tableName);
1683 :
1684 0 : istringstream iss;
1685 0 : iss.str(s);
1686 0 : vector<string> tokens;
1687 :
1688 : // Tokenize.
1689 0 : string buf;
1690 0 : while (iss >> buf) {
1691 0 : tokens.push_back(buf);
1692 : }
1693 :
1694 : // The length must be 2 at the minimum (there may be an empty array)
1695 0 : if (tokens.size() < 2)
1696 0 : throw ConversionException("Error: missing values in field \"" +
1697 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1698 :
1699 :
1700 :
1701 : // The number of dimension should be 1.
1702 0 : if (tokens.at(0) != "1")
1703 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
1704 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1705 :
1706 : // Then parse the size of the unique dimension
1707 0 : errno = 0;
1708 0 : int size1 = atoi(tokens.at(1).c_str());
1709 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1710 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1711 :
1712 0 : if (size1 < 0)
1713 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
1714 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1715 :
1716 0 : if (tokens.size() != (unsigned int) (size1 + 2))
1717 0 : throw ConversionException("Error: incorrect number of values in field \"" +
1718 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1719 :
1720 0 : int k = 2;
1721 : try {
1722 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
1723 0 : result.push_back(CProcessorType::newProcessorType(tokens.at(k).c_str()));
1724 0 : k++;
1725 : }
1726 : }
1727 0 : catch (...) {
1728 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ProcessorType.", tableName);
1729 0 : }
1730 :
1731 0 : return result;
1732 0 : }
1733 :
1734 0 : vector<vector<ProcessorTypeMod::ProcessorType> > EnumerationParser::getProcessorType2D(const string &name, const string &tableName, const string &xmlDoc) {
1735 0 : vector<vector<ProcessorTypeMod::ProcessorType> > result;
1736 :
1737 0 : string s = getField(xmlDoc,name);
1738 0 : if (s.length() == 0)
1739 0 : throw ConversionException("Error: Missing field \"" +
1740 0 : name + "\" or invalid syntax",tableName);
1741 :
1742 0 : istringstream iss;
1743 0 : iss.str(s);
1744 0 : vector<string> tokens;
1745 :
1746 : // Tokenize.
1747 0 : string buf;
1748 0 : while (iss >> buf) {
1749 0 : tokens.push_back(buf);
1750 : }
1751 :
1752 : // The length must be 3 at the minimum (there may be an empty array)
1753 0 : if (tokens.size() < 3)
1754 0 : throw ConversionException("Error: missing values in field \"" +
1755 0 : name + "\" or invalid syntax(" + s +"')",tableName);
1756 :
1757 :
1758 : // The number of dimension should be 2.
1759 0 : if (tokens.at(0) != "2")
1760 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
1761 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1762 :
1763 : // Then parse the size of the two dimensions
1764 0 : errno = 0;
1765 0 : int size1 = atoi(tokens.at(1).c_str());
1766 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1767 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1768 :
1769 0 : if (size1 <= 0)
1770 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
1771 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1772 0 : errno = 0;
1773 0 : int size2 = atoi(tokens.at(2).c_str());
1774 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1775 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1776 :
1777 0 : if (size2 < 0)
1778 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
1779 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1780 :
1781 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
1782 0 : throw ConversionException("Error: incorrect number of values in field \"" +
1783 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1784 :
1785 0 : int k = 3;
1786 : try {
1787 0 : vector<ProcessorTypeMod::ProcessorType> v_aux;
1788 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
1789 0 : v_aux.clear();
1790 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
1791 0 : v_aux.push_back(CProcessorType::newProcessorType(tokens.at(k).c_str()));
1792 0 : k++;
1793 : }
1794 0 : result.push_back(v_aux);
1795 : }
1796 0 : }
1797 0 : catch (...) {
1798 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ProcessorType.", tableName);
1799 0 : }
1800 0 : return result;
1801 0 : }
1802 :
1803 :
1804 0 : vector<vector<vector<ProcessorTypeMod::ProcessorType> > > EnumerationParser::getProcessorType3D(const string &name, const string &tableName, const string &xmlDoc) {
1805 0 : vector<vector<vector<ProcessorTypeMod::ProcessorType> > >result;
1806 :
1807 0 : string s = getField(xmlDoc,name);
1808 0 : if (s.length() == 0)
1809 0 : throw ConversionException("Error: Missing field \"" +
1810 0 : name + "\" or invalid syntax",tableName);
1811 :
1812 0 : istringstream iss;
1813 0 : iss.str(s);
1814 0 : vector<string> tokens;
1815 :
1816 : // Tokenize.
1817 0 : string buf;
1818 0 : while (iss >> buf) {
1819 0 : tokens.push_back(buf);
1820 : }
1821 :
1822 : // The length must be 4 at the minimum (there may be an empty array)
1823 0 : if (tokens.size() < 4)
1824 0 : throw ConversionException("Error: missing values in field \"" +
1825 0 : name + "\" or invalid syntax(" + s +"')",tableName);
1826 :
1827 :
1828 : // The number of dimension should be 3.
1829 0 : if (tokens.at(0) != "3")
1830 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
1831 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1832 :
1833 : // Then parse the size of the three dimensions
1834 0 : errno = 0;
1835 0 : int size1 = atoi(tokens.at(1).c_str());
1836 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1837 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1838 :
1839 0 : if (size1 <= 0)
1840 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
1841 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1842 :
1843 0 : errno = 0;
1844 0 : int size2 = atoi(tokens.at(2).c_str());
1845 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1846 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1847 :
1848 0 : if (size2 <= 0)
1849 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
1850 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1851 :
1852 0 : errno = 0;
1853 0 : int size3 = atoi(tokens.at(3).c_str());
1854 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
1855 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1856 :
1857 :
1858 0 : if (size3 < 0)
1859 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
1860 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1861 :
1862 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
1863 0 : throw ConversionException("Error: incorrect number of values in field \"" +
1864 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1865 :
1866 0 : int k = 4;
1867 : try {
1868 0 : vector<ProcessorTypeMod::ProcessorType> v_aux;
1869 0 : vector<vector<ProcessorTypeMod::ProcessorType> > vv_aux;
1870 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
1871 0 : vv_aux.clear();
1872 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
1873 0 : v_aux.clear();
1874 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
1875 0 : v_aux.push_back(CProcessorType::newProcessorType(tokens.at(k).c_str()));
1876 0 : k++;
1877 : }
1878 0 : vv_aux.push_back(v_aux);
1879 : }
1880 0 : result.push_back(vv_aux);
1881 : }
1882 0 : }
1883 0 : catch (...) {
1884 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a ProcessorType.", tableName);
1885 0 : }
1886 :
1887 0 : return result;
1888 0 : }
1889 :
1890 :
1891 :
1892 :
1893 :
1894 35 : string EnumerationParser::toXML(const string& elementName, SpectralResolutionTypeMod::SpectralResolutionType e) {
1895 70 : return "<"+elementName+">"+CSpectralResolutionType::name(e)+"</"+elementName+">";
1896 : }
1897 :
1898 0 : string EnumerationParser::toXML(const string& elementName, const vector<SpectralResolutionTypeMod::SpectralResolutionType>& v_e) {
1899 0 : ostringstream oss;
1900 : oss << "<" << elementName << ">"
1901 : << " 1"
1902 0 : << " " << v_e.size();
1903 :
1904 0 : for (unsigned int i = 0; i < v_e.size(); i++)
1905 0 : oss << " " << CSpectralResolutionType::name(v_e.at(i));
1906 0 : oss << "</" << elementName << ">";
1907 0 : return oss.str();
1908 0 : }
1909 :
1910 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<SpectralResolutionTypeMod::SpectralResolutionType> >& vv_e) {
1911 0 : ostringstream oss;
1912 : oss << "<" << elementName << ">"
1913 : << " 2"
1914 0 : << " " <<vv_e.size()
1915 0 : << " " <<vv_e.at(0).size();
1916 :
1917 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
1918 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
1919 0 : oss << " " << CSpectralResolutionType::name(vv_e.at(i).at(j));
1920 0 : oss << "</" << elementName << ">";
1921 0 : return oss.str();
1922 0 : }
1923 :
1924 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<SpectralResolutionTypeMod::SpectralResolutionType> > >& vvv_e) {
1925 0 : ostringstream oss;
1926 : oss << "<" << elementName << ">"
1927 : << " 3"
1928 0 : << " " <<vvv_e.size()
1929 0 : << " " <<vvv_e.at(0).size()
1930 0 : << " " <<vvv_e.at(0).at(0).size();
1931 :
1932 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
1933 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
1934 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
1935 0 : oss << " " << CSpectralResolutionType::name(vvv_e.at(i).at(j).at(k));
1936 0 : oss << "</" << elementName << ">";
1937 0 : return oss.str();
1938 0 : }
1939 :
1940 351 : SpectralResolutionTypeMod::SpectralResolutionType EnumerationParser::getSpectralResolutionType(const string &name, const string &tableName, const string &xmlDoc) {
1941 351 : string s = getField(xmlDoc,name);
1942 351 : if (s.length() == 0)
1943 0 : throw ConversionException("Error: Missing field \"" +
1944 0 : name + "\" or invalid syntax",tableName);
1945 :
1946 : SpectralResolutionType result;
1947 : try {
1948 351 : result = CSpectralResolutionType::newSpectralResolutionType(s);
1949 : }
1950 0 : catch (...) {
1951 0 : throw ConversionException("Error: could not convert '"+s+"' into a SpectralResolutionType.", tableName);
1952 0 : }
1953 351 : return result;
1954 351 : }
1955 :
1956 2268 : vector<SpectralResolutionTypeMod::SpectralResolutionType> EnumerationParser::getSpectralResolutionType1D(const string &name, const string &tableName, const string &xmlDoc) {
1957 2268 : vector<SpectralResolutionTypeMod::SpectralResolutionType> result;
1958 :
1959 2268 : string s = getField(xmlDoc,name);
1960 2268 : if (s.length() == 0)
1961 0 : throw ConversionException("Error: Missing field \"" +
1962 0 : name + "\" or invalid syntax",tableName);
1963 :
1964 2268 : istringstream iss;
1965 2268 : iss.str(s);
1966 2268 : vector<string> tokens;
1967 :
1968 : // Tokenize.
1969 2268 : string buf;
1970 49441 : while (iss >> buf) {
1971 47173 : tokens.push_back(buf);
1972 : }
1973 :
1974 : // The length must be 2 at the minimum (there may be an empty array)
1975 2268 : if (tokens.size() < 2)
1976 0 : throw ConversionException("Error: missing values in field \"" +
1977 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1978 :
1979 :
1980 :
1981 : // The number of dimension should be 1.
1982 2268 : if (tokens.at(0) != "1")
1983 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
1984 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1985 :
1986 : // Then parse the size of the unique dimension
1987 2268 : errno = 0;
1988 2268 : int size1 = atoi(tokens.at(1).c_str());
1989 2268 : if (errno != 0) throw ConversionException("Error: Field \"" +
1990 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
1991 :
1992 2268 : if (size1 < 0)
1993 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
1994 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1995 :
1996 2268 : if (tokens.size() != (unsigned int) (size1 + 2))
1997 0 : throw ConversionException("Error: incorrect number of values in field \"" +
1998 0 : name + "\" or invalid syntax('" + s +"')",tableName);
1999 :
2000 2268 : int k = 2;
2001 : try {
2002 44905 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
2003 42637 : result.push_back(CSpectralResolutionType::newSpectralResolutionType(tokens.at(k).c_str()));
2004 42637 : k++;
2005 : }
2006 : }
2007 0 : catch (...) {
2008 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SpectralResolutionType.", tableName);
2009 0 : }
2010 :
2011 4536 : return result;
2012 2268 : }
2013 :
2014 0 : vector<vector<SpectralResolutionTypeMod::SpectralResolutionType> > EnumerationParser::getSpectralResolutionType2D(const string &name, const string &tableName, const string &xmlDoc) {
2015 0 : vector<vector<SpectralResolutionTypeMod::SpectralResolutionType> > result;
2016 :
2017 0 : string s = getField(xmlDoc,name);
2018 0 : if (s.length() == 0)
2019 0 : throw ConversionException("Error: Missing field \"" +
2020 0 : name + "\" or invalid syntax",tableName);
2021 :
2022 0 : istringstream iss;
2023 0 : iss.str(s);
2024 0 : vector<string> tokens;
2025 :
2026 : // Tokenize.
2027 0 : string buf;
2028 0 : while (iss >> buf) {
2029 0 : tokens.push_back(buf);
2030 : }
2031 :
2032 : // The length must be 3 at the minimum (there may be an empty array)
2033 0 : if (tokens.size() < 3)
2034 0 : throw ConversionException("Error: missing values in field \"" +
2035 0 : name + "\" or invalid syntax(" + s +"')",tableName);
2036 :
2037 :
2038 : // The number of dimension should be 2.
2039 0 : if (tokens.at(0) != "2")
2040 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
2041 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2042 :
2043 : // Then parse the size of the two dimensions
2044 0 : errno = 0;
2045 0 : int size1 = atoi(tokens.at(1).c_str());
2046 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2047 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2048 :
2049 0 : if (size1 <= 0)
2050 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2051 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2052 0 : errno = 0;
2053 0 : int size2 = atoi(tokens.at(2).c_str());
2054 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2055 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2056 :
2057 0 : if (size2 < 0)
2058 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
2059 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2060 :
2061 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
2062 0 : throw ConversionException("Error: incorrect number of values in field \"" +
2063 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2064 :
2065 0 : int k = 3;
2066 : try {
2067 0 : vector<SpectralResolutionTypeMod::SpectralResolutionType> v_aux;
2068 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
2069 0 : v_aux.clear();
2070 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
2071 0 : v_aux.push_back(CSpectralResolutionType::newSpectralResolutionType(tokens.at(k).c_str()));
2072 0 : k++;
2073 : }
2074 0 : result.push_back(v_aux);
2075 : }
2076 0 : }
2077 0 : catch (...) {
2078 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SpectralResolutionType.", tableName);
2079 0 : }
2080 0 : return result;
2081 0 : }
2082 :
2083 :
2084 0 : vector<vector<vector<SpectralResolutionTypeMod::SpectralResolutionType> > > EnumerationParser::getSpectralResolutionType3D(const string &name, const string &tableName, const string &xmlDoc) {
2085 0 : vector<vector<vector<SpectralResolutionTypeMod::SpectralResolutionType> > >result;
2086 :
2087 0 : string s = getField(xmlDoc,name);
2088 0 : if (s.length() == 0)
2089 0 : throw ConversionException("Error: Missing field \"" +
2090 0 : name + "\" or invalid syntax",tableName);
2091 :
2092 0 : istringstream iss;
2093 0 : iss.str(s);
2094 0 : vector<string> tokens;
2095 :
2096 : // Tokenize.
2097 0 : string buf;
2098 0 : while (iss >> buf) {
2099 0 : tokens.push_back(buf);
2100 : }
2101 :
2102 : // The length must be 4 at the minimum (there may be an empty array)
2103 0 : if (tokens.size() < 4)
2104 0 : throw ConversionException("Error: missing values in field \"" +
2105 0 : name + "\" or invalid syntax(" + s +"')",tableName);
2106 :
2107 :
2108 : // The number of dimension should be 3.
2109 0 : if (tokens.at(0) != "3")
2110 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
2111 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2112 :
2113 : // Then parse the size of the three dimensions
2114 0 : errno = 0;
2115 0 : int size1 = atoi(tokens.at(1).c_str());
2116 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2117 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2118 :
2119 0 : if (size1 <= 0)
2120 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2121 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2122 :
2123 0 : errno = 0;
2124 0 : int size2 = atoi(tokens.at(2).c_str());
2125 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2126 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2127 :
2128 0 : if (size2 <= 0)
2129 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2130 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2131 :
2132 0 : errno = 0;
2133 0 : int size3 = atoi(tokens.at(3).c_str());
2134 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2135 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2136 :
2137 :
2138 0 : if (size3 < 0)
2139 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
2140 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2141 :
2142 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
2143 0 : throw ConversionException("Error: incorrect number of values in field \"" +
2144 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2145 :
2146 0 : int k = 4;
2147 : try {
2148 0 : vector<SpectralResolutionTypeMod::SpectralResolutionType> v_aux;
2149 0 : vector<vector<SpectralResolutionTypeMod::SpectralResolutionType> > vv_aux;
2150 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
2151 0 : vv_aux.clear();
2152 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
2153 0 : v_aux.clear();
2154 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
2155 0 : v_aux.push_back(CSpectralResolutionType::newSpectralResolutionType(tokens.at(k).c_str()));
2156 0 : k++;
2157 : }
2158 0 : vv_aux.push_back(v_aux);
2159 : }
2160 0 : result.push_back(vv_aux);
2161 : }
2162 0 : }
2163 0 : catch (...) {
2164 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a SpectralResolutionType.", tableName);
2165 0 : }
2166 :
2167 0 : return result;
2168 0 : }
2169 :
2170 :
2171 :
2172 :
2173 :
2174 16 : string EnumerationParser::toXML(const string& elementName, CalibrationDeviceMod::CalibrationDevice e) {
2175 32 : return "<"+elementName+">"+CCalibrationDevice::name(e)+"</"+elementName+">";
2176 : }
2177 :
2178 0 : string EnumerationParser::toXML(const string& elementName, const vector<CalibrationDeviceMod::CalibrationDevice>& v_e) {
2179 0 : ostringstream oss;
2180 : oss << "<" << elementName << ">"
2181 : << " 1"
2182 0 : << " " << v_e.size();
2183 :
2184 0 : for (unsigned int i = 0; i < v_e.size(); i++)
2185 0 : oss << " " << CCalibrationDevice::name(v_e.at(i));
2186 0 : oss << "</" << elementName << ">";
2187 0 : return oss.str();
2188 0 : }
2189 :
2190 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CalibrationDeviceMod::CalibrationDevice> >& vv_e) {
2191 0 : ostringstream oss;
2192 : oss << "<" << elementName << ">"
2193 : << " 2"
2194 0 : << " " <<vv_e.size()
2195 0 : << " " <<vv_e.at(0).size();
2196 :
2197 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
2198 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
2199 0 : oss << " " << CCalibrationDevice::name(vv_e.at(i).at(j));
2200 0 : oss << "</" << elementName << ">";
2201 0 : return oss.str();
2202 0 : }
2203 :
2204 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CalibrationDeviceMod::CalibrationDevice> > >& vvv_e) {
2205 0 : ostringstream oss;
2206 : oss << "<" << elementName << ">"
2207 : << " 3"
2208 0 : << " " <<vvv_e.size()
2209 0 : << " " <<vvv_e.at(0).size()
2210 0 : << " " <<vvv_e.at(0).at(0).size();
2211 :
2212 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
2213 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
2214 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
2215 0 : oss << " " << CCalibrationDevice::name(vvv_e.at(i).at(j).at(k));
2216 0 : oss << "</" << elementName << ">";
2217 0 : return oss.str();
2218 0 : }
2219 :
2220 154 : CalibrationDeviceMod::CalibrationDevice EnumerationParser::getCalibrationDevice(const string &name, const string &tableName, const string &xmlDoc) {
2221 154 : string s = getField(xmlDoc,name);
2222 154 : if (s.length() == 0)
2223 0 : throw ConversionException("Error: Missing field \"" +
2224 0 : name + "\" or invalid syntax",tableName);
2225 :
2226 : CalibrationDevice result;
2227 : try {
2228 154 : result = CCalibrationDevice::newCalibrationDevice(s);
2229 : }
2230 0 : catch (...) {
2231 0 : throw ConversionException("Error: could not convert '"+s+"' into a CalibrationDevice.", tableName);
2232 0 : }
2233 154 : return result;
2234 154 : }
2235 :
2236 39304 : vector<CalibrationDeviceMod::CalibrationDevice> EnumerationParser::getCalibrationDevice1D(const string &name, const string &tableName, const string &xmlDoc) {
2237 39304 : vector<CalibrationDeviceMod::CalibrationDevice> result;
2238 :
2239 39304 : string s = getField(xmlDoc,name);
2240 39304 : if (s.length() == 0)
2241 0 : throw ConversionException("Error: Missing field \"" +
2242 0 : name + "\" or invalid syntax",tableName);
2243 :
2244 39304 : istringstream iss;
2245 39304 : iss.str(s);
2246 39304 : vector<string> tokens;
2247 :
2248 : // Tokenize.
2249 39304 : string buf;
2250 192200 : while (iss >> buf) {
2251 152896 : tokens.push_back(buf);
2252 : }
2253 :
2254 : // The length must be 2 at the minimum (there may be an empty array)
2255 39304 : if (tokens.size() < 2)
2256 0 : throw ConversionException("Error: missing values in field \"" +
2257 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2258 :
2259 :
2260 :
2261 : // The number of dimension should be 1.
2262 39304 : if (tokens.at(0) != "1")
2263 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
2264 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2265 :
2266 : // Then parse the size of the unique dimension
2267 39304 : errno = 0;
2268 39304 : int size1 = atoi(tokens.at(1).c_str());
2269 39304 : if (errno != 0) throw ConversionException("Error: Field \"" +
2270 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2271 :
2272 39304 : if (size1 < 0)
2273 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
2274 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2275 :
2276 39304 : if (tokens.size() != (unsigned int) (size1 + 2))
2277 0 : throw ConversionException("Error: incorrect number of values in field \"" +
2278 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2279 :
2280 39304 : int k = 2;
2281 : try {
2282 113592 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
2283 74288 : result.push_back(CCalibrationDevice::newCalibrationDevice(tokens.at(k).c_str()));
2284 74288 : k++;
2285 : }
2286 : }
2287 0 : catch (...) {
2288 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationDevice.", tableName);
2289 0 : }
2290 :
2291 78608 : return result;
2292 39304 : }
2293 :
2294 0 : vector<vector<CalibrationDeviceMod::CalibrationDevice> > EnumerationParser::getCalibrationDevice2D(const string &name, const string &tableName, const string &xmlDoc) {
2295 0 : vector<vector<CalibrationDeviceMod::CalibrationDevice> > result;
2296 :
2297 0 : string s = getField(xmlDoc,name);
2298 0 : if (s.length() == 0)
2299 0 : throw ConversionException("Error: Missing field \"" +
2300 0 : name + "\" or invalid syntax",tableName);
2301 :
2302 0 : istringstream iss;
2303 0 : iss.str(s);
2304 0 : vector<string> tokens;
2305 :
2306 : // Tokenize.
2307 0 : string buf;
2308 0 : while (iss >> buf) {
2309 0 : tokens.push_back(buf);
2310 : }
2311 :
2312 : // The length must be 3 at the minimum (there may be an empty array)
2313 0 : if (tokens.size() < 3)
2314 0 : throw ConversionException("Error: missing values in field \"" +
2315 0 : name + "\" or invalid syntax(" + s +"')",tableName);
2316 :
2317 :
2318 : // The number of dimension should be 2.
2319 0 : if (tokens.at(0) != "2")
2320 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
2321 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2322 :
2323 : // Then parse the size of the two dimensions
2324 0 : errno = 0;
2325 0 : int size1 = atoi(tokens.at(1).c_str());
2326 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2327 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2328 :
2329 0 : if (size1 <= 0)
2330 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2331 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2332 0 : errno = 0;
2333 0 : int size2 = atoi(tokens.at(2).c_str());
2334 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2335 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2336 :
2337 0 : if (size2 < 0)
2338 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
2339 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2340 :
2341 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
2342 0 : throw ConversionException("Error: incorrect number of values in field \"" +
2343 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2344 :
2345 0 : int k = 3;
2346 : try {
2347 0 : vector<CalibrationDeviceMod::CalibrationDevice> v_aux;
2348 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
2349 0 : v_aux.clear();
2350 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
2351 0 : v_aux.push_back(CCalibrationDevice::newCalibrationDevice(tokens.at(k).c_str()));
2352 0 : k++;
2353 : }
2354 0 : result.push_back(v_aux);
2355 : }
2356 0 : }
2357 0 : catch (...) {
2358 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationDevice.", tableName);
2359 0 : }
2360 0 : return result;
2361 0 : }
2362 :
2363 :
2364 0 : vector<vector<vector<CalibrationDeviceMod::CalibrationDevice> > > EnumerationParser::getCalibrationDevice3D(const string &name, const string &tableName, const string &xmlDoc) {
2365 0 : vector<vector<vector<CalibrationDeviceMod::CalibrationDevice> > >result;
2366 :
2367 0 : string s = getField(xmlDoc,name);
2368 0 : if (s.length() == 0)
2369 0 : throw ConversionException("Error: Missing field \"" +
2370 0 : name + "\" or invalid syntax",tableName);
2371 :
2372 0 : istringstream iss;
2373 0 : iss.str(s);
2374 0 : vector<string> tokens;
2375 :
2376 : // Tokenize.
2377 0 : string buf;
2378 0 : while (iss >> buf) {
2379 0 : tokens.push_back(buf);
2380 : }
2381 :
2382 : // The length must be 4 at the minimum (there may be an empty array)
2383 0 : if (tokens.size() < 4)
2384 0 : throw ConversionException("Error: missing values in field \"" +
2385 0 : name + "\" or invalid syntax(" + s +"')",tableName);
2386 :
2387 :
2388 : // The number of dimension should be 3.
2389 0 : if (tokens.at(0) != "3")
2390 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
2391 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2392 :
2393 : // Then parse the size of the three dimensions
2394 0 : errno = 0;
2395 0 : int size1 = atoi(tokens.at(1).c_str());
2396 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2397 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2398 :
2399 0 : if (size1 <= 0)
2400 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2401 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2402 :
2403 0 : errno = 0;
2404 0 : int size2 = atoi(tokens.at(2).c_str());
2405 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2406 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2407 :
2408 0 : if (size2 <= 0)
2409 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2410 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2411 :
2412 0 : errno = 0;
2413 0 : int size3 = atoi(tokens.at(3).c_str());
2414 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2415 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2416 :
2417 :
2418 0 : if (size3 < 0)
2419 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
2420 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2421 :
2422 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
2423 0 : throw ConversionException("Error: incorrect number of values in field \"" +
2424 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2425 :
2426 0 : int k = 4;
2427 : try {
2428 0 : vector<CalibrationDeviceMod::CalibrationDevice> v_aux;
2429 0 : vector<vector<CalibrationDeviceMod::CalibrationDevice> > vv_aux;
2430 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
2431 0 : vv_aux.clear();
2432 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
2433 0 : v_aux.clear();
2434 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
2435 0 : v_aux.push_back(CCalibrationDevice::newCalibrationDevice(tokens.at(k).c_str()));
2436 0 : k++;
2437 : }
2438 0 : vv_aux.push_back(v_aux);
2439 : }
2440 0 : result.push_back(vv_aux);
2441 : }
2442 0 : }
2443 0 : catch (...) {
2444 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationDevice.", tableName);
2445 0 : }
2446 :
2447 0 : return result;
2448 0 : }
2449 :
2450 :
2451 :
2452 :
2453 :
2454 251 : string EnumerationParser::toXML(const string& elementName, AntennaMakeMod::AntennaMake e) {
2455 502 : return "<"+elementName+">"+CAntennaMake::name(e)+"</"+elementName+">";
2456 : }
2457 :
2458 0 : string EnumerationParser::toXML(const string& elementName, const vector<AntennaMakeMod::AntennaMake>& v_e) {
2459 0 : ostringstream oss;
2460 : oss << "<" << elementName << ">"
2461 : << " 1"
2462 0 : << " " << v_e.size();
2463 :
2464 0 : for (unsigned int i = 0; i < v_e.size(); i++)
2465 0 : oss << " " << CAntennaMake::name(v_e.at(i));
2466 0 : oss << "</" << elementName << ">";
2467 0 : return oss.str();
2468 0 : }
2469 :
2470 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<AntennaMakeMod::AntennaMake> >& vv_e) {
2471 0 : ostringstream oss;
2472 : oss << "<" << elementName << ">"
2473 : << " 2"
2474 0 : << " " <<vv_e.size()
2475 0 : << " " <<vv_e.at(0).size();
2476 :
2477 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
2478 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
2479 0 : oss << " " << CAntennaMake::name(vv_e.at(i).at(j));
2480 0 : oss << "</" << elementName << ">";
2481 0 : return oss.str();
2482 0 : }
2483 :
2484 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<AntennaMakeMod::AntennaMake> > >& vvv_e) {
2485 0 : ostringstream oss;
2486 : oss << "<" << elementName << ">"
2487 : << " 3"
2488 0 : << " " <<vvv_e.size()
2489 0 : << " " <<vvv_e.at(0).size()
2490 0 : << " " <<vvv_e.at(0).at(0).size();
2491 :
2492 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
2493 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
2494 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
2495 0 : oss << " " << CAntennaMake::name(vvv_e.at(i).at(j).at(k));
2496 0 : oss << "</" << elementName << ">";
2497 0 : return oss.str();
2498 0 : }
2499 :
2500 1854 : AntennaMakeMod::AntennaMake EnumerationParser::getAntennaMake(const string &name, const string &tableName, const string &xmlDoc) {
2501 1854 : string s = getField(xmlDoc,name);
2502 1854 : if (s.length() == 0)
2503 0 : throw ConversionException("Error: Missing field \"" +
2504 0 : name + "\" or invalid syntax",tableName);
2505 :
2506 : AntennaMake result;
2507 : try {
2508 1854 : result = CAntennaMake::newAntennaMake(s);
2509 : }
2510 0 : catch (...) {
2511 0 : throw ConversionException("Error: could not convert '"+s+"' into a AntennaMake.", tableName);
2512 0 : }
2513 1854 : return result;
2514 1854 : }
2515 :
2516 0 : vector<AntennaMakeMod::AntennaMake> EnumerationParser::getAntennaMake1D(const string &name, const string &tableName, const string &xmlDoc) {
2517 0 : vector<AntennaMakeMod::AntennaMake> result;
2518 :
2519 0 : string s = getField(xmlDoc,name);
2520 0 : if (s.length() == 0)
2521 0 : throw ConversionException("Error: Missing field \"" +
2522 0 : name + "\" or invalid syntax",tableName);
2523 :
2524 0 : istringstream iss;
2525 0 : iss.str(s);
2526 0 : vector<string> tokens;
2527 :
2528 : // Tokenize.
2529 0 : string buf;
2530 0 : while (iss >> buf) {
2531 0 : tokens.push_back(buf);
2532 : }
2533 :
2534 : // The length must be 2 at the minimum (there may be an empty array)
2535 0 : if (tokens.size() < 2)
2536 0 : throw ConversionException("Error: missing values in field \"" +
2537 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2538 :
2539 :
2540 :
2541 : // The number of dimension should be 1.
2542 0 : if (tokens.at(0) != "1")
2543 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
2544 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2545 :
2546 : // Then parse the size of the unique dimension
2547 0 : errno = 0;
2548 0 : int size1 = atoi(tokens.at(1).c_str());
2549 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2550 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2551 :
2552 0 : if (size1 < 0)
2553 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
2554 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2555 :
2556 0 : if (tokens.size() != (unsigned int) (size1 + 2))
2557 0 : throw ConversionException("Error: incorrect number of values in field \"" +
2558 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2559 :
2560 0 : int k = 2;
2561 : try {
2562 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
2563 0 : result.push_back(CAntennaMake::newAntennaMake(tokens.at(k).c_str()));
2564 0 : k++;
2565 : }
2566 : }
2567 0 : catch (...) {
2568 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AntennaMake.", tableName);
2569 0 : }
2570 :
2571 0 : return result;
2572 0 : }
2573 :
2574 0 : vector<vector<AntennaMakeMod::AntennaMake> > EnumerationParser::getAntennaMake2D(const string &name, const string &tableName, const string &xmlDoc) {
2575 0 : vector<vector<AntennaMakeMod::AntennaMake> > result;
2576 :
2577 0 : string s = getField(xmlDoc,name);
2578 0 : if (s.length() == 0)
2579 0 : throw ConversionException("Error: Missing field \"" +
2580 0 : name + "\" or invalid syntax",tableName);
2581 :
2582 0 : istringstream iss;
2583 0 : iss.str(s);
2584 0 : vector<string> tokens;
2585 :
2586 : // Tokenize.
2587 0 : string buf;
2588 0 : while (iss >> buf) {
2589 0 : tokens.push_back(buf);
2590 : }
2591 :
2592 : // The length must be 3 at the minimum (there may be an empty array)
2593 0 : if (tokens.size() < 3)
2594 0 : throw ConversionException("Error: missing values in field \"" +
2595 0 : name + "\" or invalid syntax(" + s +"')",tableName);
2596 :
2597 :
2598 : // The number of dimension should be 2.
2599 0 : if (tokens.at(0) != "2")
2600 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
2601 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2602 :
2603 : // Then parse the size of the two dimensions
2604 0 : errno = 0;
2605 0 : int size1 = atoi(tokens.at(1).c_str());
2606 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2607 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2608 :
2609 0 : if (size1 <= 0)
2610 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2611 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2612 0 : errno = 0;
2613 0 : int size2 = atoi(tokens.at(2).c_str());
2614 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2615 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2616 :
2617 0 : if (size2 < 0)
2618 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
2619 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2620 :
2621 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
2622 0 : throw ConversionException("Error: incorrect number of values in field \"" +
2623 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2624 :
2625 0 : int k = 3;
2626 : try {
2627 0 : vector<AntennaMakeMod::AntennaMake> v_aux;
2628 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
2629 0 : v_aux.clear();
2630 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
2631 0 : v_aux.push_back(CAntennaMake::newAntennaMake(tokens.at(k).c_str()));
2632 0 : k++;
2633 : }
2634 0 : result.push_back(v_aux);
2635 : }
2636 0 : }
2637 0 : catch (...) {
2638 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AntennaMake.", tableName);
2639 0 : }
2640 0 : return result;
2641 0 : }
2642 :
2643 :
2644 0 : vector<vector<vector<AntennaMakeMod::AntennaMake> > > EnumerationParser::getAntennaMake3D(const string &name, const string &tableName, const string &xmlDoc) {
2645 0 : vector<vector<vector<AntennaMakeMod::AntennaMake> > >result;
2646 :
2647 0 : string s = getField(xmlDoc,name);
2648 0 : if (s.length() == 0)
2649 0 : throw ConversionException("Error: Missing field \"" +
2650 0 : name + "\" or invalid syntax",tableName);
2651 :
2652 0 : istringstream iss;
2653 0 : iss.str(s);
2654 0 : vector<string> tokens;
2655 :
2656 : // Tokenize.
2657 0 : string buf;
2658 0 : while (iss >> buf) {
2659 0 : tokens.push_back(buf);
2660 : }
2661 :
2662 : // The length must be 4 at the minimum (there may be an empty array)
2663 0 : if (tokens.size() < 4)
2664 0 : throw ConversionException("Error: missing values in field \"" +
2665 0 : name + "\" or invalid syntax(" + s +"')",tableName);
2666 :
2667 :
2668 : // The number of dimension should be 3.
2669 0 : if (tokens.at(0) != "3")
2670 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
2671 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2672 :
2673 : // Then parse the size of the three dimensions
2674 0 : errno = 0;
2675 0 : int size1 = atoi(tokens.at(1).c_str());
2676 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2677 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2678 :
2679 0 : if (size1 <= 0)
2680 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2681 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2682 :
2683 0 : errno = 0;
2684 0 : int size2 = atoi(tokens.at(2).c_str());
2685 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2686 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2687 :
2688 0 : if (size2 <= 0)
2689 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2690 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2691 :
2692 0 : errno = 0;
2693 0 : int size3 = atoi(tokens.at(3).c_str());
2694 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2695 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2696 :
2697 :
2698 0 : if (size3 < 0)
2699 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
2700 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2701 :
2702 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
2703 0 : throw ConversionException("Error: incorrect number of values in field \"" +
2704 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2705 :
2706 0 : int k = 4;
2707 : try {
2708 0 : vector<AntennaMakeMod::AntennaMake> v_aux;
2709 0 : vector<vector<AntennaMakeMod::AntennaMake> > vv_aux;
2710 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
2711 0 : vv_aux.clear();
2712 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
2713 0 : v_aux.clear();
2714 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
2715 0 : v_aux.push_back(CAntennaMake::newAntennaMake(tokens.at(k).c_str()));
2716 0 : k++;
2717 : }
2718 0 : vv_aux.push_back(v_aux);
2719 : }
2720 0 : result.push_back(vv_aux);
2721 : }
2722 0 : }
2723 0 : catch (...) {
2724 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a AntennaMake.", tableName);
2725 0 : }
2726 :
2727 0 : return result;
2728 0 : }
2729 :
2730 :
2731 :
2732 :
2733 :
2734 251 : string EnumerationParser::toXML(const string& elementName, AntennaTypeMod::AntennaType e) {
2735 502 : return "<"+elementName+">"+CAntennaType::name(e)+"</"+elementName+">";
2736 : }
2737 :
2738 0 : string EnumerationParser::toXML(const string& elementName, const vector<AntennaTypeMod::AntennaType>& v_e) {
2739 0 : ostringstream oss;
2740 : oss << "<" << elementName << ">"
2741 : << " 1"
2742 0 : << " " << v_e.size();
2743 :
2744 0 : for (unsigned int i = 0; i < v_e.size(); i++)
2745 0 : oss << " " << CAntennaType::name(v_e.at(i));
2746 0 : oss << "</" << elementName << ">";
2747 0 : return oss.str();
2748 0 : }
2749 :
2750 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<AntennaTypeMod::AntennaType> >& vv_e) {
2751 0 : ostringstream oss;
2752 : oss << "<" << elementName << ">"
2753 : << " 2"
2754 0 : << " " <<vv_e.size()
2755 0 : << " " <<vv_e.at(0).size();
2756 :
2757 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
2758 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
2759 0 : oss << " " << CAntennaType::name(vv_e.at(i).at(j));
2760 0 : oss << "</" << elementName << ">";
2761 0 : return oss.str();
2762 0 : }
2763 :
2764 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<AntennaTypeMod::AntennaType> > >& vvv_e) {
2765 0 : ostringstream oss;
2766 : oss << "<" << elementName << ">"
2767 : << " 3"
2768 0 : << " " <<vvv_e.size()
2769 0 : << " " <<vvv_e.at(0).size()
2770 0 : << " " <<vvv_e.at(0).at(0).size();
2771 :
2772 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
2773 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
2774 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
2775 0 : oss << " " << CAntennaType::name(vvv_e.at(i).at(j).at(k));
2776 0 : oss << "</" << elementName << ">";
2777 0 : return oss.str();
2778 0 : }
2779 :
2780 1794 : AntennaTypeMod::AntennaType EnumerationParser::getAntennaType(const string &name, const string &tableName, const string &xmlDoc) {
2781 1794 : string s = getField(xmlDoc,name);
2782 1794 : if (s.length() == 0)
2783 0 : throw ConversionException("Error: Missing field \"" +
2784 0 : name + "\" or invalid syntax",tableName);
2785 :
2786 : AntennaType result;
2787 : try {
2788 1794 : result = CAntennaType::newAntennaType(s);
2789 : }
2790 0 : catch (...) {
2791 0 : throw ConversionException("Error: could not convert '"+s+"' into a AntennaType.", tableName);
2792 0 : }
2793 1794 : return result;
2794 1794 : }
2795 :
2796 0 : vector<AntennaTypeMod::AntennaType> EnumerationParser::getAntennaType1D(const string &name, const string &tableName, const string &xmlDoc) {
2797 0 : vector<AntennaTypeMod::AntennaType> result;
2798 :
2799 0 : string s = getField(xmlDoc,name);
2800 0 : if (s.length() == 0)
2801 0 : throw ConversionException("Error: Missing field \"" +
2802 0 : name + "\" or invalid syntax",tableName);
2803 :
2804 0 : istringstream iss;
2805 0 : iss.str(s);
2806 0 : vector<string> tokens;
2807 :
2808 : // Tokenize.
2809 0 : string buf;
2810 0 : while (iss >> buf) {
2811 0 : tokens.push_back(buf);
2812 : }
2813 :
2814 : // The length must be 2 at the minimum (there may be an empty array)
2815 0 : if (tokens.size() < 2)
2816 0 : throw ConversionException("Error: missing values in field \"" +
2817 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2818 :
2819 :
2820 :
2821 : // The number of dimension should be 1.
2822 0 : if (tokens.at(0) != "1")
2823 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
2824 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2825 :
2826 : // Then parse the size of the unique dimension
2827 0 : errno = 0;
2828 0 : int size1 = atoi(tokens.at(1).c_str());
2829 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2830 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2831 :
2832 0 : if (size1 < 0)
2833 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
2834 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2835 :
2836 0 : if (tokens.size() != (unsigned int) (size1 + 2))
2837 0 : throw ConversionException("Error: incorrect number of values in field \"" +
2838 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2839 :
2840 0 : int k = 2;
2841 : try {
2842 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
2843 0 : result.push_back(CAntennaType::newAntennaType(tokens.at(k).c_str()));
2844 0 : k++;
2845 : }
2846 : }
2847 0 : catch (...) {
2848 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AntennaType.", tableName);
2849 0 : }
2850 :
2851 0 : return result;
2852 0 : }
2853 :
2854 0 : vector<vector<AntennaTypeMod::AntennaType> > EnumerationParser::getAntennaType2D(const string &name, const string &tableName, const string &xmlDoc) {
2855 0 : vector<vector<AntennaTypeMod::AntennaType> > result;
2856 :
2857 0 : string s = getField(xmlDoc,name);
2858 0 : if (s.length() == 0)
2859 0 : throw ConversionException("Error: Missing field \"" +
2860 0 : name + "\" or invalid syntax",tableName);
2861 :
2862 0 : istringstream iss;
2863 0 : iss.str(s);
2864 0 : vector<string> tokens;
2865 :
2866 : // Tokenize.
2867 0 : string buf;
2868 0 : while (iss >> buf) {
2869 0 : tokens.push_back(buf);
2870 : }
2871 :
2872 : // The length must be 3 at the minimum (there may be an empty array)
2873 0 : if (tokens.size() < 3)
2874 0 : throw ConversionException("Error: missing values in field \"" +
2875 0 : name + "\" or invalid syntax(" + s +"')",tableName);
2876 :
2877 :
2878 : // The number of dimension should be 2.
2879 0 : if (tokens.at(0) != "2")
2880 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
2881 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2882 :
2883 : // Then parse the size of the two dimensions
2884 0 : errno = 0;
2885 0 : int size1 = atoi(tokens.at(1).c_str());
2886 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2887 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2888 :
2889 0 : if (size1 <= 0)
2890 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2891 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2892 0 : errno = 0;
2893 0 : int size2 = atoi(tokens.at(2).c_str());
2894 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2895 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2896 :
2897 0 : if (size2 < 0)
2898 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
2899 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2900 :
2901 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
2902 0 : throw ConversionException("Error: incorrect number of values in field \"" +
2903 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2904 :
2905 0 : int k = 3;
2906 : try {
2907 0 : vector<AntennaTypeMod::AntennaType> v_aux;
2908 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
2909 0 : v_aux.clear();
2910 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
2911 0 : v_aux.push_back(CAntennaType::newAntennaType(tokens.at(k).c_str()));
2912 0 : k++;
2913 : }
2914 0 : result.push_back(v_aux);
2915 : }
2916 0 : }
2917 0 : catch (...) {
2918 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AntennaType.", tableName);
2919 0 : }
2920 0 : return result;
2921 0 : }
2922 :
2923 :
2924 0 : vector<vector<vector<AntennaTypeMod::AntennaType> > > EnumerationParser::getAntennaType3D(const string &name, const string &tableName, const string &xmlDoc) {
2925 0 : vector<vector<vector<AntennaTypeMod::AntennaType> > >result;
2926 :
2927 0 : string s = getField(xmlDoc,name);
2928 0 : if (s.length() == 0)
2929 0 : throw ConversionException("Error: Missing field \"" +
2930 0 : name + "\" or invalid syntax",tableName);
2931 :
2932 0 : istringstream iss;
2933 0 : iss.str(s);
2934 0 : vector<string> tokens;
2935 :
2936 : // Tokenize.
2937 0 : string buf;
2938 0 : while (iss >> buf) {
2939 0 : tokens.push_back(buf);
2940 : }
2941 :
2942 : // The length must be 4 at the minimum (there may be an empty array)
2943 0 : if (tokens.size() < 4)
2944 0 : throw ConversionException("Error: missing values in field \"" +
2945 0 : name + "\" or invalid syntax(" + s +"')",tableName);
2946 :
2947 :
2948 : // The number of dimension should be 3.
2949 0 : if (tokens.at(0) != "3")
2950 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
2951 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2952 :
2953 : // Then parse the size of the three dimensions
2954 0 : errno = 0;
2955 0 : int size1 = atoi(tokens.at(1).c_str());
2956 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2957 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2958 :
2959 0 : if (size1 <= 0)
2960 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2961 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2962 :
2963 0 : errno = 0;
2964 0 : int size2 = atoi(tokens.at(2).c_str());
2965 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2966 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2967 :
2968 0 : if (size2 <= 0)
2969 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
2970 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2971 :
2972 0 : errno = 0;
2973 0 : int size3 = atoi(tokens.at(3).c_str());
2974 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
2975 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
2976 :
2977 :
2978 0 : if (size3 < 0)
2979 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
2980 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2981 :
2982 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
2983 0 : throw ConversionException("Error: incorrect number of values in field \"" +
2984 0 : name + "\" or invalid syntax('" + s +"')",tableName);
2985 :
2986 0 : int k = 4;
2987 : try {
2988 0 : vector<AntennaTypeMod::AntennaType> v_aux;
2989 0 : vector<vector<AntennaTypeMod::AntennaType> > vv_aux;
2990 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
2991 0 : vv_aux.clear();
2992 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
2993 0 : v_aux.clear();
2994 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
2995 0 : v_aux.push_back(CAntennaType::newAntennaType(tokens.at(k).c_str()));
2996 0 : k++;
2997 : }
2998 0 : vv_aux.push_back(v_aux);
2999 : }
3000 0 : result.push_back(vv_aux);
3001 : }
3002 0 : }
3003 0 : catch (...) {
3004 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a AntennaType.", tableName);
3005 0 : }
3006 :
3007 0 : return result;
3008 0 : }
3009 :
3010 :
3011 :
3012 :
3013 :
3014 0 : string EnumerationParser::toXML(const string& elementName, SourceModelMod::SourceModel e) {
3015 0 : return "<"+elementName+">"+CSourceModel::name(e)+"</"+elementName+">";
3016 : }
3017 :
3018 0 : string EnumerationParser::toXML(const string& elementName, const vector<SourceModelMod::SourceModel>& v_e) {
3019 0 : ostringstream oss;
3020 : oss << "<" << elementName << ">"
3021 : << " 1"
3022 0 : << " " << v_e.size();
3023 :
3024 0 : for (unsigned int i = 0; i < v_e.size(); i++)
3025 0 : oss << " " << CSourceModel::name(v_e.at(i));
3026 0 : oss << "</" << elementName << ">";
3027 0 : return oss.str();
3028 0 : }
3029 :
3030 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<SourceModelMod::SourceModel> >& vv_e) {
3031 0 : ostringstream oss;
3032 : oss << "<" << elementName << ">"
3033 : << " 2"
3034 0 : << " " <<vv_e.size()
3035 0 : << " " <<vv_e.at(0).size();
3036 :
3037 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
3038 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
3039 0 : oss << " " << CSourceModel::name(vv_e.at(i).at(j));
3040 0 : oss << "</" << elementName << ">";
3041 0 : return oss.str();
3042 0 : }
3043 :
3044 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<SourceModelMod::SourceModel> > >& vvv_e) {
3045 0 : ostringstream oss;
3046 : oss << "<" << elementName << ">"
3047 : << " 3"
3048 0 : << " " <<vvv_e.size()
3049 0 : << " " <<vvv_e.at(0).size()
3050 0 : << " " <<vvv_e.at(0).at(0).size();
3051 :
3052 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
3053 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
3054 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
3055 0 : oss << " " << CSourceModel::name(vvv_e.at(i).at(j).at(k));
3056 0 : oss << "</" << elementName << ">";
3057 0 : return oss.str();
3058 0 : }
3059 :
3060 0 : SourceModelMod::SourceModel EnumerationParser::getSourceModel(const string &name, const string &tableName, const string &xmlDoc) {
3061 0 : string s = getField(xmlDoc,name);
3062 0 : if (s.length() == 0)
3063 0 : throw ConversionException("Error: Missing field \"" +
3064 0 : name + "\" or invalid syntax",tableName);
3065 :
3066 : SourceModel result;
3067 : try {
3068 0 : result = CSourceModel::newSourceModel(s);
3069 : }
3070 0 : catch (...) {
3071 0 : throw ConversionException("Error: could not convert '"+s+"' into a SourceModel.", tableName);
3072 0 : }
3073 0 : return result;
3074 0 : }
3075 :
3076 0 : vector<SourceModelMod::SourceModel> EnumerationParser::getSourceModel1D(const string &name, const string &tableName, const string &xmlDoc) {
3077 0 : vector<SourceModelMod::SourceModel> result;
3078 :
3079 0 : string s = getField(xmlDoc,name);
3080 0 : if (s.length() == 0)
3081 0 : throw ConversionException("Error: Missing field \"" +
3082 0 : name + "\" or invalid syntax",tableName);
3083 :
3084 0 : istringstream iss;
3085 0 : iss.str(s);
3086 0 : vector<string> tokens;
3087 :
3088 : // Tokenize.
3089 0 : string buf;
3090 0 : while (iss >> buf) {
3091 0 : tokens.push_back(buf);
3092 : }
3093 :
3094 : // The length must be 2 at the minimum (there may be an empty array)
3095 0 : if (tokens.size() < 2)
3096 0 : throw ConversionException("Error: missing values in field \"" +
3097 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3098 :
3099 :
3100 :
3101 : // The number of dimension should be 1.
3102 0 : if (tokens.at(0) != "1")
3103 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
3104 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3105 :
3106 : // Then parse the size of the unique dimension
3107 0 : errno = 0;
3108 0 : int size1 = atoi(tokens.at(1).c_str());
3109 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3110 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3111 :
3112 0 : if (size1 < 0)
3113 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
3114 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3115 :
3116 0 : if (tokens.size() != (unsigned int) (size1 + 2))
3117 0 : throw ConversionException("Error: incorrect number of values in field \"" +
3118 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3119 :
3120 0 : int k = 2;
3121 : try {
3122 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
3123 0 : result.push_back(CSourceModel::newSourceModel(tokens.at(k).c_str()));
3124 0 : k++;
3125 : }
3126 : }
3127 0 : catch (...) {
3128 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SourceModel.", tableName);
3129 0 : }
3130 :
3131 0 : return result;
3132 0 : }
3133 :
3134 0 : vector<vector<SourceModelMod::SourceModel> > EnumerationParser::getSourceModel2D(const string &name, const string &tableName, const string &xmlDoc) {
3135 0 : vector<vector<SourceModelMod::SourceModel> > result;
3136 :
3137 0 : string s = getField(xmlDoc,name);
3138 0 : if (s.length() == 0)
3139 0 : throw ConversionException("Error: Missing field \"" +
3140 0 : name + "\" or invalid syntax",tableName);
3141 :
3142 0 : istringstream iss;
3143 0 : iss.str(s);
3144 0 : vector<string> tokens;
3145 :
3146 : // Tokenize.
3147 0 : string buf;
3148 0 : while (iss >> buf) {
3149 0 : tokens.push_back(buf);
3150 : }
3151 :
3152 : // The length must be 3 at the minimum (there may be an empty array)
3153 0 : if (tokens.size() < 3)
3154 0 : throw ConversionException("Error: missing values in field \"" +
3155 0 : name + "\" or invalid syntax(" + s +"')",tableName);
3156 :
3157 :
3158 : // The number of dimension should be 2.
3159 0 : if (tokens.at(0) != "2")
3160 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
3161 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3162 :
3163 : // Then parse the size of the two dimensions
3164 0 : errno = 0;
3165 0 : int size1 = atoi(tokens.at(1).c_str());
3166 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3167 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3168 :
3169 0 : if (size1 <= 0)
3170 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
3171 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3172 0 : errno = 0;
3173 0 : int size2 = atoi(tokens.at(2).c_str());
3174 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3175 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3176 :
3177 0 : if (size2 < 0)
3178 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
3179 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3180 :
3181 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
3182 0 : throw ConversionException("Error: incorrect number of values in field \"" +
3183 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3184 :
3185 0 : int k = 3;
3186 : try {
3187 0 : vector<SourceModelMod::SourceModel> v_aux;
3188 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
3189 0 : v_aux.clear();
3190 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
3191 0 : v_aux.push_back(CSourceModel::newSourceModel(tokens.at(k).c_str()));
3192 0 : k++;
3193 : }
3194 0 : result.push_back(v_aux);
3195 : }
3196 0 : }
3197 0 : catch (...) {
3198 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SourceModel.", tableName);
3199 0 : }
3200 0 : return result;
3201 0 : }
3202 :
3203 :
3204 0 : vector<vector<vector<SourceModelMod::SourceModel> > > EnumerationParser::getSourceModel3D(const string &name, const string &tableName, const string &xmlDoc) {
3205 0 : vector<vector<vector<SourceModelMod::SourceModel> > >result;
3206 :
3207 0 : string s = getField(xmlDoc,name);
3208 0 : if (s.length() == 0)
3209 0 : throw ConversionException("Error: Missing field \"" +
3210 0 : name + "\" or invalid syntax",tableName);
3211 :
3212 0 : istringstream iss;
3213 0 : iss.str(s);
3214 0 : vector<string> tokens;
3215 :
3216 : // Tokenize.
3217 0 : string buf;
3218 0 : while (iss >> buf) {
3219 0 : tokens.push_back(buf);
3220 : }
3221 :
3222 : // The length must be 4 at the minimum (there may be an empty array)
3223 0 : if (tokens.size() < 4)
3224 0 : throw ConversionException("Error: missing values in field \"" +
3225 0 : name + "\" or invalid syntax(" + s +"')",tableName);
3226 :
3227 :
3228 : // The number of dimension should be 3.
3229 0 : if (tokens.at(0) != "3")
3230 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
3231 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3232 :
3233 : // Then parse the size of the three dimensions
3234 0 : errno = 0;
3235 0 : int size1 = atoi(tokens.at(1).c_str());
3236 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3237 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3238 :
3239 0 : if (size1 <= 0)
3240 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
3241 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3242 :
3243 0 : errno = 0;
3244 0 : int size2 = atoi(tokens.at(2).c_str());
3245 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3246 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3247 :
3248 0 : if (size2 <= 0)
3249 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
3250 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3251 :
3252 0 : errno = 0;
3253 0 : int size3 = atoi(tokens.at(3).c_str());
3254 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3255 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3256 :
3257 :
3258 0 : if (size3 < 0)
3259 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
3260 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3261 :
3262 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
3263 0 : throw ConversionException("Error: incorrect number of values in field \"" +
3264 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3265 :
3266 0 : int k = 4;
3267 : try {
3268 0 : vector<SourceModelMod::SourceModel> v_aux;
3269 0 : vector<vector<SourceModelMod::SourceModel> > vv_aux;
3270 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
3271 0 : vv_aux.clear();
3272 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
3273 0 : v_aux.clear();
3274 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
3275 0 : v_aux.push_back(CSourceModel::newSourceModel(tokens.at(k).c_str()));
3276 0 : k++;
3277 : }
3278 0 : vv_aux.push_back(v_aux);
3279 : }
3280 0 : result.push_back(vv_aux);
3281 : }
3282 0 : }
3283 0 : catch (...) {
3284 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a SourceModel.", tableName);
3285 0 : }
3286 :
3287 0 : return result;
3288 0 : }
3289 :
3290 :
3291 :
3292 :
3293 :
3294 83 : string EnumerationParser::toXML(const string& elementName, FrequencyReferenceCodeMod::FrequencyReferenceCode e) {
3295 166 : return "<"+elementName+">"+CFrequencyReferenceCode::name(e)+"</"+elementName+">";
3296 : }
3297 :
3298 0 : string EnumerationParser::toXML(const string& elementName, const vector<FrequencyReferenceCodeMod::FrequencyReferenceCode>& v_e) {
3299 0 : ostringstream oss;
3300 : oss << "<" << elementName << ">"
3301 : << " 1"
3302 0 : << " " << v_e.size();
3303 :
3304 0 : for (unsigned int i = 0; i < v_e.size(); i++)
3305 0 : oss << " " << CFrequencyReferenceCode::name(v_e.at(i));
3306 0 : oss << "</" << elementName << ">";
3307 0 : return oss.str();
3308 0 : }
3309 :
3310 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<FrequencyReferenceCodeMod::FrequencyReferenceCode> >& vv_e) {
3311 0 : ostringstream oss;
3312 : oss << "<" << elementName << ">"
3313 : << " 2"
3314 0 : << " " <<vv_e.size()
3315 0 : << " " <<vv_e.at(0).size();
3316 :
3317 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
3318 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
3319 0 : oss << " " << CFrequencyReferenceCode::name(vv_e.at(i).at(j));
3320 0 : oss << "</" << elementName << ">";
3321 0 : return oss.str();
3322 0 : }
3323 :
3324 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<FrequencyReferenceCodeMod::FrequencyReferenceCode> > >& vvv_e) {
3325 0 : ostringstream oss;
3326 : oss << "<" << elementName << ">"
3327 : << " 3"
3328 0 : << " " <<vvv_e.size()
3329 0 : << " " <<vvv_e.at(0).size()
3330 0 : << " " <<vvv_e.at(0).at(0).size();
3331 :
3332 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
3333 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
3334 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
3335 0 : oss << " " << CFrequencyReferenceCode::name(vvv_e.at(i).at(j).at(k));
3336 0 : oss << "</" << elementName << ">";
3337 0 : return oss.str();
3338 0 : }
3339 :
3340 4 : FrequencyReferenceCodeMod::FrequencyReferenceCode EnumerationParser::getFrequencyReferenceCode(const string &name, const string &tableName, const string &xmlDoc) {
3341 4 : string s = getField(xmlDoc,name);
3342 4 : if (s.length() == 0)
3343 0 : throw ConversionException("Error: Missing field \"" +
3344 0 : name + "\" or invalid syntax",tableName);
3345 :
3346 : FrequencyReferenceCode result;
3347 : try {
3348 4 : result = CFrequencyReferenceCode::newFrequencyReferenceCode(s);
3349 : }
3350 0 : catch (...) {
3351 0 : throw ConversionException("Error: could not convert '"+s+"' into a FrequencyReferenceCode.", tableName);
3352 0 : }
3353 4 : return result;
3354 4 : }
3355 :
3356 0 : vector<FrequencyReferenceCodeMod::FrequencyReferenceCode> EnumerationParser::getFrequencyReferenceCode1D(const string &name, const string &tableName, const string &xmlDoc) {
3357 0 : vector<FrequencyReferenceCodeMod::FrequencyReferenceCode> result;
3358 :
3359 0 : string s = getField(xmlDoc,name);
3360 0 : if (s.length() == 0)
3361 0 : throw ConversionException("Error: Missing field \"" +
3362 0 : name + "\" or invalid syntax",tableName);
3363 :
3364 0 : istringstream iss;
3365 0 : iss.str(s);
3366 0 : vector<string> tokens;
3367 :
3368 : // Tokenize.
3369 0 : string buf;
3370 0 : while (iss >> buf) {
3371 0 : tokens.push_back(buf);
3372 : }
3373 :
3374 : // The length must be 2 at the minimum (there may be an empty array)
3375 0 : if (tokens.size() < 2)
3376 0 : throw ConversionException("Error: missing values in field \"" +
3377 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3378 :
3379 :
3380 :
3381 : // The number of dimension should be 1.
3382 0 : if (tokens.at(0) != "1")
3383 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
3384 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3385 :
3386 : // Then parse the size of the unique dimension
3387 0 : errno = 0;
3388 0 : int size1 = atoi(tokens.at(1).c_str());
3389 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3390 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3391 :
3392 0 : if (size1 < 0)
3393 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
3394 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3395 :
3396 0 : if (tokens.size() != (unsigned int) (size1 + 2))
3397 0 : throw ConversionException("Error: incorrect number of values in field \"" +
3398 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3399 :
3400 0 : int k = 2;
3401 : try {
3402 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
3403 0 : result.push_back(CFrequencyReferenceCode::newFrequencyReferenceCode(tokens.at(k).c_str()));
3404 0 : k++;
3405 : }
3406 : }
3407 0 : catch (...) {
3408 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a FrequencyReferenceCode.", tableName);
3409 0 : }
3410 :
3411 0 : return result;
3412 0 : }
3413 :
3414 0 : vector<vector<FrequencyReferenceCodeMod::FrequencyReferenceCode> > EnumerationParser::getFrequencyReferenceCode2D(const string &name, const string &tableName, const string &xmlDoc) {
3415 0 : vector<vector<FrequencyReferenceCodeMod::FrequencyReferenceCode> > result;
3416 :
3417 0 : string s = getField(xmlDoc,name);
3418 0 : if (s.length() == 0)
3419 0 : throw ConversionException("Error: Missing field \"" +
3420 0 : name + "\" or invalid syntax",tableName);
3421 :
3422 0 : istringstream iss;
3423 0 : iss.str(s);
3424 0 : vector<string> tokens;
3425 :
3426 : // Tokenize.
3427 0 : string buf;
3428 0 : while (iss >> buf) {
3429 0 : tokens.push_back(buf);
3430 : }
3431 :
3432 : // The length must be 3 at the minimum (there may be an empty array)
3433 0 : if (tokens.size() < 3)
3434 0 : throw ConversionException("Error: missing values in field \"" +
3435 0 : name + "\" or invalid syntax(" + s +"')",tableName);
3436 :
3437 :
3438 : // The number of dimension should be 2.
3439 0 : if (tokens.at(0) != "2")
3440 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
3441 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3442 :
3443 : // Then parse the size of the two dimensions
3444 0 : errno = 0;
3445 0 : int size1 = atoi(tokens.at(1).c_str());
3446 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3447 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3448 :
3449 0 : if (size1 <= 0)
3450 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
3451 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3452 0 : errno = 0;
3453 0 : int size2 = atoi(tokens.at(2).c_str());
3454 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3455 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3456 :
3457 0 : if (size2 < 0)
3458 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
3459 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3460 :
3461 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
3462 0 : throw ConversionException("Error: incorrect number of values in field \"" +
3463 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3464 :
3465 0 : int k = 3;
3466 : try {
3467 0 : vector<FrequencyReferenceCodeMod::FrequencyReferenceCode> v_aux;
3468 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
3469 0 : v_aux.clear();
3470 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
3471 0 : v_aux.push_back(CFrequencyReferenceCode::newFrequencyReferenceCode(tokens.at(k).c_str()));
3472 0 : k++;
3473 : }
3474 0 : result.push_back(v_aux);
3475 : }
3476 0 : }
3477 0 : catch (...) {
3478 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a FrequencyReferenceCode.", tableName);
3479 0 : }
3480 0 : return result;
3481 0 : }
3482 :
3483 :
3484 0 : vector<vector<vector<FrequencyReferenceCodeMod::FrequencyReferenceCode> > > EnumerationParser::getFrequencyReferenceCode3D(const string &name, const string &tableName, const string &xmlDoc) {
3485 0 : vector<vector<vector<FrequencyReferenceCodeMod::FrequencyReferenceCode> > >result;
3486 :
3487 0 : string s = getField(xmlDoc,name);
3488 0 : if (s.length() == 0)
3489 0 : throw ConversionException("Error: Missing field \"" +
3490 0 : name + "\" or invalid syntax",tableName);
3491 :
3492 0 : istringstream iss;
3493 0 : iss.str(s);
3494 0 : vector<string> tokens;
3495 :
3496 : // Tokenize.
3497 0 : string buf;
3498 0 : while (iss >> buf) {
3499 0 : tokens.push_back(buf);
3500 : }
3501 :
3502 : // The length must be 4 at the minimum (there may be an empty array)
3503 0 : if (tokens.size() < 4)
3504 0 : throw ConversionException("Error: missing values in field \"" +
3505 0 : name + "\" or invalid syntax(" + s +"')",tableName);
3506 :
3507 :
3508 : // The number of dimension should be 3.
3509 0 : if (tokens.at(0) != "3")
3510 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
3511 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3512 :
3513 : // Then parse the size of the three dimensions
3514 0 : errno = 0;
3515 0 : int size1 = atoi(tokens.at(1).c_str());
3516 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3517 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3518 :
3519 0 : if (size1 <= 0)
3520 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
3521 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3522 :
3523 0 : errno = 0;
3524 0 : int size2 = atoi(tokens.at(2).c_str());
3525 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3526 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3527 :
3528 0 : if (size2 <= 0)
3529 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
3530 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3531 :
3532 0 : errno = 0;
3533 0 : int size3 = atoi(tokens.at(3).c_str());
3534 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3535 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3536 :
3537 :
3538 0 : if (size3 < 0)
3539 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
3540 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3541 :
3542 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
3543 0 : throw ConversionException("Error: incorrect number of values in field \"" +
3544 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3545 :
3546 0 : int k = 4;
3547 : try {
3548 0 : vector<FrequencyReferenceCodeMod::FrequencyReferenceCode> v_aux;
3549 0 : vector<vector<FrequencyReferenceCodeMod::FrequencyReferenceCode> > vv_aux;
3550 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
3551 0 : vv_aux.clear();
3552 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
3553 0 : v_aux.clear();
3554 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
3555 0 : v_aux.push_back(CFrequencyReferenceCode::newFrequencyReferenceCode(tokens.at(k).c_str()));
3556 0 : k++;
3557 : }
3558 0 : vv_aux.push_back(v_aux);
3559 : }
3560 0 : result.push_back(vv_aux);
3561 : }
3562 0 : }
3563 0 : catch (...) {
3564 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a FrequencyReferenceCode.", tableName);
3565 0 : }
3566 :
3567 0 : return result;
3568 0 : }
3569 :
3570 :
3571 :
3572 :
3573 :
3574 0 : string EnumerationParser::toXML(const string& elementName, StokesParameterMod::StokesParameter e) {
3575 0 : return "<"+elementName+">"+CStokesParameter::name(e)+"</"+elementName+">";
3576 : }
3577 :
3578 13 : string EnumerationParser::toXML(const string& elementName, const vector<StokesParameterMod::StokesParameter>& v_e) {
3579 13 : ostringstream oss;
3580 : oss << "<" << elementName << ">"
3581 : << " 1"
3582 13 : << " " << v_e.size();
3583 :
3584 38 : for (unsigned int i = 0; i < v_e.size(); i++)
3585 25 : oss << " " << CStokesParameter::name(v_e.at(i));
3586 13 : oss << "</" << elementName << ">";
3587 26 : return oss.str();
3588 13 : }
3589 :
3590 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<StokesParameterMod::StokesParameter> >& vv_e) {
3591 0 : ostringstream oss;
3592 : oss << "<" << elementName << ">"
3593 : << " 2"
3594 0 : << " " <<vv_e.size()
3595 0 : << " " <<vv_e.at(0).size();
3596 :
3597 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
3598 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
3599 0 : oss << " " << CStokesParameter::name(vv_e.at(i).at(j));
3600 0 : oss << "</" << elementName << ">";
3601 0 : return oss.str();
3602 0 : }
3603 :
3604 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<StokesParameterMod::StokesParameter> > >& vvv_e) {
3605 0 : ostringstream oss;
3606 : oss << "<" << elementName << ">"
3607 : << " 3"
3608 0 : << " " <<vvv_e.size()
3609 0 : << " " <<vvv_e.at(0).size()
3610 0 : << " " <<vvv_e.at(0).at(0).size();
3611 :
3612 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
3613 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
3614 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
3615 0 : oss << " " << CStokesParameter::name(vvv_e.at(i).at(j).at(k));
3616 0 : oss << "</" << elementName << ">";
3617 0 : return oss.str();
3618 0 : }
3619 :
3620 0 : StokesParameterMod::StokesParameter EnumerationParser::getStokesParameter(const string &name, const string &tableName, const string &xmlDoc) {
3621 0 : string s = getField(xmlDoc,name);
3622 0 : if (s.length() == 0)
3623 0 : throw ConversionException("Error: Missing field \"" +
3624 0 : name + "\" or invalid syntax",tableName);
3625 :
3626 : StokesParameter result;
3627 : try {
3628 0 : result = CStokesParameter::newStokesParameter(s);
3629 : }
3630 0 : catch (...) {
3631 0 : throw ConversionException("Error: could not convert '"+s+"' into a StokesParameter.", tableName);
3632 0 : }
3633 0 : return result;
3634 0 : }
3635 :
3636 3388 : vector<StokesParameterMod::StokesParameter> EnumerationParser::getStokesParameter1D(const string &name, const string &tableName, const string &xmlDoc) {
3637 3388 : vector<StokesParameterMod::StokesParameter> result;
3638 :
3639 3388 : string s = getField(xmlDoc,name);
3640 3388 : if (s.length() == 0)
3641 0 : throw ConversionException("Error: Missing field \"" +
3642 0 : name + "\" or invalid syntax",tableName);
3643 :
3644 3388 : istringstream iss;
3645 3388 : iss.str(s);
3646 3388 : vector<string> tokens;
3647 :
3648 : // Tokenize.
3649 3388 : string buf;
3650 23463 : while (iss >> buf) {
3651 20075 : tokens.push_back(buf);
3652 : }
3653 :
3654 : // The length must be 2 at the minimum (there may be an empty array)
3655 3388 : if (tokens.size() < 2)
3656 0 : throw ConversionException("Error: missing values in field \"" +
3657 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3658 :
3659 :
3660 :
3661 : // The number of dimension should be 1.
3662 3388 : if (tokens.at(0) != "1")
3663 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
3664 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3665 :
3666 : // Then parse the size of the unique dimension
3667 3388 : errno = 0;
3668 3388 : int size1 = atoi(tokens.at(1).c_str());
3669 3388 : if (errno != 0) throw ConversionException("Error: Field \"" +
3670 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3671 :
3672 3388 : if (size1 < 0)
3673 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
3674 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3675 :
3676 3388 : if (tokens.size() != (unsigned int) (size1 + 2))
3677 0 : throw ConversionException("Error: incorrect number of values in field \"" +
3678 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3679 :
3680 3388 : int k = 2;
3681 : try {
3682 16687 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
3683 13299 : result.push_back(CStokesParameter::newStokesParameter(tokens.at(k).c_str()));
3684 13299 : k++;
3685 : }
3686 : }
3687 0 : catch (...) {
3688 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a StokesParameter.", tableName);
3689 0 : }
3690 :
3691 6776 : return result;
3692 3388 : }
3693 :
3694 0 : vector<vector<StokesParameterMod::StokesParameter> > EnumerationParser::getStokesParameter2D(const string &name, const string &tableName, const string &xmlDoc) {
3695 0 : vector<vector<StokesParameterMod::StokesParameter> > result;
3696 :
3697 0 : string s = getField(xmlDoc,name);
3698 0 : if (s.length() == 0)
3699 0 : throw ConversionException("Error: Missing field \"" +
3700 0 : name + "\" or invalid syntax",tableName);
3701 :
3702 0 : istringstream iss;
3703 0 : iss.str(s);
3704 0 : vector<string> tokens;
3705 :
3706 : // Tokenize.
3707 0 : string buf;
3708 0 : while (iss >> buf) {
3709 0 : tokens.push_back(buf);
3710 : }
3711 :
3712 : // The length must be 3 at the minimum (there may be an empty array)
3713 0 : if (tokens.size() < 3)
3714 0 : throw ConversionException("Error: missing values in field \"" +
3715 0 : name + "\" or invalid syntax(" + s +"')",tableName);
3716 :
3717 :
3718 : // The number of dimension should be 2.
3719 0 : if (tokens.at(0) != "2")
3720 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
3721 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3722 :
3723 : // Then parse the size of the two dimensions
3724 0 : errno = 0;
3725 0 : int size1 = atoi(tokens.at(1).c_str());
3726 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3727 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3728 :
3729 0 : if (size1 <= 0)
3730 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
3731 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3732 0 : errno = 0;
3733 0 : int size2 = atoi(tokens.at(2).c_str());
3734 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3735 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3736 :
3737 0 : if (size2 < 0)
3738 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
3739 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3740 :
3741 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
3742 0 : throw ConversionException("Error: incorrect number of values in field \"" +
3743 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3744 :
3745 0 : int k = 3;
3746 : try {
3747 0 : vector<StokesParameterMod::StokesParameter> v_aux;
3748 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
3749 0 : v_aux.clear();
3750 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
3751 0 : v_aux.push_back(CStokesParameter::newStokesParameter(tokens.at(k).c_str()));
3752 0 : k++;
3753 : }
3754 0 : result.push_back(v_aux);
3755 : }
3756 0 : }
3757 0 : catch (...) {
3758 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a StokesParameter.", tableName);
3759 0 : }
3760 0 : return result;
3761 0 : }
3762 :
3763 :
3764 0 : vector<vector<vector<StokesParameterMod::StokesParameter> > > EnumerationParser::getStokesParameter3D(const string &name, const string &tableName, const string &xmlDoc) {
3765 0 : vector<vector<vector<StokesParameterMod::StokesParameter> > >result;
3766 :
3767 0 : string s = getField(xmlDoc,name);
3768 0 : if (s.length() == 0)
3769 0 : throw ConversionException("Error: Missing field \"" +
3770 0 : name + "\" or invalid syntax",tableName);
3771 :
3772 0 : istringstream iss;
3773 0 : iss.str(s);
3774 0 : vector<string> tokens;
3775 :
3776 : // Tokenize.
3777 0 : string buf;
3778 0 : while (iss >> buf) {
3779 0 : tokens.push_back(buf);
3780 : }
3781 :
3782 : // The length must be 4 at the minimum (there may be an empty array)
3783 0 : if (tokens.size() < 4)
3784 0 : throw ConversionException("Error: missing values in field \"" +
3785 0 : name + "\" or invalid syntax(" + s +"')",tableName);
3786 :
3787 :
3788 : // The number of dimension should be 3.
3789 0 : if (tokens.at(0) != "3")
3790 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
3791 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3792 :
3793 : // Then parse the size of the three dimensions
3794 0 : errno = 0;
3795 0 : int size1 = atoi(tokens.at(1).c_str());
3796 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3797 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3798 :
3799 0 : if (size1 <= 0)
3800 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
3801 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3802 :
3803 0 : errno = 0;
3804 0 : int size2 = atoi(tokens.at(2).c_str());
3805 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3806 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3807 :
3808 0 : if (size2 <= 0)
3809 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
3810 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3811 :
3812 0 : errno = 0;
3813 0 : int size3 = atoi(tokens.at(3).c_str());
3814 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3815 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3816 :
3817 :
3818 0 : if (size3 < 0)
3819 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
3820 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3821 :
3822 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
3823 0 : throw ConversionException("Error: incorrect number of values in field \"" +
3824 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3825 :
3826 0 : int k = 4;
3827 : try {
3828 0 : vector<StokesParameterMod::StokesParameter> v_aux;
3829 0 : vector<vector<StokesParameterMod::StokesParameter> > vv_aux;
3830 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
3831 0 : vv_aux.clear();
3832 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
3833 0 : v_aux.clear();
3834 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
3835 0 : v_aux.push_back(CStokesParameter::newStokesParameter(tokens.at(k).c_str()));
3836 0 : k++;
3837 : }
3838 0 : vv_aux.push_back(v_aux);
3839 : }
3840 0 : result.push_back(vv_aux);
3841 : }
3842 0 : }
3843 0 : catch (...) {
3844 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a StokesParameter.", tableName);
3845 0 : }
3846 :
3847 0 : return result;
3848 0 : }
3849 :
3850 :
3851 :
3852 :
3853 :
3854 0 : string EnumerationParser::toXML(const string& elementName, RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode e) {
3855 0 : return "<"+elementName+">"+CRadialVelocityReferenceCode::name(e)+"</"+elementName+">";
3856 : }
3857 :
3858 0 : string EnumerationParser::toXML(const string& elementName, const vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode>& v_e) {
3859 0 : ostringstream oss;
3860 : oss << "<" << elementName << ">"
3861 : << " 1"
3862 0 : << " " << v_e.size();
3863 :
3864 0 : for (unsigned int i = 0; i < v_e.size(); i++)
3865 0 : oss << " " << CRadialVelocityReferenceCode::name(v_e.at(i));
3866 0 : oss << "</" << elementName << ">";
3867 0 : return oss.str();
3868 0 : }
3869 :
3870 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode> >& vv_e) {
3871 0 : ostringstream oss;
3872 : oss << "<" << elementName << ">"
3873 : << " 2"
3874 0 : << " " <<vv_e.size()
3875 0 : << " " <<vv_e.at(0).size();
3876 :
3877 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
3878 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
3879 0 : oss << " " << CRadialVelocityReferenceCode::name(vv_e.at(i).at(j));
3880 0 : oss << "</" << elementName << ">";
3881 0 : return oss.str();
3882 0 : }
3883 :
3884 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode> > >& vvv_e) {
3885 0 : ostringstream oss;
3886 : oss << "<" << elementName << ">"
3887 : << " 3"
3888 0 : << " " <<vvv_e.size()
3889 0 : << " " <<vvv_e.at(0).size()
3890 0 : << " " <<vvv_e.at(0).at(0).size();
3891 :
3892 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
3893 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
3894 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
3895 0 : oss << " " << CRadialVelocityReferenceCode::name(vvv_e.at(i).at(j).at(k));
3896 0 : oss << "</" << elementName << ">";
3897 0 : return oss.str();
3898 0 : }
3899 :
3900 1320 : RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode EnumerationParser::getRadialVelocityReferenceCode(const string &name, const string &tableName, const string &xmlDoc) {
3901 1320 : string s = getField(xmlDoc,name);
3902 1320 : if (s.length() == 0)
3903 0 : throw ConversionException("Error: Missing field \"" +
3904 0 : name + "\" or invalid syntax",tableName);
3905 :
3906 : RadialVelocityReferenceCode result;
3907 : try {
3908 1320 : result = CRadialVelocityReferenceCode::newRadialVelocityReferenceCode(s);
3909 : }
3910 0 : catch (...) {
3911 0 : throw ConversionException("Error: could not convert '"+s+"' into a RadialVelocityReferenceCode.", tableName);
3912 0 : }
3913 1320 : return result;
3914 1320 : }
3915 :
3916 0 : vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode> EnumerationParser::getRadialVelocityReferenceCode1D(const string &name, const string &tableName, const string &xmlDoc) {
3917 0 : vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode> result;
3918 :
3919 0 : string s = getField(xmlDoc,name);
3920 0 : if (s.length() == 0)
3921 0 : throw ConversionException("Error: Missing field \"" +
3922 0 : name + "\" or invalid syntax",tableName);
3923 :
3924 0 : istringstream iss;
3925 0 : iss.str(s);
3926 0 : vector<string> tokens;
3927 :
3928 : // Tokenize.
3929 0 : string buf;
3930 0 : while (iss >> buf) {
3931 0 : tokens.push_back(buf);
3932 : }
3933 :
3934 : // The length must be 2 at the minimum (there may be an empty array)
3935 0 : if (tokens.size() < 2)
3936 0 : throw ConversionException("Error: missing values in field \"" +
3937 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3938 :
3939 :
3940 :
3941 : // The number of dimension should be 1.
3942 0 : if (tokens.at(0) != "1")
3943 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
3944 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3945 :
3946 : // Then parse the size of the unique dimension
3947 0 : errno = 0;
3948 0 : int size1 = atoi(tokens.at(1).c_str());
3949 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
3950 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
3951 :
3952 0 : if (size1 < 0)
3953 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
3954 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3955 :
3956 0 : if (tokens.size() != (unsigned int) (size1 + 2))
3957 0 : throw ConversionException("Error: incorrect number of values in field \"" +
3958 0 : name + "\" or invalid syntax('" + s +"')",tableName);
3959 :
3960 0 : int k = 2;
3961 : try {
3962 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
3963 0 : result.push_back(CRadialVelocityReferenceCode::newRadialVelocityReferenceCode(tokens.at(k).c_str()));
3964 0 : k++;
3965 : }
3966 : }
3967 0 : catch (...) {
3968 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a RadialVelocityReferenceCode.", tableName);
3969 0 : }
3970 :
3971 0 : return result;
3972 0 : }
3973 :
3974 0 : vector<vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode> > EnumerationParser::getRadialVelocityReferenceCode2D(const string &name, const string &tableName, const string &xmlDoc) {
3975 0 : vector<vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode> > result;
3976 :
3977 0 : string s = getField(xmlDoc,name);
3978 0 : if (s.length() == 0)
3979 0 : throw ConversionException("Error: Missing field \"" +
3980 0 : name + "\" or invalid syntax",tableName);
3981 :
3982 0 : istringstream iss;
3983 0 : iss.str(s);
3984 0 : vector<string> tokens;
3985 :
3986 : // Tokenize.
3987 0 : string buf;
3988 0 : while (iss >> buf) {
3989 0 : tokens.push_back(buf);
3990 : }
3991 :
3992 : // The length must be 3 at the minimum (there may be an empty array)
3993 0 : if (tokens.size() < 3)
3994 0 : throw ConversionException("Error: missing values in field \"" +
3995 0 : name + "\" or invalid syntax(" + s +"')",tableName);
3996 :
3997 :
3998 : // The number of dimension should be 2.
3999 0 : if (tokens.at(0) != "2")
4000 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
4001 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4002 :
4003 : // Then parse the size of the two dimensions
4004 0 : errno = 0;
4005 0 : int size1 = atoi(tokens.at(1).c_str());
4006 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4007 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4008 :
4009 0 : if (size1 <= 0)
4010 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4011 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4012 0 : errno = 0;
4013 0 : int size2 = atoi(tokens.at(2).c_str());
4014 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4015 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4016 :
4017 0 : if (size2 < 0)
4018 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
4019 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4020 :
4021 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
4022 0 : throw ConversionException("Error: incorrect number of values in field \"" +
4023 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4024 :
4025 0 : int k = 3;
4026 : try {
4027 0 : vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode> v_aux;
4028 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
4029 0 : v_aux.clear();
4030 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
4031 0 : v_aux.push_back(CRadialVelocityReferenceCode::newRadialVelocityReferenceCode(tokens.at(k).c_str()));
4032 0 : k++;
4033 : }
4034 0 : result.push_back(v_aux);
4035 : }
4036 0 : }
4037 0 : catch (...) {
4038 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a RadialVelocityReferenceCode.", tableName);
4039 0 : }
4040 0 : return result;
4041 0 : }
4042 :
4043 :
4044 0 : vector<vector<vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode> > > EnumerationParser::getRadialVelocityReferenceCode3D(const string &name, const string &tableName, const string &xmlDoc) {
4045 0 : vector<vector<vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode> > >result;
4046 :
4047 0 : string s = getField(xmlDoc,name);
4048 0 : if (s.length() == 0)
4049 0 : throw ConversionException("Error: Missing field \"" +
4050 0 : name + "\" or invalid syntax",tableName);
4051 :
4052 0 : istringstream iss;
4053 0 : iss.str(s);
4054 0 : vector<string> tokens;
4055 :
4056 : // Tokenize.
4057 0 : string buf;
4058 0 : while (iss >> buf) {
4059 0 : tokens.push_back(buf);
4060 : }
4061 :
4062 : // The length must be 4 at the minimum (there may be an empty array)
4063 0 : if (tokens.size() < 4)
4064 0 : throw ConversionException("Error: missing values in field \"" +
4065 0 : name + "\" or invalid syntax(" + s +"')",tableName);
4066 :
4067 :
4068 : // The number of dimension should be 3.
4069 0 : if (tokens.at(0) != "3")
4070 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
4071 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4072 :
4073 : // Then parse the size of the three dimensions
4074 0 : errno = 0;
4075 0 : int size1 = atoi(tokens.at(1).c_str());
4076 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4077 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4078 :
4079 0 : if (size1 <= 0)
4080 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4081 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4082 :
4083 0 : errno = 0;
4084 0 : int size2 = atoi(tokens.at(2).c_str());
4085 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4086 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4087 :
4088 0 : if (size2 <= 0)
4089 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4090 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4091 :
4092 0 : errno = 0;
4093 0 : int size3 = atoi(tokens.at(3).c_str());
4094 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4095 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4096 :
4097 :
4098 0 : if (size3 < 0)
4099 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
4100 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4101 :
4102 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
4103 0 : throw ConversionException("Error: incorrect number of values in field \"" +
4104 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4105 :
4106 0 : int k = 4;
4107 : try {
4108 0 : vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode> v_aux;
4109 0 : vector<vector<RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode> > vv_aux;
4110 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
4111 0 : vv_aux.clear();
4112 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
4113 0 : v_aux.clear();
4114 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
4115 0 : v_aux.push_back(CRadialVelocityReferenceCode::newRadialVelocityReferenceCode(tokens.at(k).c_str()));
4116 0 : k++;
4117 : }
4118 0 : vv_aux.push_back(v_aux);
4119 : }
4120 0 : result.push_back(vv_aux);
4121 : }
4122 0 : }
4123 0 : catch (...) {
4124 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a RadialVelocityReferenceCode.", tableName);
4125 0 : }
4126 :
4127 0 : return result;
4128 0 : }
4129 :
4130 :
4131 :
4132 :
4133 :
4134 0 : string EnumerationParser::toXML(const string& elementName, DopplerReferenceCodeMod::DopplerReferenceCode e) {
4135 0 : return "<"+elementName+">"+CDopplerReferenceCode::name(e)+"</"+elementName+">";
4136 : }
4137 :
4138 0 : string EnumerationParser::toXML(const string& elementName, const vector<DopplerReferenceCodeMod::DopplerReferenceCode>& v_e) {
4139 0 : ostringstream oss;
4140 : oss << "<" << elementName << ">"
4141 : << " 1"
4142 0 : << " " << v_e.size();
4143 :
4144 0 : for (unsigned int i = 0; i < v_e.size(); i++)
4145 0 : oss << " " << CDopplerReferenceCode::name(v_e.at(i));
4146 0 : oss << "</" << elementName << ">";
4147 0 : return oss.str();
4148 0 : }
4149 :
4150 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<DopplerReferenceCodeMod::DopplerReferenceCode> >& vv_e) {
4151 0 : ostringstream oss;
4152 : oss << "<" << elementName << ">"
4153 : << " 2"
4154 0 : << " " <<vv_e.size()
4155 0 : << " " <<vv_e.at(0).size();
4156 :
4157 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
4158 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
4159 0 : oss << " " << CDopplerReferenceCode::name(vv_e.at(i).at(j));
4160 0 : oss << "</" << elementName << ">";
4161 0 : return oss.str();
4162 0 : }
4163 :
4164 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<DopplerReferenceCodeMod::DopplerReferenceCode> > >& vvv_e) {
4165 0 : ostringstream oss;
4166 : oss << "<" << elementName << ">"
4167 : << " 3"
4168 0 : << " " <<vvv_e.size()
4169 0 : << " " <<vvv_e.at(0).size()
4170 0 : << " " <<vvv_e.at(0).at(0).size();
4171 :
4172 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
4173 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
4174 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
4175 0 : oss << " " << CDopplerReferenceCode::name(vvv_e.at(i).at(j).at(k));
4176 0 : oss << "</" << elementName << ">";
4177 0 : return oss.str();
4178 0 : }
4179 :
4180 0 : DopplerReferenceCodeMod::DopplerReferenceCode EnumerationParser::getDopplerReferenceCode(const string &name, const string &tableName, const string &xmlDoc) {
4181 0 : string s = getField(xmlDoc,name);
4182 0 : if (s.length() == 0)
4183 0 : throw ConversionException("Error: Missing field \"" +
4184 0 : name + "\" or invalid syntax",tableName);
4185 :
4186 : DopplerReferenceCode result;
4187 : try {
4188 0 : result = CDopplerReferenceCode::newDopplerReferenceCode(s);
4189 : }
4190 0 : catch (...) {
4191 0 : throw ConversionException("Error: could not convert '"+s+"' into a DopplerReferenceCode.", tableName);
4192 0 : }
4193 0 : return result;
4194 0 : }
4195 :
4196 0 : vector<DopplerReferenceCodeMod::DopplerReferenceCode> EnumerationParser::getDopplerReferenceCode1D(const string &name, const string &tableName, const string &xmlDoc) {
4197 0 : vector<DopplerReferenceCodeMod::DopplerReferenceCode> result;
4198 :
4199 0 : string s = getField(xmlDoc,name);
4200 0 : if (s.length() == 0)
4201 0 : throw ConversionException("Error: Missing field \"" +
4202 0 : name + "\" or invalid syntax",tableName);
4203 :
4204 0 : istringstream iss;
4205 0 : iss.str(s);
4206 0 : vector<string> tokens;
4207 :
4208 : // Tokenize.
4209 0 : string buf;
4210 0 : while (iss >> buf) {
4211 0 : tokens.push_back(buf);
4212 : }
4213 :
4214 : // The length must be 2 at the minimum (there may be an empty array)
4215 0 : if (tokens.size() < 2)
4216 0 : throw ConversionException("Error: missing values in field \"" +
4217 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4218 :
4219 :
4220 :
4221 : // The number of dimension should be 1.
4222 0 : if (tokens.at(0) != "1")
4223 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
4224 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4225 :
4226 : // Then parse the size of the unique dimension
4227 0 : errno = 0;
4228 0 : int size1 = atoi(tokens.at(1).c_str());
4229 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4230 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4231 :
4232 0 : if (size1 < 0)
4233 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
4234 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4235 :
4236 0 : if (tokens.size() != (unsigned int) (size1 + 2))
4237 0 : throw ConversionException("Error: incorrect number of values in field \"" +
4238 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4239 :
4240 0 : int k = 2;
4241 : try {
4242 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
4243 0 : result.push_back(CDopplerReferenceCode::newDopplerReferenceCode(tokens.at(k).c_str()));
4244 0 : k++;
4245 : }
4246 : }
4247 0 : catch (...) {
4248 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DopplerReferenceCode.", tableName);
4249 0 : }
4250 :
4251 0 : return result;
4252 0 : }
4253 :
4254 0 : vector<vector<DopplerReferenceCodeMod::DopplerReferenceCode> > EnumerationParser::getDopplerReferenceCode2D(const string &name, const string &tableName, const string &xmlDoc) {
4255 0 : vector<vector<DopplerReferenceCodeMod::DopplerReferenceCode> > result;
4256 :
4257 0 : string s = getField(xmlDoc,name);
4258 0 : if (s.length() == 0)
4259 0 : throw ConversionException("Error: Missing field \"" +
4260 0 : name + "\" or invalid syntax",tableName);
4261 :
4262 0 : istringstream iss;
4263 0 : iss.str(s);
4264 0 : vector<string> tokens;
4265 :
4266 : // Tokenize.
4267 0 : string buf;
4268 0 : while (iss >> buf) {
4269 0 : tokens.push_back(buf);
4270 : }
4271 :
4272 : // The length must be 3 at the minimum (there may be an empty array)
4273 0 : if (tokens.size() < 3)
4274 0 : throw ConversionException("Error: missing values in field \"" +
4275 0 : name + "\" or invalid syntax(" + s +"')",tableName);
4276 :
4277 :
4278 : // The number of dimension should be 2.
4279 0 : if (tokens.at(0) != "2")
4280 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
4281 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4282 :
4283 : // Then parse the size of the two dimensions
4284 0 : errno = 0;
4285 0 : int size1 = atoi(tokens.at(1).c_str());
4286 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4287 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4288 :
4289 0 : if (size1 <= 0)
4290 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4291 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4292 0 : errno = 0;
4293 0 : int size2 = atoi(tokens.at(2).c_str());
4294 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4295 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4296 :
4297 0 : if (size2 < 0)
4298 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
4299 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4300 :
4301 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
4302 0 : throw ConversionException("Error: incorrect number of values in field \"" +
4303 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4304 :
4305 0 : int k = 3;
4306 : try {
4307 0 : vector<DopplerReferenceCodeMod::DopplerReferenceCode> v_aux;
4308 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
4309 0 : v_aux.clear();
4310 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
4311 0 : v_aux.push_back(CDopplerReferenceCode::newDopplerReferenceCode(tokens.at(k).c_str()));
4312 0 : k++;
4313 : }
4314 0 : result.push_back(v_aux);
4315 : }
4316 0 : }
4317 0 : catch (...) {
4318 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DopplerReferenceCode.", tableName);
4319 0 : }
4320 0 : return result;
4321 0 : }
4322 :
4323 :
4324 0 : vector<vector<vector<DopplerReferenceCodeMod::DopplerReferenceCode> > > EnumerationParser::getDopplerReferenceCode3D(const string &name, const string &tableName, const string &xmlDoc) {
4325 0 : vector<vector<vector<DopplerReferenceCodeMod::DopplerReferenceCode> > >result;
4326 :
4327 0 : string s = getField(xmlDoc,name);
4328 0 : if (s.length() == 0)
4329 0 : throw ConversionException("Error: Missing field \"" +
4330 0 : name + "\" or invalid syntax",tableName);
4331 :
4332 0 : istringstream iss;
4333 0 : iss.str(s);
4334 0 : vector<string> tokens;
4335 :
4336 : // Tokenize.
4337 0 : string buf;
4338 0 : while (iss >> buf) {
4339 0 : tokens.push_back(buf);
4340 : }
4341 :
4342 : // The length must be 4 at the minimum (there may be an empty array)
4343 0 : if (tokens.size() < 4)
4344 0 : throw ConversionException("Error: missing values in field \"" +
4345 0 : name + "\" or invalid syntax(" + s +"')",tableName);
4346 :
4347 :
4348 : // The number of dimension should be 3.
4349 0 : if (tokens.at(0) != "3")
4350 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
4351 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4352 :
4353 : // Then parse the size of the three dimensions
4354 0 : errno = 0;
4355 0 : int size1 = atoi(tokens.at(1).c_str());
4356 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4357 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4358 :
4359 0 : if (size1 <= 0)
4360 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4361 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4362 :
4363 0 : errno = 0;
4364 0 : int size2 = atoi(tokens.at(2).c_str());
4365 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4366 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4367 :
4368 0 : if (size2 <= 0)
4369 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4370 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4371 :
4372 0 : errno = 0;
4373 0 : int size3 = atoi(tokens.at(3).c_str());
4374 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4375 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4376 :
4377 :
4378 0 : if (size3 < 0)
4379 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
4380 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4381 :
4382 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
4383 0 : throw ConversionException("Error: incorrect number of values in field \"" +
4384 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4385 :
4386 0 : int k = 4;
4387 : try {
4388 0 : vector<DopplerReferenceCodeMod::DopplerReferenceCode> v_aux;
4389 0 : vector<vector<DopplerReferenceCodeMod::DopplerReferenceCode> > vv_aux;
4390 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
4391 0 : vv_aux.clear();
4392 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
4393 0 : v_aux.clear();
4394 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
4395 0 : v_aux.push_back(CDopplerReferenceCode::newDopplerReferenceCode(tokens.at(k).c_str()));
4396 0 : k++;
4397 : }
4398 0 : vv_aux.push_back(v_aux);
4399 : }
4400 0 : result.push_back(vv_aux);
4401 : }
4402 0 : }
4403 0 : catch (...) {
4404 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a DopplerReferenceCode.", tableName);
4405 0 : }
4406 :
4407 0 : return result;
4408 0 : }
4409 :
4410 :
4411 :
4412 :
4413 :
4414 502 : string EnumerationParser::toXML(const string& elementName, PolarizationTypeMod::PolarizationType e) {
4415 1004 : return "<"+elementName+">"+CPolarizationType::name(e)+"</"+elementName+">";
4416 : }
4417 :
4418 896 : string EnumerationParser::toXML(const string& elementName, const vector<PolarizationTypeMod::PolarizationType>& v_e) {
4419 896 : ostringstream oss;
4420 : oss << "<" << elementName << ">"
4421 : << " 1"
4422 896 : << " " << v_e.size();
4423 :
4424 2688 : for (unsigned int i = 0; i < v_e.size(); i++)
4425 1792 : oss << " " << CPolarizationType::name(v_e.at(i));
4426 896 : oss << "</" << elementName << ">";
4427 1792 : return oss.str();
4428 896 : }
4429 :
4430 13 : string EnumerationParser::toXML(const string& elementName, const vector<vector<PolarizationTypeMod::PolarizationType> >& vv_e) {
4431 13 : ostringstream oss;
4432 : oss << "<" << elementName << ">"
4433 : << " 2"
4434 13 : << " " <<vv_e.size()
4435 13 : << " " <<vv_e.at(0).size();
4436 :
4437 38 : for (unsigned int i = 0; i < vv_e.size(); i++)
4438 75 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
4439 50 : oss << " " << CPolarizationType::name(vv_e.at(i).at(j));
4440 13 : oss << "</" << elementName << ">";
4441 26 : return oss.str();
4442 13 : }
4443 :
4444 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<PolarizationTypeMod::PolarizationType> > >& vvv_e) {
4445 0 : ostringstream oss;
4446 : oss << "<" << elementName << ">"
4447 : << " 3"
4448 0 : << " " <<vvv_e.size()
4449 0 : << " " <<vvv_e.at(0).size()
4450 0 : << " " <<vvv_e.at(0).at(0).size();
4451 :
4452 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
4453 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
4454 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
4455 0 : oss << " " << CPolarizationType::name(vvv_e.at(i).at(j).at(k));
4456 0 : oss << "</" << elementName << ">";
4457 0 : return oss.str();
4458 0 : }
4459 :
4460 0 : PolarizationTypeMod::PolarizationType EnumerationParser::getPolarizationType(const string &name, const string &tableName, const string &xmlDoc) {
4461 0 : string s = getField(xmlDoc,name);
4462 0 : if (s.length() == 0)
4463 0 : throw ConversionException("Error: Missing field \"" +
4464 0 : name + "\" or invalid syntax",tableName);
4465 :
4466 : PolarizationType result;
4467 : try {
4468 0 : result = CPolarizationType::newPolarizationType(s);
4469 : }
4470 0 : catch (...) {
4471 0 : throw ConversionException("Error: could not convert '"+s+"' into a PolarizationType.", tableName);
4472 0 : }
4473 0 : return result;
4474 0 : }
4475 :
4476 67368 : vector<PolarizationTypeMod::PolarizationType> EnumerationParser::getPolarizationType1D(const string &name, const string &tableName, const string &xmlDoc) {
4477 67368 : vector<PolarizationTypeMod::PolarizationType> result;
4478 :
4479 67368 : string s = getField(xmlDoc,name);
4480 67368 : if (s.length() == 0)
4481 0 : throw ConversionException("Error: Missing field \"" +
4482 0 : name + "\" or invalid syntax",tableName);
4483 :
4484 67368 : istringstream iss;
4485 67368 : iss.str(s);
4486 67368 : vector<string> tokens;
4487 :
4488 : // Tokenize.
4489 67368 : string buf;
4490 336824 : while (iss >> buf) {
4491 269456 : tokens.push_back(buf);
4492 : }
4493 :
4494 : // The length must be 2 at the minimum (there may be an empty array)
4495 67368 : if (tokens.size() < 2)
4496 0 : throw ConversionException("Error: missing values in field \"" +
4497 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4498 :
4499 :
4500 :
4501 : // The number of dimension should be 1.
4502 67368 : if (tokens.at(0) != "1")
4503 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
4504 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4505 :
4506 : // Then parse the size of the unique dimension
4507 67368 : errno = 0;
4508 67368 : int size1 = atoi(tokens.at(1).c_str());
4509 67368 : if (errno != 0) throw ConversionException("Error: Field \"" +
4510 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4511 :
4512 67368 : if (size1 < 0)
4513 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
4514 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4515 :
4516 67368 : if (tokens.size() != (unsigned int) (size1 + 2))
4517 0 : throw ConversionException("Error: incorrect number of values in field \"" +
4518 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4519 :
4520 67368 : int k = 2;
4521 : try {
4522 202088 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
4523 134720 : result.push_back(CPolarizationType::newPolarizationType(tokens.at(k).c_str()));
4524 134720 : k++;
4525 : }
4526 : }
4527 0 : catch (...) {
4528 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PolarizationType.", tableName);
4529 0 : }
4530 :
4531 134736 : return result;
4532 67368 : }
4533 :
4534 142 : vector<vector<PolarizationTypeMod::PolarizationType> > EnumerationParser::getPolarizationType2D(const string &name, const string &tableName, const string &xmlDoc) {
4535 142 : vector<vector<PolarizationTypeMod::PolarizationType> > result;
4536 :
4537 142 : string s = getField(xmlDoc,name);
4538 142 : if (s.length() == 0)
4539 0 : throw ConversionException("Error: Missing field \"" +
4540 0 : name + "\" or invalid syntax",tableName);
4541 :
4542 142 : istringstream iss;
4543 142 : iss.str(s);
4544 142 : vector<string> tokens;
4545 :
4546 : // Tokenize.
4547 142 : string buf;
4548 1202 : while (iss >> buf) {
4549 1060 : tokens.push_back(buf);
4550 : }
4551 :
4552 : // The length must be 3 at the minimum (there may be an empty array)
4553 142 : if (tokens.size() < 3)
4554 0 : throw ConversionException("Error: missing values in field \"" +
4555 0 : name + "\" or invalid syntax(" + s +"')",tableName);
4556 :
4557 :
4558 : // The number of dimension should be 2.
4559 142 : if (tokens.at(0) != "2")
4560 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
4561 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4562 :
4563 : // Then parse the size of the two dimensions
4564 142 : errno = 0;
4565 142 : int size1 = atoi(tokens.at(1).c_str());
4566 142 : if (errno != 0) throw ConversionException("Error: Field \"" +
4567 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4568 :
4569 142 : if (size1 <= 0)
4570 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4571 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4572 142 : errno = 0;
4573 142 : int size2 = atoi(tokens.at(2).c_str());
4574 142 : if (errno != 0) throw ConversionException("Error: Field \"" +
4575 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4576 :
4577 142 : if (size2 < 0)
4578 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
4579 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4580 :
4581 142 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
4582 0 : throw ConversionException("Error: incorrect number of values in field \"" +
4583 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4584 :
4585 142 : int k = 3;
4586 : try {
4587 142 : vector<PolarizationTypeMod::PolarizationType> v_aux;
4588 459 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
4589 317 : v_aux.clear();
4590 951 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
4591 634 : v_aux.push_back(CPolarizationType::newPolarizationType(tokens.at(k).c_str()));
4592 634 : k++;
4593 : }
4594 317 : result.push_back(v_aux);
4595 : }
4596 142 : }
4597 0 : catch (...) {
4598 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PolarizationType.", tableName);
4599 0 : }
4600 284 : return result;
4601 142 : }
4602 :
4603 :
4604 0 : vector<vector<vector<PolarizationTypeMod::PolarizationType> > > EnumerationParser::getPolarizationType3D(const string &name, const string &tableName, const string &xmlDoc) {
4605 0 : vector<vector<vector<PolarizationTypeMod::PolarizationType> > >result;
4606 :
4607 0 : string s = getField(xmlDoc,name);
4608 0 : if (s.length() == 0)
4609 0 : throw ConversionException("Error: Missing field \"" +
4610 0 : name + "\" or invalid syntax",tableName);
4611 :
4612 0 : istringstream iss;
4613 0 : iss.str(s);
4614 0 : vector<string> tokens;
4615 :
4616 : // Tokenize.
4617 0 : string buf;
4618 0 : while (iss >> buf) {
4619 0 : tokens.push_back(buf);
4620 : }
4621 :
4622 : // The length must be 4 at the minimum (there may be an empty array)
4623 0 : if (tokens.size() < 4)
4624 0 : throw ConversionException("Error: missing values in field \"" +
4625 0 : name + "\" or invalid syntax(" + s +"')",tableName);
4626 :
4627 :
4628 : // The number of dimension should be 3.
4629 0 : if (tokens.at(0) != "3")
4630 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
4631 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4632 :
4633 : // Then parse the size of the three dimensions
4634 0 : errno = 0;
4635 0 : int size1 = atoi(tokens.at(1).c_str());
4636 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4637 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4638 :
4639 0 : if (size1 <= 0)
4640 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4641 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4642 :
4643 0 : errno = 0;
4644 0 : int size2 = atoi(tokens.at(2).c_str());
4645 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4646 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4647 :
4648 0 : if (size2 <= 0)
4649 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4650 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4651 :
4652 0 : errno = 0;
4653 0 : int size3 = atoi(tokens.at(3).c_str());
4654 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4655 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4656 :
4657 :
4658 0 : if (size3 < 0)
4659 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
4660 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4661 :
4662 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
4663 0 : throw ConversionException("Error: incorrect number of values in field \"" +
4664 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4665 :
4666 0 : int k = 4;
4667 : try {
4668 0 : vector<PolarizationTypeMod::PolarizationType> v_aux;
4669 0 : vector<vector<PolarizationTypeMod::PolarizationType> > vv_aux;
4670 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
4671 0 : vv_aux.clear();
4672 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
4673 0 : v_aux.clear();
4674 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
4675 0 : v_aux.push_back(CPolarizationType::newPolarizationType(tokens.at(k).c_str()));
4676 0 : k++;
4677 : }
4678 0 : vv_aux.push_back(v_aux);
4679 : }
4680 0 : result.push_back(vv_aux);
4681 : }
4682 0 : }
4683 0 : catch (...) {
4684 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a PolarizationType.", tableName);
4685 0 : }
4686 :
4687 0 : return result;
4688 0 : }
4689 :
4690 :
4691 :
4692 :
4693 :
4694 83 : string EnumerationParser::toXML(const string& elementName, BasebandNameMod::BasebandName e) {
4695 166 : return "<"+elementName+">"+CBasebandName::name(e)+"</"+elementName+">";
4696 : }
4697 :
4698 13 : string EnumerationParser::toXML(const string& elementName, const vector<BasebandNameMod::BasebandName>& v_e) {
4699 13 : ostringstream oss;
4700 : oss << "<" << elementName << ">"
4701 : << " 1"
4702 13 : << " " << v_e.size();
4703 :
4704 26 : for (unsigned int i = 0; i < v_e.size(); i++)
4705 13 : oss << " " << CBasebandName::name(v_e.at(i));
4706 13 : oss << "</" << elementName << ">";
4707 26 : return oss.str();
4708 13 : }
4709 :
4710 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<BasebandNameMod::BasebandName> >& vv_e) {
4711 0 : ostringstream oss;
4712 : oss << "<" << elementName << ">"
4713 : << " 2"
4714 0 : << " " <<vv_e.size()
4715 0 : << " " <<vv_e.at(0).size();
4716 :
4717 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
4718 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
4719 0 : oss << " " << CBasebandName::name(vv_e.at(i).at(j));
4720 0 : oss << "</" << elementName << ">";
4721 0 : return oss.str();
4722 0 : }
4723 :
4724 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<BasebandNameMod::BasebandName> > >& vvv_e) {
4725 0 : ostringstream oss;
4726 : oss << "<" << elementName << ">"
4727 : << " 3"
4728 0 : << " " <<vvv_e.size()
4729 0 : << " " <<vvv_e.at(0).size()
4730 0 : << " " <<vvv_e.at(0).at(0).size();
4731 :
4732 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
4733 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
4734 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
4735 0 : oss << " " << CBasebandName::name(vvv_e.at(i).at(j).at(k));
4736 0 : oss << "</" << elementName << ">";
4737 0 : return oss.str();
4738 0 : }
4739 :
4740 2292 : BasebandNameMod::BasebandName EnumerationParser::getBasebandName(const string &name, const string &tableName, const string &xmlDoc) {
4741 2292 : string s = getField(xmlDoc,name);
4742 2292 : if (s.length() == 0)
4743 0 : throw ConversionException("Error: Missing field \"" +
4744 0 : name + "\" or invalid syntax",tableName);
4745 :
4746 : BasebandName result;
4747 : try {
4748 2292 : result = CBasebandName::newBasebandName(s);
4749 : }
4750 0 : catch (...) {
4751 0 : throw ConversionException("Error: could not convert '"+s+"' into a BasebandName.", tableName);
4752 0 : }
4753 2292 : return result;
4754 2292 : }
4755 :
4756 104 : vector<BasebandNameMod::BasebandName> EnumerationParser::getBasebandName1D(const string &name, const string &tableName, const string &xmlDoc) {
4757 104 : vector<BasebandNameMod::BasebandName> result;
4758 :
4759 104 : string s = getField(xmlDoc,name);
4760 104 : if (s.length() == 0)
4761 0 : throw ConversionException("Error: Missing field \"" +
4762 0 : name + "\" or invalid syntax",tableName);
4763 :
4764 104 : istringstream iss;
4765 104 : iss.str(s);
4766 104 : vector<string> tokens;
4767 :
4768 : // Tokenize.
4769 104 : string buf;
4770 661 : while (iss >> buf) {
4771 557 : tokens.push_back(buf);
4772 : }
4773 :
4774 : // The length must be 2 at the minimum (there may be an empty array)
4775 104 : if (tokens.size() < 2)
4776 0 : throw ConversionException("Error: missing values in field \"" +
4777 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4778 :
4779 :
4780 :
4781 : // The number of dimension should be 1.
4782 104 : if (tokens.at(0) != "1")
4783 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
4784 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4785 :
4786 : // Then parse the size of the unique dimension
4787 104 : errno = 0;
4788 104 : int size1 = atoi(tokens.at(1).c_str());
4789 104 : if (errno != 0) throw ConversionException("Error: Field \"" +
4790 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4791 :
4792 104 : if (size1 < 0)
4793 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
4794 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4795 :
4796 104 : if (tokens.size() != (unsigned int) (size1 + 2))
4797 0 : throw ConversionException("Error: incorrect number of values in field \"" +
4798 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4799 :
4800 104 : int k = 2;
4801 : try {
4802 453 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
4803 349 : result.push_back(CBasebandName::newBasebandName(tokens.at(k).c_str()));
4804 349 : k++;
4805 : }
4806 : }
4807 0 : catch (...) {
4808 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a BasebandName.", tableName);
4809 0 : }
4810 :
4811 208 : return result;
4812 104 : }
4813 :
4814 0 : vector<vector<BasebandNameMod::BasebandName> > EnumerationParser::getBasebandName2D(const string &name, const string &tableName, const string &xmlDoc) {
4815 0 : vector<vector<BasebandNameMod::BasebandName> > result;
4816 :
4817 0 : string s = getField(xmlDoc,name);
4818 0 : if (s.length() == 0)
4819 0 : throw ConversionException("Error: Missing field \"" +
4820 0 : name + "\" or invalid syntax",tableName);
4821 :
4822 0 : istringstream iss;
4823 0 : iss.str(s);
4824 0 : vector<string> tokens;
4825 :
4826 : // Tokenize.
4827 0 : string buf;
4828 0 : while (iss >> buf) {
4829 0 : tokens.push_back(buf);
4830 : }
4831 :
4832 : // The length must be 3 at the minimum (there may be an empty array)
4833 0 : if (tokens.size() < 3)
4834 0 : throw ConversionException("Error: missing values in field \"" +
4835 0 : name + "\" or invalid syntax(" + s +"')",tableName);
4836 :
4837 :
4838 : // The number of dimension should be 2.
4839 0 : if (tokens.at(0) != "2")
4840 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
4841 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4842 :
4843 : // Then parse the size of the two dimensions
4844 0 : errno = 0;
4845 0 : int size1 = atoi(tokens.at(1).c_str());
4846 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4847 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4848 :
4849 0 : if (size1 <= 0)
4850 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4851 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4852 0 : errno = 0;
4853 0 : int size2 = atoi(tokens.at(2).c_str());
4854 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4855 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4856 :
4857 0 : if (size2 < 0)
4858 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
4859 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4860 :
4861 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
4862 0 : throw ConversionException("Error: incorrect number of values in field \"" +
4863 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4864 :
4865 0 : int k = 3;
4866 : try {
4867 0 : vector<BasebandNameMod::BasebandName> v_aux;
4868 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
4869 0 : v_aux.clear();
4870 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
4871 0 : v_aux.push_back(CBasebandName::newBasebandName(tokens.at(k).c_str()));
4872 0 : k++;
4873 : }
4874 0 : result.push_back(v_aux);
4875 : }
4876 0 : }
4877 0 : catch (...) {
4878 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a BasebandName.", tableName);
4879 0 : }
4880 0 : return result;
4881 0 : }
4882 :
4883 :
4884 0 : vector<vector<vector<BasebandNameMod::BasebandName> > > EnumerationParser::getBasebandName3D(const string &name, const string &tableName, const string &xmlDoc) {
4885 0 : vector<vector<vector<BasebandNameMod::BasebandName> > >result;
4886 :
4887 0 : string s = getField(xmlDoc,name);
4888 0 : if (s.length() == 0)
4889 0 : throw ConversionException("Error: Missing field \"" +
4890 0 : name + "\" or invalid syntax",tableName);
4891 :
4892 0 : istringstream iss;
4893 0 : iss.str(s);
4894 0 : vector<string> tokens;
4895 :
4896 : // Tokenize.
4897 0 : string buf;
4898 0 : while (iss >> buf) {
4899 0 : tokens.push_back(buf);
4900 : }
4901 :
4902 : // The length must be 4 at the minimum (there may be an empty array)
4903 0 : if (tokens.size() < 4)
4904 0 : throw ConversionException("Error: missing values in field \"" +
4905 0 : name + "\" or invalid syntax(" + s +"')",tableName);
4906 :
4907 :
4908 : // The number of dimension should be 3.
4909 0 : if (tokens.at(0) != "3")
4910 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
4911 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4912 :
4913 : // Then parse the size of the three dimensions
4914 0 : errno = 0;
4915 0 : int size1 = atoi(tokens.at(1).c_str());
4916 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4917 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4918 :
4919 0 : if (size1 <= 0)
4920 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4921 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4922 :
4923 0 : errno = 0;
4924 0 : int size2 = atoi(tokens.at(2).c_str());
4925 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4926 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4927 :
4928 0 : if (size2 <= 0)
4929 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
4930 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4931 :
4932 0 : errno = 0;
4933 0 : int size3 = atoi(tokens.at(3).c_str());
4934 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
4935 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
4936 :
4937 :
4938 0 : if (size3 < 0)
4939 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
4940 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4941 :
4942 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
4943 0 : throw ConversionException("Error: incorrect number of values in field \"" +
4944 0 : name + "\" or invalid syntax('" + s +"')",tableName);
4945 :
4946 0 : int k = 4;
4947 : try {
4948 0 : vector<BasebandNameMod::BasebandName> v_aux;
4949 0 : vector<vector<BasebandNameMod::BasebandName> > vv_aux;
4950 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
4951 0 : vv_aux.clear();
4952 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
4953 0 : v_aux.clear();
4954 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
4955 0 : v_aux.push_back(CBasebandName::newBasebandName(tokens.at(k).c_str()));
4956 0 : k++;
4957 : }
4958 0 : vv_aux.push_back(v_aux);
4959 : }
4960 0 : result.push_back(vv_aux);
4961 : }
4962 0 : }
4963 0 : catch (...) {
4964 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a BasebandName.", tableName);
4965 0 : }
4966 :
4967 0 : return result;
4968 0 : }
4969 :
4970 :
4971 :
4972 :
4973 :
4974 83 : string EnumerationParser::toXML(const string& elementName, NetSidebandMod::NetSideband e) {
4975 166 : return "<"+elementName+">"+CNetSideband::name(e)+"</"+elementName+">";
4976 : }
4977 :
4978 83 : string EnumerationParser::toXML(const string& elementName, const vector<NetSidebandMod::NetSideband>& v_e) {
4979 83 : ostringstream oss;
4980 : oss << "<" << elementName << ">"
4981 : << " 1"
4982 83 : << " " << v_e.size();
4983 :
4984 83 : for (unsigned int i = 0; i < v_e.size(); i++)
4985 0 : oss << " " << CNetSideband::name(v_e.at(i));
4986 83 : oss << "</" << elementName << ">";
4987 166 : return oss.str();
4988 83 : }
4989 :
4990 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<NetSidebandMod::NetSideband> >& vv_e) {
4991 0 : ostringstream oss;
4992 : oss << "<" << elementName << ">"
4993 : << " 2"
4994 0 : << " " <<vv_e.size()
4995 0 : << " " <<vv_e.at(0).size();
4996 :
4997 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
4998 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
4999 0 : oss << " " << CNetSideband::name(vv_e.at(i).at(j));
5000 0 : oss << "</" << elementName << ">";
5001 0 : return oss.str();
5002 0 : }
5003 :
5004 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<NetSidebandMod::NetSideband> > >& vvv_e) {
5005 0 : ostringstream oss;
5006 : oss << "<" << elementName << ">"
5007 : << " 3"
5008 0 : << " " <<vvv_e.size()
5009 0 : << " " <<vvv_e.at(0).size()
5010 0 : << " " <<vvv_e.at(0).at(0).size();
5011 :
5012 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
5013 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
5014 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
5015 0 : oss << " " << CNetSideband::name(vvv_e.at(i).at(j).at(k));
5016 0 : oss << "</" << elementName << ">";
5017 0 : return oss.str();
5018 0 : }
5019 :
5020 2292 : NetSidebandMod::NetSideband EnumerationParser::getNetSideband(const string &name, const string &tableName, const string &xmlDoc) {
5021 2292 : string s = getField(xmlDoc,name);
5022 2292 : if (s.length() == 0)
5023 0 : throw ConversionException("Error: Missing field \"" +
5024 0 : name + "\" or invalid syntax",tableName);
5025 :
5026 : NetSideband result;
5027 : try {
5028 2292 : result = CNetSideband::newNetSideband(s);
5029 : }
5030 0 : catch (...) {
5031 0 : throw ConversionException("Error: could not convert '"+s+"' into a NetSideband.", tableName);
5032 0 : }
5033 2292 : return result;
5034 2292 : }
5035 :
5036 0 : vector<NetSidebandMod::NetSideband> EnumerationParser::getNetSideband1D(const string &name, const string &tableName, const string &xmlDoc) {
5037 0 : vector<NetSidebandMod::NetSideband> result;
5038 :
5039 0 : string s = getField(xmlDoc,name);
5040 0 : if (s.length() == 0)
5041 0 : throw ConversionException("Error: Missing field \"" +
5042 0 : name + "\" or invalid syntax",tableName);
5043 :
5044 0 : istringstream iss;
5045 0 : iss.str(s);
5046 0 : vector<string> tokens;
5047 :
5048 : // Tokenize.
5049 0 : string buf;
5050 0 : while (iss >> buf) {
5051 0 : tokens.push_back(buf);
5052 : }
5053 :
5054 : // The length must be 2 at the minimum (there may be an empty array)
5055 0 : if (tokens.size() < 2)
5056 0 : throw ConversionException("Error: missing values in field \"" +
5057 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5058 :
5059 :
5060 :
5061 : // The number of dimension should be 1.
5062 0 : if (tokens.at(0) != "1")
5063 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
5064 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5065 :
5066 : // Then parse the size of the unique dimension
5067 0 : errno = 0;
5068 0 : int size1 = atoi(tokens.at(1).c_str());
5069 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5070 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5071 :
5072 0 : if (size1 < 0)
5073 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
5074 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5075 :
5076 0 : if (tokens.size() != (unsigned int) (size1 + 2))
5077 0 : throw ConversionException("Error: incorrect number of values in field \"" +
5078 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5079 :
5080 0 : int k = 2;
5081 : try {
5082 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
5083 0 : result.push_back(CNetSideband::newNetSideband(tokens.at(k).c_str()));
5084 0 : k++;
5085 : }
5086 : }
5087 0 : catch (...) {
5088 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a NetSideband.", tableName);
5089 0 : }
5090 :
5091 0 : return result;
5092 0 : }
5093 :
5094 0 : vector<vector<NetSidebandMod::NetSideband> > EnumerationParser::getNetSideband2D(const string &name, const string &tableName, const string &xmlDoc) {
5095 0 : vector<vector<NetSidebandMod::NetSideband> > result;
5096 :
5097 0 : string s = getField(xmlDoc,name);
5098 0 : if (s.length() == 0)
5099 0 : throw ConversionException("Error: Missing field \"" +
5100 0 : name + "\" or invalid syntax",tableName);
5101 :
5102 0 : istringstream iss;
5103 0 : iss.str(s);
5104 0 : vector<string> tokens;
5105 :
5106 : // Tokenize.
5107 0 : string buf;
5108 0 : while (iss >> buf) {
5109 0 : tokens.push_back(buf);
5110 : }
5111 :
5112 : // The length must be 3 at the minimum (there may be an empty array)
5113 0 : if (tokens.size() < 3)
5114 0 : throw ConversionException("Error: missing values in field \"" +
5115 0 : name + "\" or invalid syntax(" + s +"')",tableName);
5116 :
5117 :
5118 : // The number of dimension should be 2.
5119 0 : if (tokens.at(0) != "2")
5120 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
5121 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5122 :
5123 : // Then parse the size of the two dimensions
5124 0 : errno = 0;
5125 0 : int size1 = atoi(tokens.at(1).c_str());
5126 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5127 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5128 :
5129 0 : if (size1 <= 0)
5130 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
5131 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5132 0 : errno = 0;
5133 0 : int size2 = atoi(tokens.at(2).c_str());
5134 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5135 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5136 :
5137 0 : if (size2 < 0)
5138 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
5139 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5140 :
5141 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
5142 0 : throw ConversionException("Error: incorrect number of values in field \"" +
5143 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5144 :
5145 0 : int k = 3;
5146 : try {
5147 0 : vector<NetSidebandMod::NetSideband> v_aux;
5148 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
5149 0 : v_aux.clear();
5150 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
5151 0 : v_aux.push_back(CNetSideband::newNetSideband(tokens.at(k).c_str()));
5152 0 : k++;
5153 : }
5154 0 : result.push_back(v_aux);
5155 : }
5156 0 : }
5157 0 : catch (...) {
5158 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a NetSideband.", tableName);
5159 0 : }
5160 0 : return result;
5161 0 : }
5162 :
5163 :
5164 0 : vector<vector<vector<NetSidebandMod::NetSideband> > > EnumerationParser::getNetSideband3D(const string &name, const string &tableName, const string &xmlDoc) {
5165 0 : vector<vector<vector<NetSidebandMod::NetSideband> > >result;
5166 :
5167 0 : string s = getField(xmlDoc,name);
5168 0 : if (s.length() == 0)
5169 0 : throw ConversionException("Error: Missing field \"" +
5170 0 : name + "\" or invalid syntax",tableName);
5171 :
5172 0 : istringstream iss;
5173 0 : iss.str(s);
5174 0 : vector<string> tokens;
5175 :
5176 : // Tokenize.
5177 0 : string buf;
5178 0 : while (iss >> buf) {
5179 0 : tokens.push_back(buf);
5180 : }
5181 :
5182 : // The length must be 4 at the minimum (there may be an empty array)
5183 0 : if (tokens.size() < 4)
5184 0 : throw ConversionException("Error: missing values in field \"" +
5185 0 : name + "\" or invalid syntax(" + s +"')",tableName);
5186 :
5187 :
5188 : // The number of dimension should be 3.
5189 0 : if (tokens.at(0) != "3")
5190 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
5191 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5192 :
5193 : // Then parse the size of the three dimensions
5194 0 : errno = 0;
5195 0 : int size1 = atoi(tokens.at(1).c_str());
5196 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5197 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5198 :
5199 0 : if (size1 <= 0)
5200 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
5201 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5202 :
5203 0 : errno = 0;
5204 0 : int size2 = atoi(tokens.at(2).c_str());
5205 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5206 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5207 :
5208 0 : if (size2 <= 0)
5209 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
5210 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5211 :
5212 0 : errno = 0;
5213 0 : int size3 = atoi(tokens.at(3).c_str());
5214 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5215 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5216 :
5217 :
5218 0 : if (size3 < 0)
5219 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
5220 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5221 :
5222 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
5223 0 : throw ConversionException("Error: incorrect number of values in field \"" +
5224 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5225 :
5226 0 : int k = 4;
5227 : try {
5228 0 : vector<NetSidebandMod::NetSideband> v_aux;
5229 0 : vector<vector<NetSidebandMod::NetSideband> > vv_aux;
5230 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
5231 0 : vv_aux.clear();
5232 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
5233 0 : v_aux.clear();
5234 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
5235 0 : v_aux.push_back(CNetSideband::newNetSideband(tokens.at(k).c_str()));
5236 0 : k++;
5237 : }
5238 0 : vv_aux.push_back(v_aux);
5239 : }
5240 0 : result.push_back(vv_aux);
5241 : }
5242 0 : }
5243 0 : catch (...) {
5244 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a NetSideband.", tableName);
5245 0 : }
5246 :
5247 0 : return result;
5248 0 : }
5249 :
5250 :
5251 :
5252 :
5253 :
5254 83 : string EnumerationParser::toXML(const string& elementName, SidebandProcessingModeMod::SidebandProcessingMode e) {
5255 166 : return "<"+elementName+">"+CSidebandProcessingMode::name(e)+"</"+elementName+">";
5256 : }
5257 :
5258 0 : string EnumerationParser::toXML(const string& elementName, const vector<SidebandProcessingModeMod::SidebandProcessingMode>& v_e) {
5259 0 : ostringstream oss;
5260 : oss << "<" << elementName << ">"
5261 : << " 1"
5262 0 : << " " << v_e.size();
5263 :
5264 0 : for (unsigned int i = 0; i < v_e.size(); i++)
5265 0 : oss << " " << CSidebandProcessingMode::name(v_e.at(i));
5266 0 : oss << "</" << elementName << ">";
5267 0 : return oss.str();
5268 0 : }
5269 :
5270 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<SidebandProcessingModeMod::SidebandProcessingMode> >& vv_e) {
5271 0 : ostringstream oss;
5272 : oss << "<" << elementName << ">"
5273 : << " 2"
5274 0 : << " " <<vv_e.size()
5275 0 : << " " <<vv_e.at(0).size();
5276 :
5277 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
5278 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
5279 0 : oss << " " << CSidebandProcessingMode::name(vv_e.at(i).at(j));
5280 0 : oss << "</" << elementName << ">";
5281 0 : return oss.str();
5282 0 : }
5283 :
5284 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<SidebandProcessingModeMod::SidebandProcessingMode> > >& vvv_e) {
5285 0 : ostringstream oss;
5286 : oss << "<" << elementName << ">"
5287 : << " 3"
5288 0 : << " " <<vvv_e.size()
5289 0 : << " " <<vvv_e.at(0).size()
5290 0 : << " " <<vvv_e.at(0).at(0).size();
5291 :
5292 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
5293 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
5294 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
5295 0 : oss << " " << CSidebandProcessingMode::name(vvv_e.at(i).at(j).at(k));
5296 0 : oss << "</" << elementName << ">";
5297 0 : return oss.str();
5298 0 : }
5299 :
5300 2292 : SidebandProcessingModeMod::SidebandProcessingMode EnumerationParser::getSidebandProcessingMode(const string &name, const string &tableName, const string &xmlDoc) {
5301 2292 : string s = getField(xmlDoc,name);
5302 2292 : if (s.length() == 0)
5303 0 : throw ConversionException("Error: Missing field \"" +
5304 0 : name + "\" or invalid syntax",tableName);
5305 :
5306 : SidebandProcessingMode result;
5307 : try {
5308 2292 : result = CSidebandProcessingMode::newSidebandProcessingMode(s);
5309 : }
5310 0 : catch (...) {
5311 0 : throw ConversionException("Error: could not convert '"+s+"' into a SidebandProcessingMode.", tableName);
5312 0 : }
5313 2292 : return result;
5314 2292 : }
5315 :
5316 0 : vector<SidebandProcessingModeMod::SidebandProcessingMode> EnumerationParser::getSidebandProcessingMode1D(const string &name, const string &tableName, const string &xmlDoc) {
5317 0 : vector<SidebandProcessingModeMod::SidebandProcessingMode> result;
5318 :
5319 0 : string s = getField(xmlDoc,name);
5320 0 : if (s.length() == 0)
5321 0 : throw ConversionException("Error: Missing field \"" +
5322 0 : name + "\" or invalid syntax",tableName);
5323 :
5324 0 : istringstream iss;
5325 0 : iss.str(s);
5326 0 : vector<string> tokens;
5327 :
5328 : // Tokenize.
5329 0 : string buf;
5330 0 : while (iss >> buf) {
5331 0 : tokens.push_back(buf);
5332 : }
5333 :
5334 : // The length must be 2 at the minimum (there may be an empty array)
5335 0 : if (tokens.size() < 2)
5336 0 : throw ConversionException("Error: missing values in field \"" +
5337 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5338 :
5339 :
5340 :
5341 : // The number of dimension should be 1.
5342 0 : if (tokens.at(0) != "1")
5343 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
5344 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5345 :
5346 : // Then parse the size of the unique dimension
5347 0 : errno = 0;
5348 0 : int size1 = atoi(tokens.at(1).c_str());
5349 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5350 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5351 :
5352 0 : if (size1 < 0)
5353 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
5354 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5355 :
5356 0 : if (tokens.size() != (unsigned int) (size1 + 2))
5357 0 : throw ConversionException("Error: incorrect number of values in field \"" +
5358 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5359 :
5360 0 : int k = 2;
5361 : try {
5362 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
5363 0 : result.push_back(CSidebandProcessingMode::newSidebandProcessingMode(tokens.at(k).c_str()));
5364 0 : k++;
5365 : }
5366 : }
5367 0 : catch (...) {
5368 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SidebandProcessingMode.", tableName);
5369 0 : }
5370 :
5371 0 : return result;
5372 0 : }
5373 :
5374 0 : vector<vector<SidebandProcessingModeMod::SidebandProcessingMode> > EnumerationParser::getSidebandProcessingMode2D(const string &name, const string &tableName, const string &xmlDoc) {
5375 0 : vector<vector<SidebandProcessingModeMod::SidebandProcessingMode> > result;
5376 :
5377 0 : string s = getField(xmlDoc,name);
5378 0 : if (s.length() == 0)
5379 0 : throw ConversionException("Error: Missing field \"" +
5380 0 : name + "\" or invalid syntax",tableName);
5381 :
5382 0 : istringstream iss;
5383 0 : iss.str(s);
5384 0 : vector<string> tokens;
5385 :
5386 : // Tokenize.
5387 0 : string buf;
5388 0 : while (iss >> buf) {
5389 0 : tokens.push_back(buf);
5390 : }
5391 :
5392 : // The length must be 3 at the minimum (there may be an empty array)
5393 0 : if (tokens.size() < 3)
5394 0 : throw ConversionException("Error: missing values in field \"" +
5395 0 : name + "\" or invalid syntax(" + s +"')",tableName);
5396 :
5397 :
5398 : // The number of dimension should be 2.
5399 0 : if (tokens.at(0) != "2")
5400 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
5401 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5402 :
5403 : // Then parse the size of the two dimensions
5404 0 : errno = 0;
5405 0 : int size1 = atoi(tokens.at(1).c_str());
5406 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5407 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5408 :
5409 0 : if (size1 <= 0)
5410 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
5411 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5412 0 : errno = 0;
5413 0 : int size2 = atoi(tokens.at(2).c_str());
5414 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5415 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5416 :
5417 0 : if (size2 < 0)
5418 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
5419 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5420 :
5421 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
5422 0 : throw ConversionException("Error: incorrect number of values in field \"" +
5423 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5424 :
5425 0 : int k = 3;
5426 : try {
5427 0 : vector<SidebandProcessingModeMod::SidebandProcessingMode> v_aux;
5428 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
5429 0 : v_aux.clear();
5430 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
5431 0 : v_aux.push_back(CSidebandProcessingMode::newSidebandProcessingMode(tokens.at(k).c_str()));
5432 0 : k++;
5433 : }
5434 0 : result.push_back(v_aux);
5435 : }
5436 0 : }
5437 0 : catch (...) {
5438 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SidebandProcessingMode.", tableName);
5439 0 : }
5440 0 : return result;
5441 0 : }
5442 :
5443 :
5444 0 : vector<vector<vector<SidebandProcessingModeMod::SidebandProcessingMode> > > EnumerationParser::getSidebandProcessingMode3D(const string &name, const string &tableName, const string &xmlDoc) {
5445 0 : vector<vector<vector<SidebandProcessingModeMod::SidebandProcessingMode> > >result;
5446 :
5447 0 : string s = getField(xmlDoc,name);
5448 0 : if (s.length() == 0)
5449 0 : throw ConversionException("Error: Missing field \"" +
5450 0 : name + "\" or invalid syntax",tableName);
5451 :
5452 0 : istringstream iss;
5453 0 : iss.str(s);
5454 0 : vector<string> tokens;
5455 :
5456 : // Tokenize.
5457 0 : string buf;
5458 0 : while (iss >> buf) {
5459 0 : tokens.push_back(buf);
5460 : }
5461 :
5462 : // The length must be 4 at the minimum (there may be an empty array)
5463 0 : if (tokens.size() < 4)
5464 0 : throw ConversionException("Error: missing values in field \"" +
5465 0 : name + "\" or invalid syntax(" + s +"')",tableName);
5466 :
5467 :
5468 : // The number of dimension should be 3.
5469 0 : if (tokens.at(0) != "3")
5470 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
5471 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5472 :
5473 : // Then parse the size of the three dimensions
5474 0 : errno = 0;
5475 0 : int size1 = atoi(tokens.at(1).c_str());
5476 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5477 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5478 :
5479 0 : if (size1 <= 0)
5480 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
5481 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5482 :
5483 0 : errno = 0;
5484 0 : int size2 = atoi(tokens.at(2).c_str());
5485 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5486 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5487 :
5488 0 : if (size2 <= 0)
5489 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
5490 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5491 :
5492 0 : errno = 0;
5493 0 : int size3 = atoi(tokens.at(3).c_str());
5494 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5495 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5496 :
5497 :
5498 0 : if (size3 < 0)
5499 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
5500 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5501 :
5502 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
5503 0 : throw ConversionException("Error: incorrect number of values in field \"" +
5504 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5505 :
5506 0 : int k = 4;
5507 : try {
5508 0 : vector<SidebandProcessingModeMod::SidebandProcessingMode> v_aux;
5509 0 : vector<vector<SidebandProcessingModeMod::SidebandProcessingMode> > vv_aux;
5510 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
5511 0 : vv_aux.clear();
5512 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
5513 0 : v_aux.clear();
5514 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
5515 0 : v_aux.push_back(CSidebandProcessingMode::newSidebandProcessingMode(tokens.at(k).c_str()));
5516 0 : k++;
5517 : }
5518 0 : vv_aux.push_back(v_aux);
5519 : }
5520 0 : result.push_back(vv_aux);
5521 : }
5522 0 : }
5523 0 : catch (...) {
5524 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a SidebandProcessingMode.", tableName);
5525 0 : }
5526 :
5527 0 : return result;
5528 0 : }
5529 :
5530 :
5531 :
5532 :
5533 :
5534 83 : string EnumerationParser::toXML(const string& elementName, WindowFunctionMod::WindowFunction e) {
5535 166 : return "<"+elementName+">"+CWindowFunction::name(e)+"</"+elementName+">";
5536 : }
5537 :
5538 0 : string EnumerationParser::toXML(const string& elementName, const vector<WindowFunctionMod::WindowFunction>& v_e) {
5539 0 : ostringstream oss;
5540 : oss << "<" << elementName << ">"
5541 : << " 1"
5542 0 : << " " << v_e.size();
5543 :
5544 0 : for (unsigned int i = 0; i < v_e.size(); i++)
5545 0 : oss << " " << CWindowFunction::name(v_e.at(i));
5546 0 : oss << "</" << elementName << ">";
5547 0 : return oss.str();
5548 0 : }
5549 :
5550 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<WindowFunctionMod::WindowFunction> >& vv_e) {
5551 0 : ostringstream oss;
5552 : oss << "<" << elementName << ">"
5553 : << " 2"
5554 0 : << " " <<vv_e.size()
5555 0 : << " " <<vv_e.at(0).size();
5556 :
5557 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
5558 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
5559 0 : oss << " " << CWindowFunction::name(vv_e.at(i).at(j));
5560 0 : oss << "</" << elementName << ">";
5561 0 : return oss.str();
5562 0 : }
5563 :
5564 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<WindowFunctionMod::WindowFunction> > >& vvv_e) {
5565 0 : ostringstream oss;
5566 : oss << "<" << elementName << ">"
5567 : << " 3"
5568 0 : << " " <<vvv_e.size()
5569 0 : << " " <<vvv_e.at(0).size()
5570 0 : << " " <<vvv_e.at(0).at(0).size();
5571 :
5572 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
5573 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
5574 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
5575 0 : oss << " " << CWindowFunction::name(vvv_e.at(i).at(j).at(k));
5576 0 : oss << "</" << elementName << ">";
5577 0 : return oss.str();
5578 0 : }
5579 :
5580 2292 : WindowFunctionMod::WindowFunction EnumerationParser::getWindowFunction(const string &name, const string &tableName, const string &xmlDoc) {
5581 2292 : string s = getField(xmlDoc,name);
5582 2292 : if (s.length() == 0)
5583 0 : throw ConversionException("Error: Missing field \"" +
5584 0 : name + "\" or invalid syntax",tableName);
5585 :
5586 : WindowFunction result;
5587 : try {
5588 2292 : result = CWindowFunction::newWindowFunction(s);
5589 : }
5590 0 : catch (...) {
5591 0 : throw ConversionException("Error: could not convert '"+s+"' into a WindowFunction.", tableName);
5592 0 : }
5593 2292 : return result;
5594 2292 : }
5595 :
5596 0 : vector<WindowFunctionMod::WindowFunction> EnumerationParser::getWindowFunction1D(const string &name, const string &tableName, const string &xmlDoc) {
5597 0 : vector<WindowFunctionMod::WindowFunction> result;
5598 :
5599 0 : string s = getField(xmlDoc,name);
5600 0 : if (s.length() == 0)
5601 0 : throw ConversionException("Error: Missing field \"" +
5602 0 : name + "\" or invalid syntax",tableName);
5603 :
5604 0 : istringstream iss;
5605 0 : iss.str(s);
5606 0 : vector<string> tokens;
5607 :
5608 : // Tokenize.
5609 0 : string buf;
5610 0 : while (iss >> buf) {
5611 0 : tokens.push_back(buf);
5612 : }
5613 :
5614 : // The length must be 2 at the minimum (there may be an empty array)
5615 0 : if (tokens.size() < 2)
5616 0 : throw ConversionException("Error: missing values in field \"" +
5617 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5618 :
5619 :
5620 :
5621 : // The number of dimension should be 1.
5622 0 : if (tokens.at(0) != "1")
5623 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
5624 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5625 :
5626 : // Then parse the size of the unique dimension
5627 0 : errno = 0;
5628 0 : int size1 = atoi(tokens.at(1).c_str());
5629 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5630 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5631 :
5632 0 : if (size1 < 0)
5633 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
5634 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5635 :
5636 0 : if (tokens.size() != (unsigned int) (size1 + 2))
5637 0 : throw ConversionException("Error: incorrect number of values in field \"" +
5638 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5639 :
5640 0 : int k = 2;
5641 : try {
5642 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
5643 0 : result.push_back(CWindowFunction::newWindowFunction(tokens.at(k).c_str()));
5644 0 : k++;
5645 : }
5646 : }
5647 0 : catch (...) {
5648 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a WindowFunction.", tableName);
5649 0 : }
5650 :
5651 0 : return result;
5652 0 : }
5653 :
5654 0 : vector<vector<WindowFunctionMod::WindowFunction> > EnumerationParser::getWindowFunction2D(const string &name, const string &tableName, const string &xmlDoc) {
5655 0 : vector<vector<WindowFunctionMod::WindowFunction> > result;
5656 :
5657 0 : string s = getField(xmlDoc,name);
5658 0 : if (s.length() == 0)
5659 0 : throw ConversionException("Error: Missing field \"" +
5660 0 : name + "\" or invalid syntax",tableName);
5661 :
5662 0 : istringstream iss;
5663 0 : iss.str(s);
5664 0 : vector<string> tokens;
5665 :
5666 : // Tokenize.
5667 0 : string buf;
5668 0 : while (iss >> buf) {
5669 0 : tokens.push_back(buf);
5670 : }
5671 :
5672 : // The length must be 3 at the minimum (there may be an empty array)
5673 0 : if (tokens.size() < 3)
5674 0 : throw ConversionException("Error: missing values in field \"" +
5675 0 : name + "\" or invalid syntax(" + s +"')",tableName);
5676 :
5677 :
5678 : // The number of dimension should be 2.
5679 0 : if (tokens.at(0) != "2")
5680 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
5681 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5682 :
5683 : // Then parse the size of the two dimensions
5684 0 : errno = 0;
5685 0 : int size1 = atoi(tokens.at(1).c_str());
5686 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5687 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5688 :
5689 0 : if (size1 <= 0)
5690 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
5691 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5692 0 : errno = 0;
5693 0 : int size2 = atoi(tokens.at(2).c_str());
5694 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5695 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5696 :
5697 0 : if (size2 < 0)
5698 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
5699 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5700 :
5701 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
5702 0 : throw ConversionException("Error: incorrect number of values in field \"" +
5703 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5704 :
5705 0 : int k = 3;
5706 : try {
5707 0 : vector<WindowFunctionMod::WindowFunction> v_aux;
5708 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
5709 0 : v_aux.clear();
5710 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
5711 0 : v_aux.push_back(CWindowFunction::newWindowFunction(tokens.at(k).c_str()));
5712 0 : k++;
5713 : }
5714 0 : result.push_back(v_aux);
5715 : }
5716 0 : }
5717 0 : catch (...) {
5718 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a WindowFunction.", tableName);
5719 0 : }
5720 0 : return result;
5721 0 : }
5722 :
5723 :
5724 0 : vector<vector<vector<WindowFunctionMod::WindowFunction> > > EnumerationParser::getWindowFunction3D(const string &name, const string &tableName, const string &xmlDoc) {
5725 0 : vector<vector<vector<WindowFunctionMod::WindowFunction> > >result;
5726 :
5727 0 : string s = getField(xmlDoc,name);
5728 0 : if (s.length() == 0)
5729 0 : throw ConversionException("Error: Missing field \"" +
5730 0 : name + "\" or invalid syntax",tableName);
5731 :
5732 0 : istringstream iss;
5733 0 : iss.str(s);
5734 0 : vector<string> tokens;
5735 :
5736 : // Tokenize.
5737 0 : string buf;
5738 0 : while (iss >> buf) {
5739 0 : tokens.push_back(buf);
5740 : }
5741 :
5742 : // The length must be 4 at the minimum (there may be an empty array)
5743 0 : if (tokens.size() < 4)
5744 0 : throw ConversionException("Error: missing values in field \"" +
5745 0 : name + "\" or invalid syntax(" + s +"')",tableName);
5746 :
5747 :
5748 : // The number of dimension should be 3.
5749 0 : if (tokens.at(0) != "3")
5750 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
5751 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5752 :
5753 : // Then parse the size of the three dimensions
5754 0 : errno = 0;
5755 0 : int size1 = atoi(tokens.at(1).c_str());
5756 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5757 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5758 :
5759 0 : if (size1 <= 0)
5760 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
5761 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5762 :
5763 0 : errno = 0;
5764 0 : int size2 = atoi(tokens.at(2).c_str());
5765 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5766 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5767 :
5768 0 : if (size2 <= 0)
5769 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
5770 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5771 :
5772 0 : errno = 0;
5773 0 : int size3 = atoi(tokens.at(3).c_str());
5774 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5775 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5776 :
5777 :
5778 0 : if (size3 < 0)
5779 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
5780 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5781 :
5782 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
5783 0 : throw ConversionException("Error: incorrect number of values in field \"" +
5784 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5785 :
5786 0 : int k = 4;
5787 : try {
5788 0 : vector<WindowFunctionMod::WindowFunction> v_aux;
5789 0 : vector<vector<WindowFunctionMod::WindowFunction> > vv_aux;
5790 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
5791 0 : vv_aux.clear();
5792 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
5793 0 : v_aux.clear();
5794 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
5795 0 : v_aux.push_back(CWindowFunction::newWindowFunction(tokens.at(k).c_str()));
5796 0 : k++;
5797 : }
5798 0 : vv_aux.push_back(v_aux);
5799 : }
5800 0 : result.push_back(vv_aux);
5801 : }
5802 0 : }
5803 0 : catch (...) {
5804 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a WindowFunction.", tableName);
5805 0 : }
5806 :
5807 0 : return result;
5808 0 : }
5809 :
5810 :
5811 :
5812 :
5813 :
5814 0 : string EnumerationParser::toXML(const string& elementName, CorrelationBitMod::CorrelationBit e) {
5815 0 : return "<"+elementName+">"+CCorrelationBit::name(e)+"</"+elementName+">";
5816 : }
5817 :
5818 0 : string EnumerationParser::toXML(const string& elementName, const vector<CorrelationBitMod::CorrelationBit>& v_e) {
5819 0 : ostringstream oss;
5820 : oss << "<" << elementName << ">"
5821 : << " 1"
5822 0 : << " " << v_e.size();
5823 :
5824 0 : for (unsigned int i = 0; i < v_e.size(); i++)
5825 0 : oss << " " << CCorrelationBit::name(v_e.at(i));
5826 0 : oss << "</" << elementName << ">";
5827 0 : return oss.str();
5828 0 : }
5829 :
5830 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CorrelationBitMod::CorrelationBit> >& vv_e) {
5831 0 : ostringstream oss;
5832 : oss << "<" << elementName << ">"
5833 : << " 2"
5834 0 : << " " <<vv_e.size()
5835 0 : << " " <<vv_e.at(0).size();
5836 :
5837 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
5838 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
5839 0 : oss << " " << CCorrelationBit::name(vv_e.at(i).at(j));
5840 0 : oss << "</" << elementName << ">";
5841 0 : return oss.str();
5842 0 : }
5843 :
5844 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CorrelationBitMod::CorrelationBit> > >& vvv_e) {
5845 0 : ostringstream oss;
5846 : oss << "<" << elementName << ">"
5847 : << " 3"
5848 0 : << " " <<vvv_e.size()
5849 0 : << " " <<vvv_e.at(0).size()
5850 0 : << " " <<vvv_e.at(0).at(0).size();
5851 :
5852 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
5853 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
5854 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
5855 0 : oss << " " << CCorrelationBit::name(vvv_e.at(i).at(j).at(k));
5856 0 : oss << "</" << elementName << ">";
5857 0 : return oss.str();
5858 0 : }
5859 :
5860 298 : CorrelationBitMod::CorrelationBit EnumerationParser::getCorrelationBit(const string &name, const string &tableName, const string &xmlDoc) {
5861 298 : string s = getField(xmlDoc,name);
5862 298 : if (s.length() == 0)
5863 0 : throw ConversionException("Error: Missing field \"" +
5864 0 : name + "\" or invalid syntax",tableName);
5865 :
5866 : CorrelationBit result;
5867 : try {
5868 298 : result = CCorrelationBit::newCorrelationBit(s);
5869 : }
5870 0 : catch (...) {
5871 0 : throw ConversionException("Error: could not convert '"+s+"' into a CorrelationBit.", tableName);
5872 0 : }
5873 298 : return result;
5874 298 : }
5875 :
5876 0 : vector<CorrelationBitMod::CorrelationBit> EnumerationParser::getCorrelationBit1D(const string &name, const string &tableName, const string &xmlDoc) {
5877 0 : vector<CorrelationBitMod::CorrelationBit> result;
5878 :
5879 0 : string s = getField(xmlDoc,name);
5880 0 : if (s.length() == 0)
5881 0 : throw ConversionException("Error: Missing field \"" +
5882 0 : name + "\" or invalid syntax",tableName);
5883 :
5884 0 : istringstream iss;
5885 0 : iss.str(s);
5886 0 : vector<string> tokens;
5887 :
5888 : // Tokenize.
5889 0 : string buf;
5890 0 : while (iss >> buf) {
5891 0 : tokens.push_back(buf);
5892 : }
5893 :
5894 : // The length must be 2 at the minimum (there may be an empty array)
5895 0 : if (tokens.size() < 2)
5896 0 : throw ConversionException("Error: missing values in field \"" +
5897 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5898 :
5899 :
5900 :
5901 : // The number of dimension should be 1.
5902 0 : if (tokens.at(0) != "1")
5903 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
5904 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5905 :
5906 : // Then parse the size of the unique dimension
5907 0 : errno = 0;
5908 0 : int size1 = atoi(tokens.at(1).c_str());
5909 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5910 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5911 :
5912 0 : if (size1 < 0)
5913 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
5914 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5915 :
5916 0 : if (tokens.size() != (unsigned int) (size1 + 2))
5917 0 : throw ConversionException("Error: incorrect number of values in field \"" +
5918 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5919 :
5920 0 : int k = 2;
5921 : try {
5922 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
5923 0 : result.push_back(CCorrelationBit::newCorrelationBit(tokens.at(k).c_str()));
5924 0 : k++;
5925 : }
5926 : }
5927 0 : catch (...) {
5928 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelationBit.", tableName);
5929 0 : }
5930 :
5931 0 : return result;
5932 0 : }
5933 :
5934 0 : vector<vector<CorrelationBitMod::CorrelationBit> > EnumerationParser::getCorrelationBit2D(const string &name, const string &tableName, const string &xmlDoc) {
5935 0 : vector<vector<CorrelationBitMod::CorrelationBit> > result;
5936 :
5937 0 : string s = getField(xmlDoc,name);
5938 0 : if (s.length() == 0)
5939 0 : throw ConversionException("Error: Missing field \"" +
5940 0 : name + "\" or invalid syntax",tableName);
5941 :
5942 0 : istringstream iss;
5943 0 : iss.str(s);
5944 0 : vector<string> tokens;
5945 :
5946 : // Tokenize.
5947 0 : string buf;
5948 0 : while (iss >> buf) {
5949 0 : tokens.push_back(buf);
5950 : }
5951 :
5952 : // The length must be 3 at the minimum (there may be an empty array)
5953 0 : if (tokens.size() < 3)
5954 0 : throw ConversionException("Error: missing values in field \"" +
5955 0 : name + "\" or invalid syntax(" + s +"')",tableName);
5956 :
5957 :
5958 : // The number of dimension should be 2.
5959 0 : if (tokens.at(0) != "2")
5960 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
5961 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5962 :
5963 : // Then parse the size of the two dimensions
5964 0 : errno = 0;
5965 0 : int size1 = atoi(tokens.at(1).c_str());
5966 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5967 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5968 :
5969 0 : if (size1 <= 0)
5970 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
5971 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5972 0 : errno = 0;
5973 0 : int size2 = atoi(tokens.at(2).c_str());
5974 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
5975 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
5976 :
5977 0 : if (size2 < 0)
5978 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
5979 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5980 :
5981 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
5982 0 : throw ConversionException("Error: incorrect number of values in field \"" +
5983 0 : name + "\" or invalid syntax('" + s +"')",tableName);
5984 :
5985 0 : int k = 3;
5986 : try {
5987 0 : vector<CorrelationBitMod::CorrelationBit> v_aux;
5988 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
5989 0 : v_aux.clear();
5990 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
5991 0 : v_aux.push_back(CCorrelationBit::newCorrelationBit(tokens.at(k).c_str()));
5992 0 : k++;
5993 : }
5994 0 : result.push_back(v_aux);
5995 : }
5996 0 : }
5997 0 : catch (...) {
5998 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelationBit.", tableName);
5999 0 : }
6000 0 : return result;
6001 0 : }
6002 :
6003 :
6004 0 : vector<vector<vector<CorrelationBitMod::CorrelationBit> > > EnumerationParser::getCorrelationBit3D(const string &name, const string &tableName, const string &xmlDoc) {
6005 0 : vector<vector<vector<CorrelationBitMod::CorrelationBit> > >result;
6006 :
6007 0 : string s = getField(xmlDoc,name);
6008 0 : if (s.length() == 0)
6009 0 : throw ConversionException("Error: Missing field \"" +
6010 0 : name + "\" or invalid syntax",tableName);
6011 :
6012 0 : istringstream iss;
6013 0 : iss.str(s);
6014 0 : vector<string> tokens;
6015 :
6016 : // Tokenize.
6017 0 : string buf;
6018 0 : while (iss >> buf) {
6019 0 : tokens.push_back(buf);
6020 : }
6021 :
6022 : // The length must be 4 at the minimum (there may be an empty array)
6023 0 : if (tokens.size() < 4)
6024 0 : throw ConversionException("Error: missing values in field \"" +
6025 0 : name + "\" or invalid syntax(" + s +"')",tableName);
6026 :
6027 :
6028 : // The number of dimension should be 3.
6029 0 : if (tokens.at(0) != "3")
6030 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
6031 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6032 :
6033 : // Then parse the size of the three dimensions
6034 0 : errno = 0;
6035 0 : int size1 = atoi(tokens.at(1).c_str());
6036 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6037 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6038 :
6039 0 : if (size1 <= 0)
6040 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
6041 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6042 :
6043 0 : errno = 0;
6044 0 : int size2 = atoi(tokens.at(2).c_str());
6045 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6046 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6047 :
6048 0 : if (size2 <= 0)
6049 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
6050 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6051 :
6052 0 : errno = 0;
6053 0 : int size3 = atoi(tokens.at(3).c_str());
6054 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6055 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6056 :
6057 :
6058 0 : if (size3 < 0)
6059 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
6060 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6061 :
6062 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
6063 0 : throw ConversionException("Error: incorrect number of values in field \"" +
6064 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6065 :
6066 0 : int k = 4;
6067 : try {
6068 0 : vector<CorrelationBitMod::CorrelationBit> v_aux;
6069 0 : vector<vector<CorrelationBitMod::CorrelationBit> > vv_aux;
6070 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
6071 0 : vv_aux.clear();
6072 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
6073 0 : v_aux.clear();
6074 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
6075 0 : v_aux.push_back(CCorrelationBit::newCorrelationBit(tokens.at(k).c_str()));
6076 0 : k++;
6077 : }
6078 0 : vv_aux.push_back(v_aux);
6079 : }
6080 0 : result.push_back(vv_aux);
6081 : }
6082 0 : }
6083 0 : catch (...) {
6084 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelationBit.", tableName);
6085 0 : }
6086 :
6087 0 : return result;
6088 0 : }
6089 :
6090 :
6091 :
6092 :
6093 :
6094 83 : string EnumerationParser::toXML(const string& elementName, ReceiverSidebandMod::ReceiverSideband e) {
6095 166 : return "<"+elementName+">"+CReceiverSideband::name(e)+"</"+elementName+">";
6096 : }
6097 :
6098 0 : string EnumerationParser::toXML(const string& elementName, const vector<ReceiverSidebandMod::ReceiverSideband>& v_e) {
6099 0 : ostringstream oss;
6100 : oss << "<" << elementName << ">"
6101 : << " 1"
6102 0 : << " " << v_e.size();
6103 :
6104 0 : for (unsigned int i = 0; i < v_e.size(); i++)
6105 0 : oss << " " << CReceiverSideband::name(v_e.at(i));
6106 0 : oss << "</" << elementName << ">";
6107 0 : return oss.str();
6108 0 : }
6109 :
6110 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<ReceiverSidebandMod::ReceiverSideband> >& vv_e) {
6111 0 : ostringstream oss;
6112 : oss << "<" << elementName << ">"
6113 : << " 2"
6114 0 : << " " <<vv_e.size()
6115 0 : << " " <<vv_e.at(0).size();
6116 :
6117 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
6118 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
6119 0 : oss << " " << CReceiverSideband::name(vv_e.at(i).at(j));
6120 0 : oss << "</" << elementName << ">";
6121 0 : return oss.str();
6122 0 : }
6123 :
6124 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<ReceiverSidebandMod::ReceiverSideband> > >& vvv_e) {
6125 0 : ostringstream oss;
6126 : oss << "<" << elementName << ">"
6127 : << " 3"
6128 0 : << " " <<vvv_e.size()
6129 0 : << " " <<vvv_e.at(0).size()
6130 0 : << " " <<vvv_e.at(0).at(0).size();
6131 :
6132 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
6133 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
6134 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
6135 0 : oss << " " << CReceiverSideband::name(vvv_e.at(i).at(j).at(k));
6136 0 : oss << "</" << elementName << ">";
6137 0 : return oss.str();
6138 0 : }
6139 :
6140 0 : ReceiverSidebandMod::ReceiverSideband EnumerationParser::getReceiverSideband(const string &name, const string &tableName, const string &xmlDoc) {
6141 0 : string s = getField(xmlDoc,name);
6142 0 : if (s.length() == 0)
6143 0 : throw ConversionException("Error: Missing field \"" +
6144 0 : name + "\" or invalid syntax",tableName);
6145 :
6146 : ReceiverSideband result;
6147 : try {
6148 0 : result = CReceiverSideband::newReceiverSideband(s);
6149 : }
6150 0 : catch (...) {
6151 0 : throw ConversionException("Error: could not convert '"+s+"' into a ReceiverSideband.", tableName);
6152 0 : }
6153 0 : return result;
6154 0 : }
6155 :
6156 0 : vector<ReceiverSidebandMod::ReceiverSideband> EnumerationParser::getReceiverSideband1D(const string &name, const string &tableName, const string &xmlDoc) {
6157 0 : vector<ReceiverSidebandMod::ReceiverSideband> result;
6158 :
6159 0 : string s = getField(xmlDoc,name);
6160 0 : if (s.length() == 0)
6161 0 : throw ConversionException("Error: Missing field \"" +
6162 0 : name + "\" or invalid syntax",tableName);
6163 :
6164 0 : istringstream iss;
6165 0 : iss.str(s);
6166 0 : vector<string> tokens;
6167 :
6168 : // Tokenize.
6169 0 : string buf;
6170 0 : while (iss >> buf) {
6171 0 : tokens.push_back(buf);
6172 : }
6173 :
6174 : // The length must be 2 at the minimum (there may be an empty array)
6175 0 : if (tokens.size() < 2)
6176 0 : throw ConversionException("Error: missing values in field \"" +
6177 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6178 :
6179 :
6180 :
6181 : // The number of dimension should be 1.
6182 0 : if (tokens.at(0) != "1")
6183 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
6184 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6185 :
6186 : // Then parse the size of the unique dimension
6187 0 : errno = 0;
6188 0 : int size1 = atoi(tokens.at(1).c_str());
6189 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6190 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6191 :
6192 0 : if (size1 < 0)
6193 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
6194 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6195 :
6196 0 : if (tokens.size() != (unsigned int) (size1 + 2))
6197 0 : throw ConversionException("Error: incorrect number of values in field \"" +
6198 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6199 :
6200 0 : int k = 2;
6201 : try {
6202 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
6203 0 : result.push_back(CReceiverSideband::newReceiverSideband(tokens.at(k).c_str()));
6204 0 : k++;
6205 : }
6206 : }
6207 0 : catch (...) {
6208 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ReceiverSideband.", tableName);
6209 0 : }
6210 :
6211 0 : return result;
6212 0 : }
6213 :
6214 0 : vector<vector<ReceiverSidebandMod::ReceiverSideband> > EnumerationParser::getReceiverSideband2D(const string &name, const string &tableName, const string &xmlDoc) {
6215 0 : vector<vector<ReceiverSidebandMod::ReceiverSideband> > result;
6216 :
6217 0 : string s = getField(xmlDoc,name);
6218 0 : if (s.length() == 0)
6219 0 : throw ConversionException("Error: Missing field \"" +
6220 0 : name + "\" or invalid syntax",tableName);
6221 :
6222 0 : istringstream iss;
6223 0 : iss.str(s);
6224 0 : vector<string> tokens;
6225 :
6226 : // Tokenize.
6227 0 : string buf;
6228 0 : while (iss >> buf) {
6229 0 : tokens.push_back(buf);
6230 : }
6231 :
6232 : // The length must be 3 at the minimum (there may be an empty array)
6233 0 : if (tokens.size() < 3)
6234 0 : throw ConversionException("Error: missing values in field \"" +
6235 0 : name + "\" or invalid syntax(" + s +"')",tableName);
6236 :
6237 :
6238 : // The number of dimension should be 2.
6239 0 : if (tokens.at(0) != "2")
6240 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
6241 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6242 :
6243 : // Then parse the size of the two dimensions
6244 0 : errno = 0;
6245 0 : int size1 = atoi(tokens.at(1).c_str());
6246 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6247 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6248 :
6249 0 : if (size1 <= 0)
6250 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
6251 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6252 0 : errno = 0;
6253 0 : int size2 = atoi(tokens.at(2).c_str());
6254 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6255 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6256 :
6257 0 : if (size2 < 0)
6258 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
6259 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6260 :
6261 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
6262 0 : throw ConversionException("Error: incorrect number of values in field \"" +
6263 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6264 :
6265 0 : int k = 3;
6266 : try {
6267 0 : vector<ReceiverSidebandMod::ReceiverSideband> v_aux;
6268 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
6269 0 : v_aux.clear();
6270 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
6271 0 : v_aux.push_back(CReceiverSideband::newReceiverSideband(tokens.at(k).c_str()));
6272 0 : k++;
6273 : }
6274 0 : result.push_back(v_aux);
6275 : }
6276 0 : }
6277 0 : catch (...) {
6278 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ReceiverSideband.", tableName);
6279 0 : }
6280 0 : return result;
6281 0 : }
6282 :
6283 :
6284 0 : vector<vector<vector<ReceiverSidebandMod::ReceiverSideband> > > EnumerationParser::getReceiverSideband3D(const string &name, const string &tableName, const string &xmlDoc) {
6285 0 : vector<vector<vector<ReceiverSidebandMod::ReceiverSideband> > >result;
6286 :
6287 0 : string s = getField(xmlDoc,name);
6288 0 : if (s.length() == 0)
6289 0 : throw ConversionException("Error: Missing field \"" +
6290 0 : name + "\" or invalid syntax",tableName);
6291 :
6292 0 : istringstream iss;
6293 0 : iss.str(s);
6294 0 : vector<string> tokens;
6295 :
6296 : // Tokenize.
6297 0 : string buf;
6298 0 : while (iss >> buf) {
6299 0 : tokens.push_back(buf);
6300 : }
6301 :
6302 : // The length must be 4 at the minimum (there may be an empty array)
6303 0 : if (tokens.size() < 4)
6304 0 : throw ConversionException("Error: missing values in field \"" +
6305 0 : name + "\" or invalid syntax(" + s +"')",tableName);
6306 :
6307 :
6308 : // The number of dimension should be 3.
6309 0 : if (tokens.at(0) != "3")
6310 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
6311 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6312 :
6313 : // Then parse the size of the three dimensions
6314 0 : errno = 0;
6315 0 : int size1 = atoi(tokens.at(1).c_str());
6316 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6317 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6318 :
6319 0 : if (size1 <= 0)
6320 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
6321 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6322 :
6323 0 : errno = 0;
6324 0 : int size2 = atoi(tokens.at(2).c_str());
6325 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6326 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6327 :
6328 0 : if (size2 <= 0)
6329 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
6330 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6331 :
6332 0 : errno = 0;
6333 0 : int size3 = atoi(tokens.at(3).c_str());
6334 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6335 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6336 :
6337 :
6338 0 : if (size3 < 0)
6339 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
6340 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6341 :
6342 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
6343 0 : throw ConversionException("Error: incorrect number of values in field \"" +
6344 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6345 :
6346 0 : int k = 4;
6347 : try {
6348 0 : vector<ReceiverSidebandMod::ReceiverSideband> v_aux;
6349 0 : vector<vector<ReceiverSidebandMod::ReceiverSideband> > vv_aux;
6350 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
6351 0 : vv_aux.clear();
6352 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
6353 0 : v_aux.clear();
6354 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
6355 0 : v_aux.push_back(CReceiverSideband::newReceiverSideband(tokens.at(k).c_str()));
6356 0 : k++;
6357 : }
6358 0 : vv_aux.push_back(v_aux);
6359 : }
6360 0 : result.push_back(vv_aux);
6361 : }
6362 0 : }
6363 0 : catch (...) {
6364 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a ReceiverSideband.", tableName);
6365 0 : }
6366 :
6367 0 : return result;
6368 0 : }
6369 :
6370 :
6371 :
6372 :
6373 :
6374 13 : string EnumerationParser::toXML(const string& elementName, ProcessorSubTypeMod::ProcessorSubType e) {
6375 26 : return "<"+elementName+">"+CProcessorSubType::name(e)+"</"+elementName+">";
6376 : }
6377 :
6378 0 : string EnumerationParser::toXML(const string& elementName, const vector<ProcessorSubTypeMod::ProcessorSubType>& v_e) {
6379 0 : ostringstream oss;
6380 : oss << "<" << elementName << ">"
6381 : << " 1"
6382 0 : << " " << v_e.size();
6383 :
6384 0 : for (unsigned int i = 0; i < v_e.size(); i++)
6385 0 : oss << " " << CProcessorSubType::name(v_e.at(i));
6386 0 : oss << "</" << elementName << ">";
6387 0 : return oss.str();
6388 0 : }
6389 :
6390 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<ProcessorSubTypeMod::ProcessorSubType> >& vv_e) {
6391 0 : ostringstream oss;
6392 : oss << "<" << elementName << ">"
6393 : << " 2"
6394 0 : << " " <<vv_e.size()
6395 0 : << " " <<vv_e.at(0).size();
6396 :
6397 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
6398 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
6399 0 : oss << " " << CProcessorSubType::name(vv_e.at(i).at(j));
6400 0 : oss << "</" << elementName << ">";
6401 0 : return oss.str();
6402 0 : }
6403 :
6404 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<ProcessorSubTypeMod::ProcessorSubType> > >& vvv_e) {
6405 0 : ostringstream oss;
6406 : oss << "<" << elementName << ">"
6407 : << " 3"
6408 0 : << " " <<vvv_e.size()
6409 0 : << " " <<vvv_e.at(0).size()
6410 0 : << " " <<vvv_e.at(0).at(0).size();
6411 :
6412 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
6413 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
6414 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
6415 0 : oss << " " << CProcessorSubType::name(vvv_e.at(i).at(j).at(k));
6416 0 : oss << "</" << elementName << ">";
6417 0 : return oss.str();
6418 0 : }
6419 :
6420 151 : ProcessorSubTypeMod::ProcessorSubType EnumerationParser::getProcessorSubType(const string &name, const string &tableName, const string &xmlDoc) {
6421 151 : string s = getField(xmlDoc,name);
6422 151 : if (s.length() == 0)
6423 0 : throw ConversionException("Error: Missing field \"" +
6424 0 : name + "\" or invalid syntax",tableName);
6425 :
6426 : ProcessorSubType result;
6427 : try {
6428 151 : result = CProcessorSubType::newProcessorSubType(s);
6429 : }
6430 0 : catch (...) {
6431 0 : throw ConversionException("Error: could not convert '"+s+"' into a ProcessorSubType.", tableName);
6432 0 : }
6433 151 : return result;
6434 151 : }
6435 :
6436 0 : vector<ProcessorSubTypeMod::ProcessorSubType> EnumerationParser::getProcessorSubType1D(const string &name, const string &tableName, const string &xmlDoc) {
6437 0 : vector<ProcessorSubTypeMod::ProcessorSubType> result;
6438 :
6439 0 : string s = getField(xmlDoc,name);
6440 0 : if (s.length() == 0)
6441 0 : throw ConversionException("Error: Missing field \"" +
6442 0 : name + "\" or invalid syntax",tableName);
6443 :
6444 0 : istringstream iss;
6445 0 : iss.str(s);
6446 0 : vector<string> tokens;
6447 :
6448 : // Tokenize.
6449 0 : string buf;
6450 0 : while (iss >> buf) {
6451 0 : tokens.push_back(buf);
6452 : }
6453 :
6454 : // The length must be 2 at the minimum (there may be an empty array)
6455 0 : if (tokens.size() < 2)
6456 0 : throw ConversionException("Error: missing values in field \"" +
6457 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6458 :
6459 :
6460 :
6461 : // The number of dimension should be 1.
6462 0 : if (tokens.at(0) != "1")
6463 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
6464 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6465 :
6466 : // Then parse the size of the unique dimension
6467 0 : errno = 0;
6468 0 : int size1 = atoi(tokens.at(1).c_str());
6469 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6470 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6471 :
6472 0 : if (size1 < 0)
6473 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
6474 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6475 :
6476 0 : if (tokens.size() != (unsigned int) (size1 + 2))
6477 0 : throw ConversionException("Error: incorrect number of values in field \"" +
6478 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6479 :
6480 0 : int k = 2;
6481 : try {
6482 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
6483 0 : result.push_back(CProcessorSubType::newProcessorSubType(tokens.at(k).c_str()));
6484 0 : k++;
6485 : }
6486 : }
6487 0 : catch (...) {
6488 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ProcessorSubType.", tableName);
6489 0 : }
6490 :
6491 0 : return result;
6492 0 : }
6493 :
6494 0 : vector<vector<ProcessorSubTypeMod::ProcessorSubType> > EnumerationParser::getProcessorSubType2D(const string &name, const string &tableName, const string &xmlDoc) {
6495 0 : vector<vector<ProcessorSubTypeMod::ProcessorSubType> > result;
6496 :
6497 0 : string s = getField(xmlDoc,name);
6498 0 : if (s.length() == 0)
6499 0 : throw ConversionException("Error: Missing field \"" +
6500 0 : name + "\" or invalid syntax",tableName);
6501 :
6502 0 : istringstream iss;
6503 0 : iss.str(s);
6504 0 : vector<string> tokens;
6505 :
6506 : // Tokenize.
6507 0 : string buf;
6508 0 : while (iss >> buf) {
6509 0 : tokens.push_back(buf);
6510 : }
6511 :
6512 : // The length must be 3 at the minimum (there may be an empty array)
6513 0 : if (tokens.size() < 3)
6514 0 : throw ConversionException("Error: missing values in field \"" +
6515 0 : name + "\" or invalid syntax(" + s +"')",tableName);
6516 :
6517 :
6518 : // The number of dimension should be 2.
6519 0 : if (tokens.at(0) != "2")
6520 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
6521 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6522 :
6523 : // Then parse the size of the two dimensions
6524 0 : errno = 0;
6525 0 : int size1 = atoi(tokens.at(1).c_str());
6526 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6527 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6528 :
6529 0 : if (size1 <= 0)
6530 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
6531 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6532 0 : errno = 0;
6533 0 : int size2 = atoi(tokens.at(2).c_str());
6534 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6535 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6536 :
6537 0 : if (size2 < 0)
6538 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
6539 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6540 :
6541 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
6542 0 : throw ConversionException("Error: incorrect number of values in field \"" +
6543 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6544 :
6545 0 : int k = 3;
6546 : try {
6547 0 : vector<ProcessorSubTypeMod::ProcessorSubType> v_aux;
6548 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
6549 0 : v_aux.clear();
6550 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
6551 0 : v_aux.push_back(CProcessorSubType::newProcessorSubType(tokens.at(k).c_str()));
6552 0 : k++;
6553 : }
6554 0 : result.push_back(v_aux);
6555 : }
6556 0 : }
6557 0 : catch (...) {
6558 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ProcessorSubType.", tableName);
6559 0 : }
6560 0 : return result;
6561 0 : }
6562 :
6563 :
6564 0 : vector<vector<vector<ProcessorSubTypeMod::ProcessorSubType> > > EnumerationParser::getProcessorSubType3D(const string &name, const string &tableName, const string &xmlDoc) {
6565 0 : vector<vector<vector<ProcessorSubTypeMod::ProcessorSubType> > >result;
6566 :
6567 0 : string s = getField(xmlDoc,name);
6568 0 : if (s.length() == 0)
6569 0 : throw ConversionException("Error: Missing field \"" +
6570 0 : name + "\" or invalid syntax",tableName);
6571 :
6572 0 : istringstream iss;
6573 0 : iss.str(s);
6574 0 : vector<string> tokens;
6575 :
6576 : // Tokenize.
6577 0 : string buf;
6578 0 : while (iss >> buf) {
6579 0 : tokens.push_back(buf);
6580 : }
6581 :
6582 : // The length must be 4 at the minimum (there may be an empty array)
6583 0 : if (tokens.size() < 4)
6584 0 : throw ConversionException("Error: missing values in field \"" +
6585 0 : name + "\" or invalid syntax(" + s +"')",tableName);
6586 :
6587 :
6588 : // The number of dimension should be 3.
6589 0 : if (tokens.at(0) != "3")
6590 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
6591 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6592 :
6593 : // Then parse the size of the three dimensions
6594 0 : errno = 0;
6595 0 : int size1 = atoi(tokens.at(1).c_str());
6596 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6597 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6598 :
6599 0 : if (size1 <= 0)
6600 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
6601 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6602 :
6603 0 : errno = 0;
6604 0 : int size2 = atoi(tokens.at(2).c_str());
6605 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6606 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6607 :
6608 0 : if (size2 <= 0)
6609 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
6610 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6611 :
6612 0 : errno = 0;
6613 0 : int size3 = atoi(tokens.at(3).c_str());
6614 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6615 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6616 :
6617 :
6618 0 : if (size3 < 0)
6619 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
6620 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6621 :
6622 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
6623 0 : throw ConversionException("Error: incorrect number of values in field \"" +
6624 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6625 :
6626 0 : int k = 4;
6627 : try {
6628 0 : vector<ProcessorSubTypeMod::ProcessorSubType> v_aux;
6629 0 : vector<vector<ProcessorSubTypeMod::ProcessorSubType> > vv_aux;
6630 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
6631 0 : vv_aux.clear();
6632 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
6633 0 : v_aux.clear();
6634 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
6635 0 : v_aux.push_back(CProcessorSubType::newProcessorSubType(tokens.at(k).c_str()));
6636 0 : k++;
6637 : }
6638 0 : vv_aux.push_back(v_aux);
6639 : }
6640 0 : result.push_back(vv_aux);
6641 : }
6642 0 : }
6643 0 : catch (...) {
6644 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a ProcessorSubType.", tableName);
6645 0 : }
6646 :
6647 0 : return result;
6648 0 : }
6649 :
6650 :
6651 :
6652 :
6653 :
6654 13 : string EnumerationParser::toXML(const string& elementName, AccumModeMod::AccumMode e) {
6655 26 : return "<"+elementName+">"+CAccumMode::name(e)+"</"+elementName+">";
6656 : }
6657 :
6658 0 : string EnumerationParser::toXML(const string& elementName, const vector<AccumModeMod::AccumMode>& v_e) {
6659 0 : ostringstream oss;
6660 : oss << "<" << elementName << ">"
6661 : << " 1"
6662 0 : << " " << v_e.size();
6663 :
6664 0 : for (unsigned int i = 0; i < v_e.size(); i++)
6665 0 : oss << " " << CAccumMode::name(v_e.at(i));
6666 0 : oss << "</" << elementName << ">";
6667 0 : return oss.str();
6668 0 : }
6669 :
6670 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<AccumModeMod::AccumMode> >& vv_e) {
6671 0 : ostringstream oss;
6672 : oss << "<" << elementName << ">"
6673 : << " 2"
6674 0 : << " " <<vv_e.size()
6675 0 : << " " <<vv_e.at(0).size();
6676 :
6677 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
6678 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
6679 0 : oss << " " << CAccumMode::name(vv_e.at(i).at(j));
6680 0 : oss << "</" << elementName << ">";
6681 0 : return oss.str();
6682 0 : }
6683 :
6684 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<AccumModeMod::AccumMode> > >& vvv_e) {
6685 0 : ostringstream oss;
6686 : oss << "<" << elementName << ">"
6687 : << " 3"
6688 0 : << " " <<vvv_e.size()
6689 0 : << " " <<vvv_e.at(0).size()
6690 0 : << " " <<vvv_e.at(0).at(0).size();
6691 :
6692 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
6693 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
6694 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
6695 0 : oss << " " << CAccumMode::name(vvv_e.at(i).at(j).at(k));
6696 0 : oss << "</" << elementName << ">";
6697 0 : return oss.str();
6698 0 : }
6699 :
6700 104 : AccumModeMod::AccumMode EnumerationParser::getAccumMode(const string &name, const string &tableName, const string &xmlDoc) {
6701 104 : string s = getField(xmlDoc,name);
6702 104 : if (s.length() == 0)
6703 0 : throw ConversionException("Error: Missing field \"" +
6704 0 : name + "\" or invalid syntax",tableName);
6705 :
6706 : AccumMode result;
6707 : try {
6708 104 : result = CAccumMode::newAccumMode(s);
6709 : }
6710 0 : catch (...) {
6711 0 : throw ConversionException("Error: could not convert '"+s+"' into a AccumMode.", tableName);
6712 0 : }
6713 104 : return result;
6714 104 : }
6715 :
6716 0 : vector<AccumModeMod::AccumMode> EnumerationParser::getAccumMode1D(const string &name, const string &tableName, const string &xmlDoc) {
6717 0 : vector<AccumModeMod::AccumMode> result;
6718 :
6719 0 : string s = getField(xmlDoc,name);
6720 0 : if (s.length() == 0)
6721 0 : throw ConversionException("Error: Missing field \"" +
6722 0 : name + "\" or invalid syntax",tableName);
6723 :
6724 0 : istringstream iss;
6725 0 : iss.str(s);
6726 0 : vector<string> tokens;
6727 :
6728 : // Tokenize.
6729 0 : string buf;
6730 0 : while (iss >> buf) {
6731 0 : tokens.push_back(buf);
6732 : }
6733 :
6734 : // The length must be 2 at the minimum (there may be an empty array)
6735 0 : if (tokens.size() < 2)
6736 0 : throw ConversionException("Error: missing values in field \"" +
6737 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6738 :
6739 :
6740 :
6741 : // The number of dimension should be 1.
6742 0 : if (tokens.at(0) != "1")
6743 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
6744 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6745 :
6746 : // Then parse the size of the unique dimension
6747 0 : errno = 0;
6748 0 : int size1 = atoi(tokens.at(1).c_str());
6749 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6750 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6751 :
6752 0 : if (size1 < 0)
6753 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
6754 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6755 :
6756 0 : if (tokens.size() != (unsigned int) (size1 + 2))
6757 0 : throw ConversionException("Error: incorrect number of values in field \"" +
6758 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6759 :
6760 0 : int k = 2;
6761 : try {
6762 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
6763 0 : result.push_back(CAccumMode::newAccumMode(tokens.at(k).c_str()));
6764 0 : k++;
6765 : }
6766 : }
6767 0 : catch (...) {
6768 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AccumMode.", tableName);
6769 0 : }
6770 :
6771 0 : return result;
6772 0 : }
6773 :
6774 0 : vector<vector<AccumModeMod::AccumMode> > EnumerationParser::getAccumMode2D(const string &name, const string &tableName, const string &xmlDoc) {
6775 0 : vector<vector<AccumModeMod::AccumMode> > result;
6776 :
6777 0 : string s = getField(xmlDoc,name);
6778 0 : if (s.length() == 0)
6779 0 : throw ConversionException("Error: Missing field \"" +
6780 0 : name + "\" or invalid syntax",tableName);
6781 :
6782 0 : istringstream iss;
6783 0 : iss.str(s);
6784 0 : vector<string> tokens;
6785 :
6786 : // Tokenize.
6787 0 : string buf;
6788 0 : while (iss >> buf) {
6789 0 : tokens.push_back(buf);
6790 : }
6791 :
6792 : // The length must be 3 at the minimum (there may be an empty array)
6793 0 : if (tokens.size() < 3)
6794 0 : throw ConversionException("Error: missing values in field \"" +
6795 0 : name + "\" or invalid syntax(" + s +"')",tableName);
6796 :
6797 :
6798 : // The number of dimension should be 2.
6799 0 : if (tokens.at(0) != "2")
6800 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
6801 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6802 :
6803 : // Then parse the size of the two dimensions
6804 0 : errno = 0;
6805 0 : int size1 = atoi(tokens.at(1).c_str());
6806 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6807 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6808 :
6809 0 : if (size1 <= 0)
6810 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
6811 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6812 0 : errno = 0;
6813 0 : int size2 = atoi(tokens.at(2).c_str());
6814 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6815 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6816 :
6817 0 : if (size2 < 0)
6818 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
6819 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6820 :
6821 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
6822 0 : throw ConversionException("Error: incorrect number of values in field \"" +
6823 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6824 :
6825 0 : int k = 3;
6826 : try {
6827 0 : vector<AccumModeMod::AccumMode> v_aux;
6828 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
6829 0 : v_aux.clear();
6830 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
6831 0 : v_aux.push_back(CAccumMode::newAccumMode(tokens.at(k).c_str()));
6832 0 : k++;
6833 : }
6834 0 : result.push_back(v_aux);
6835 : }
6836 0 : }
6837 0 : catch (...) {
6838 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AccumMode.", tableName);
6839 0 : }
6840 0 : return result;
6841 0 : }
6842 :
6843 :
6844 0 : vector<vector<vector<AccumModeMod::AccumMode> > > EnumerationParser::getAccumMode3D(const string &name, const string &tableName, const string &xmlDoc) {
6845 0 : vector<vector<vector<AccumModeMod::AccumMode> > >result;
6846 :
6847 0 : string s = getField(xmlDoc,name);
6848 0 : if (s.length() == 0)
6849 0 : throw ConversionException("Error: Missing field \"" +
6850 0 : name + "\" or invalid syntax",tableName);
6851 :
6852 0 : istringstream iss;
6853 0 : iss.str(s);
6854 0 : vector<string> tokens;
6855 :
6856 : // Tokenize.
6857 0 : string buf;
6858 0 : while (iss >> buf) {
6859 0 : tokens.push_back(buf);
6860 : }
6861 :
6862 : // The length must be 4 at the minimum (there may be an empty array)
6863 0 : if (tokens.size() < 4)
6864 0 : throw ConversionException("Error: missing values in field \"" +
6865 0 : name + "\" or invalid syntax(" + s +"')",tableName);
6866 :
6867 :
6868 : // The number of dimension should be 3.
6869 0 : if (tokens.at(0) != "3")
6870 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
6871 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6872 :
6873 : // Then parse the size of the three dimensions
6874 0 : errno = 0;
6875 0 : int size1 = atoi(tokens.at(1).c_str());
6876 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6877 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6878 :
6879 0 : if (size1 <= 0)
6880 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
6881 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6882 :
6883 0 : errno = 0;
6884 0 : int size2 = atoi(tokens.at(2).c_str());
6885 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6886 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6887 :
6888 0 : if (size2 <= 0)
6889 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
6890 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6891 :
6892 0 : errno = 0;
6893 0 : int size3 = atoi(tokens.at(3).c_str());
6894 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
6895 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
6896 :
6897 :
6898 0 : if (size3 < 0)
6899 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
6900 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6901 :
6902 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
6903 0 : throw ConversionException("Error: incorrect number of values in field \"" +
6904 0 : name + "\" or invalid syntax('" + s +"')",tableName);
6905 :
6906 0 : int k = 4;
6907 : try {
6908 0 : vector<AccumModeMod::AccumMode> v_aux;
6909 0 : vector<vector<AccumModeMod::AccumMode> > vv_aux;
6910 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
6911 0 : vv_aux.clear();
6912 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
6913 0 : v_aux.clear();
6914 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
6915 0 : v_aux.push_back(CAccumMode::newAccumMode(tokens.at(k).c_str()));
6916 0 : k++;
6917 : }
6918 0 : vv_aux.push_back(v_aux);
6919 : }
6920 0 : result.push_back(vv_aux);
6921 : }
6922 0 : }
6923 0 : catch (...) {
6924 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a AccumMode.", tableName);
6925 0 : }
6926 :
6927 0 : return result;
6928 0 : }
6929 :
6930 :
6931 :
6932 :
6933 :
6934 0 : string EnumerationParser::toXML(const string& elementName, AxisNameMod::AxisName e) {
6935 0 : return "<"+elementName+">"+CAxisName::name(e)+"</"+elementName+">";
6936 : }
6937 :
6938 13 : string EnumerationParser::toXML(const string& elementName, const vector<AxisNameMod::AxisName>& v_e) {
6939 13 : ostringstream oss;
6940 : oss << "<" << elementName << ">"
6941 : << " 1"
6942 13 : << " " << v_e.size();
6943 :
6944 65 : for (unsigned int i = 0; i < v_e.size(); i++)
6945 52 : oss << " " << CAxisName::name(v_e.at(i));
6946 13 : oss << "</" << elementName << ">";
6947 26 : return oss.str();
6948 13 : }
6949 :
6950 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<AxisNameMod::AxisName> >& vv_e) {
6951 0 : ostringstream oss;
6952 : oss << "<" << elementName << ">"
6953 : << " 2"
6954 0 : << " " <<vv_e.size()
6955 0 : << " " <<vv_e.at(0).size();
6956 :
6957 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
6958 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
6959 0 : oss << " " << CAxisName::name(vv_e.at(i).at(j));
6960 0 : oss << "</" << elementName << ">";
6961 0 : return oss.str();
6962 0 : }
6963 :
6964 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<AxisNameMod::AxisName> > >& vvv_e) {
6965 0 : ostringstream oss;
6966 : oss << "<" << elementName << ">"
6967 : << " 3"
6968 0 : << " " <<vvv_e.size()
6969 0 : << " " <<vvv_e.at(0).size()
6970 0 : << " " <<vvv_e.at(0).at(0).size();
6971 :
6972 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
6973 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
6974 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
6975 0 : oss << " " << CAxisName::name(vvv_e.at(i).at(j).at(k));
6976 0 : oss << "</" << elementName << ">";
6977 0 : return oss.str();
6978 0 : }
6979 :
6980 0 : AxisNameMod::AxisName EnumerationParser::getAxisName(const string &name, const string &tableName, const string &xmlDoc) {
6981 0 : string s = getField(xmlDoc,name);
6982 0 : if (s.length() == 0)
6983 0 : throw ConversionException("Error: Missing field \"" +
6984 0 : name + "\" or invalid syntax",tableName);
6985 :
6986 : AxisName result;
6987 : try {
6988 0 : result = CAxisName::newAxisName(s);
6989 : }
6990 0 : catch (...) {
6991 0 : throw ConversionException("Error: could not convert '"+s+"' into a AxisName.", tableName);
6992 0 : }
6993 0 : return result;
6994 0 : }
6995 :
6996 104 : vector<AxisNameMod::AxisName> EnumerationParser::getAxisName1D(const string &name, const string &tableName, const string &xmlDoc) {
6997 104 : vector<AxisNameMod::AxisName> result;
6998 :
6999 104 : string s = getField(xmlDoc,name);
7000 104 : if (s.length() == 0)
7001 0 : throw ConversionException("Error: Missing field \"" +
7002 0 : name + "\" or invalid syntax",tableName);
7003 :
7004 104 : istringstream iss;
7005 104 : iss.str(s);
7006 104 : vector<string> tokens;
7007 :
7008 : // Tokenize.
7009 104 : string buf;
7010 1242 : while (iss >> buf) {
7011 1138 : tokens.push_back(buf);
7012 : }
7013 :
7014 : // The length must be 2 at the minimum (there may be an empty array)
7015 104 : if (tokens.size() < 2)
7016 0 : throw ConversionException("Error: missing values in field \"" +
7017 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7018 :
7019 :
7020 :
7021 : // The number of dimension should be 1.
7022 104 : if (tokens.at(0) != "1")
7023 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7024 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7025 :
7026 : // Then parse the size of the unique dimension
7027 104 : errno = 0;
7028 104 : int size1 = atoi(tokens.at(1).c_str());
7029 104 : if (errno != 0) throw ConversionException("Error: Field \"" +
7030 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7031 :
7032 104 : if (size1 < 0)
7033 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
7034 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7035 :
7036 104 : if (tokens.size() != (unsigned int) (size1 + 2))
7037 0 : throw ConversionException("Error: incorrect number of values in field \"" +
7038 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7039 :
7040 104 : int k = 2;
7041 : try {
7042 1034 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
7043 930 : result.push_back(CAxisName::newAxisName(tokens.at(k).c_str()));
7044 930 : k++;
7045 : }
7046 : }
7047 0 : catch (...) {
7048 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AxisName.", tableName);
7049 0 : }
7050 :
7051 208 : return result;
7052 104 : }
7053 :
7054 0 : vector<vector<AxisNameMod::AxisName> > EnumerationParser::getAxisName2D(const string &name, const string &tableName, const string &xmlDoc) {
7055 0 : vector<vector<AxisNameMod::AxisName> > result;
7056 :
7057 0 : string s = getField(xmlDoc,name);
7058 0 : if (s.length() == 0)
7059 0 : throw ConversionException("Error: Missing field \"" +
7060 0 : name + "\" or invalid syntax",tableName);
7061 :
7062 0 : istringstream iss;
7063 0 : iss.str(s);
7064 0 : vector<string> tokens;
7065 :
7066 : // Tokenize.
7067 0 : string buf;
7068 0 : while (iss >> buf) {
7069 0 : tokens.push_back(buf);
7070 : }
7071 :
7072 : // The length must be 3 at the minimum (there may be an empty array)
7073 0 : if (tokens.size() < 3)
7074 0 : throw ConversionException("Error: missing values in field \"" +
7075 0 : name + "\" or invalid syntax(" + s +"')",tableName);
7076 :
7077 :
7078 : // The number of dimension should be 2.
7079 0 : if (tokens.at(0) != "2")
7080 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7081 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7082 :
7083 : // Then parse the size of the two dimensions
7084 0 : errno = 0;
7085 0 : int size1 = atoi(tokens.at(1).c_str());
7086 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7087 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7088 :
7089 0 : if (size1 <= 0)
7090 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
7091 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7092 0 : errno = 0;
7093 0 : int size2 = atoi(tokens.at(2).c_str());
7094 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7095 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7096 :
7097 0 : if (size2 < 0)
7098 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
7099 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7100 :
7101 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
7102 0 : throw ConversionException("Error: incorrect number of values in field \"" +
7103 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7104 :
7105 0 : int k = 3;
7106 : try {
7107 0 : vector<AxisNameMod::AxisName> v_aux;
7108 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
7109 0 : v_aux.clear();
7110 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
7111 0 : v_aux.push_back(CAxisName::newAxisName(tokens.at(k).c_str()));
7112 0 : k++;
7113 : }
7114 0 : result.push_back(v_aux);
7115 : }
7116 0 : }
7117 0 : catch (...) {
7118 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AxisName.", tableName);
7119 0 : }
7120 0 : return result;
7121 0 : }
7122 :
7123 :
7124 0 : vector<vector<vector<AxisNameMod::AxisName> > > EnumerationParser::getAxisName3D(const string &name, const string &tableName, const string &xmlDoc) {
7125 0 : vector<vector<vector<AxisNameMod::AxisName> > >result;
7126 :
7127 0 : string s = getField(xmlDoc,name);
7128 0 : if (s.length() == 0)
7129 0 : throw ConversionException("Error: Missing field \"" +
7130 0 : name + "\" or invalid syntax",tableName);
7131 :
7132 0 : istringstream iss;
7133 0 : iss.str(s);
7134 0 : vector<string> tokens;
7135 :
7136 : // Tokenize.
7137 0 : string buf;
7138 0 : while (iss >> buf) {
7139 0 : tokens.push_back(buf);
7140 : }
7141 :
7142 : // The length must be 4 at the minimum (there may be an empty array)
7143 0 : if (tokens.size() < 4)
7144 0 : throw ConversionException("Error: missing values in field \"" +
7145 0 : name + "\" or invalid syntax(" + s +"')",tableName);
7146 :
7147 :
7148 : // The number of dimension should be 3.
7149 0 : if (tokens.at(0) != "3")
7150 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7151 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7152 :
7153 : // Then parse the size of the three dimensions
7154 0 : errno = 0;
7155 0 : int size1 = atoi(tokens.at(1).c_str());
7156 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7157 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7158 :
7159 0 : if (size1 <= 0)
7160 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
7161 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7162 :
7163 0 : errno = 0;
7164 0 : int size2 = atoi(tokens.at(2).c_str());
7165 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7166 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7167 :
7168 0 : if (size2 <= 0)
7169 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
7170 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7171 :
7172 0 : errno = 0;
7173 0 : int size3 = atoi(tokens.at(3).c_str());
7174 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7175 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7176 :
7177 :
7178 0 : if (size3 < 0)
7179 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
7180 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7181 :
7182 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
7183 0 : throw ConversionException("Error: incorrect number of values in field \"" +
7184 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7185 :
7186 0 : int k = 4;
7187 : try {
7188 0 : vector<AxisNameMod::AxisName> v_aux;
7189 0 : vector<vector<AxisNameMod::AxisName> > vv_aux;
7190 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
7191 0 : vv_aux.clear();
7192 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
7193 0 : v_aux.clear();
7194 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
7195 0 : v_aux.push_back(CAxisName::newAxisName(tokens.at(k).c_str()));
7196 0 : k++;
7197 : }
7198 0 : vv_aux.push_back(v_aux);
7199 : }
7200 0 : result.push_back(vv_aux);
7201 : }
7202 0 : }
7203 0 : catch (...) {
7204 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a AxisName.", tableName);
7205 0 : }
7206 :
7207 0 : return result;
7208 0 : }
7209 :
7210 :
7211 :
7212 :
7213 :
7214 0 : string EnumerationParser::toXML(const string& elementName, FilterModeMod::FilterMode e) {
7215 0 : return "<"+elementName+">"+CFilterMode::name(e)+"</"+elementName+">";
7216 : }
7217 :
7218 13 : string EnumerationParser::toXML(const string& elementName, const vector<FilterModeMod::FilterMode>& v_e) {
7219 13 : ostringstream oss;
7220 : oss << "<" << elementName << ">"
7221 : << " 1"
7222 13 : << " " << v_e.size();
7223 :
7224 26 : for (unsigned int i = 0; i < v_e.size(); i++)
7225 13 : oss << " " << CFilterMode::name(v_e.at(i));
7226 13 : oss << "</" << elementName << ">";
7227 26 : return oss.str();
7228 13 : }
7229 :
7230 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<FilterModeMod::FilterMode> >& vv_e) {
7231 0 : ostringstream oss;
7232 : oss << "<" << elementName << ">"
7233 : << " 2"
7234 0 : << " " <<vv_e.size()
7235 0 : << " " <<vv_e.at(0).size();
7236 :
7237 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
7238 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
7239 0 : oss << " " << CFilterMode::name(vv_e.at(i).at(j));
7240 0 : oss << "</" << elementName << ">";
7241 0 : return oss.str();
7242 0 : }
7243 :
7244 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<FilterModeMod::FilterMode> > >& vvv_e) {
7245 0 : ostringstream oss;
7246 : oss << "<" << elementName << ">"
7247 : << " 3"
7248 0 : << " " <<vvv_e.size()
7249 0 : << " " <<vvv_e.at(0).size()
7250 0 : << " " <<vvv_e.at(0).at(0).size();
7251 :
7252 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
7253 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
7254 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
7255 0 : oss << " " << CFilterMode::name(vvv_e.at(i).at(j).at(k));
7256 0 : oss << "</" << elementName << ">";
7257 0 : return oss.str();
7258 0 : }
7259 :
7260 0 : FilterModeMod::FilterMode EnumerationParser::getFilterMode(const string &name, const string &tableName, const string &xmlDoc) {
7261 0 : string s = getField(xmlDoc,name);
7262 0 : if (s.length() == 0)
7263 0 : throw ConversionException("Error: Missing field \"" +
7264 0 : name + "\" or invalid syntax",tableName);
7265 :
7266 : FilterMode result;
7267 : try {
7268 0 : result = CFilterMode::newFilterMode(s);
7269 : }
7270 0 : catch (...) {
7271 0 : throw ConversionException("Error: could not convert '"+s+"' into a FilterMode.", tableName);
7272 0 : }
7273 0 : return result;
7274 0 : }
7275 :
7276 104 : vector<FilterModeMod::FilterMode> EnumerationParser::getFilterMode1D(const string &name, const string &tableName, const string &xmlDoc) {
7277 104 : vector<FilterModeMod::FilterMode> result;
7278 :
7279 104 : string s = getField(xmlDoc,name);
7280 104 : if (s.length() == 0)
7281 0 : throw ConversionException("Error: Missing field \"" +
7282 0 : name + "\" or invalid syntax",tableName);
7283 :
7284 104 : istringstream iss;
7285 104 : iss.str(s);
7286 104 : vector<string> tokens;
7287 :
7288 : // Tokenize.
7289 104 : string buf;
7290 661 : while (iss >> buf) {
7291 557 : tokens.push_back(buf);
7292 : }
7293 :
7294 : // The length must be 2 at the minimum (there may be an empty array)
7295 104 : if (tokens.size() < 2)
7296 0 : throw ConversionException("Error: missing values in field \"" +
7297 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7298 :
7299 :
7300 :
7301 : // The number of dimension should be 1.
7302 104 : if (tokens.at(0) != "1")
7303 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7304 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7305 :
7306 : // Then parse the size of the unique dimension
7307 104 : errno = 0;
7308 104 : int size1 = atoi(tokens.at(1).c_str());
7309 104 : if (errno != 0) throw ConversionException("Error: Field \"" +
7310 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7311 :
7312 104 : if (size1 < 0)
7313 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
7314 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7315 :
7316 104 : if (tokens.size() != (unsigned int) (size1 + 2))
7317 0 : throw ConversionException("Error: incorrect number of values in field \"" +
7318 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7319 :
7320 104 : int k = 2;
7321 : try {
7322 453 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
7323 349 : result.push_back(CFilterMode::newFilterMode(tokens.at(k).c_str()));
7324 349 : k++;
7325 : }
7326 : }
7327 0 : catch (...) {
7328 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a FilterMode.", tableName);
7329 0 : }
7330 :
7331 208 : return result;
7332 104 : }
7333 :
7334 0 : vector<vector<FilterModeMod::FilterMode> > EnumerationParser::getFilterMode2D(const string &name, const string &tableName, const string &xmlDoc) {
7335 0 : vector<vector<FilterModeMod::FilterMode> > result;
7336 :
7337 0 : string s = getField(xmlDoc,name);
7338 0 : if (s.length() == 0)
7339 0 : throw ConversionException("Error: Missing field \"" +
7340 0 : name + "\" or invalid syntax",tableName);
7341 :
7342 0 : istringstream iss;
7343 0 : iss.str(s);
7344 0 : vector<string> tokens;
7345 :
7346 : // Tokenize.
7347 0 : string buf;
7348 0 : while (iss >> buf) {
7349 0 : tokens.push_back(buf);
7350 : }
7351 :
7352 : // The length must be 3 at the minimum (there may be an empty array)
7353 0 : if (tokens.size() < 3)
7354 0 : throw ConversionException("Error: missing values in field \"" +
7355 0 : name + "\" or invalid syntax(" + s +"')",tableName);
7356 :
7357 :
7358 : // The number of dimension should be 2.
7359 0 : if (tokens.at(0) != "2")
7360 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7361 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7362 :
7363 : // Then parse the size of the two dimensions
7364 0 : errno = 0;
7365 0 : int size1 = atoi(tokens.at(1).c_str());
7366 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7367 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7368 :
7369 0 : if (size1 <= 0)
7370 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
7371 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7372 0 : errno = 0;
7373 0 : int size2 = atoi(tokens.at(2).c_str());
7374 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7375 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7376 :
7377 0 : if (size2 < 0)
7378 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
7379 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7380 :
7381 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
7382 0 : throw ConversionException("Error: incorrect number of values in field \"" +
7383 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7384 :
7385 0 : int k = 3;
7386 : try {
7387 0 : vector<FilterModeMod::FilterMode> v_aux;
7388 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
7389 0 : v_aux.clear();
7390 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
7391 0 : v_aux.push_back(CFilterMode::newFilterMode(tokens.at(k).c_str()));
7392 0 : k++;
7393 : }
7394 0 : result.push_back(v_aux);
7395 : }
7396 0 : }
7397 0 : catch (...) {
7398 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a FilterMode.", tableName);
7399 0 : }
7400 0 : return result;
7401 0 : }
7402 :
7403 :
7404 0 : vector<vector<vector<FilterModeMod::FilterMode> > > EnumerationParser::getFilterMode3D(const string &name, const string &tableName, const string &xmlDoc) {
7405 0 : vector<vector<vector<FilterModeMod::FilterMode> > >result;
7406 :
7407 0 : string s = getField(xmlDoc,name);
7408 0 : if (s.length() == 0)
7409 0 : throw ConversionException("Error: Missing field \"" +
7410 0 : name + "\" or invalid syntax",tableName);
7411 :
7412 0 : istringstream iss;
7413 0 : iss.str(s);
7414 0 : vector<string> tokens;
7415 :
7416 : // Tokenize.
7417 0 : string buf;
7418 0 : while (iss >> buf) {
7419 0 : tokens.push_back(buf);
7420 : }
7421 :
7422 : // The length must be 4 at the minimum (there may be an empty array)
7423 0 : if (tokens.size() < 4)
7424 0 : throw ConversionException("Error: missing values in field \"" +
7425 0 : name + "\" or invalid syntax(" + s +"')",tableName);
7426 :
7427 :
7428 : // The number of dimension should be 3.
7429 0 : if (tokens.at(0) != "3")
7430 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7431 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7432 :
7433 : // Then parse the size of the three dimensions
7434 0 : errno = 0;
7435 0 : int size1 = atoi(tokens.at(1).c_str());
7436 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7437 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7438 :
7439 0 : if (size1 <= 0)
7440 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
7441 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7442 :
7443 0 : errno = 0;
7444 0 : int size2 = atoi(tokens.at(2).c_str());
7445 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7446 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7447 :
7448 0 : if (size2 <= 0)
7449 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
7450 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7451 :
7452 0 : errno = 0;
7453 0 : int size3 = atoi(tokens.at(3).c_str());
7454 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7455 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7456 :
7457 :
7458 0 : if (size3 < 0)
7459 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
7460 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7461 :
7462 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
7463 0 : throw ConversionException("Error: incorrect number of values in field \"" +
7464 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7465 :
7466 0 : int k = 4;
7467 : try {
7468 0 : vector<FilterModeMod::FilterMode> v_aux;
7469 0 : vector<vector<FilterModeMod::FilterMode> > vv_aux;
7470 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
7471 0 : vv_aux.clear();
7472 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
7473 0 : v_aux.clear();
7474 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
7475 0 : v_aux.push_back(CFilterMode::newFilterMode(tokens.at(k).c_str()));
7476 0 : k++;
7477 : }
7478 0 : vv_aux.push_back(v_aux);
7479 : }
7480 0 : result.push_back(vv_aux);
7481 : }
7482 0 : }
7483 0 : catch (...) {
7484 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a FilterMode.", tableName);
7485 0 : }
7486 :
7487 0 : return result;
7488 0 : }
7489 :
7490 :
7491 :
7492 :
7493 :
7494 13 : string EnumerationParser::toXML(const string& elementName, CorrelatorNameMod::CorrelatorName e) {
7495 26 : return "<"+elementName+">"+CCorrelatorName::name(e)+"</"+elementName+">";
7496 : }
7497 :
7498 0 : string EnumerationParser::toXML(const string& elementName, const vector<CorrelatorNameMod::CorrelatorName>& v_e) {
7499 0 : ostringstream oss;
7500 : oss << "<" << elementName << ">"
7501 : << " 1"
7502 0 : << " " << v_e.size();
7503 :
7504 0 : for (unsigned int i = 0; i < v_e.size(); i++)
7505 0 : oss << " " << CCorrelatorName::name(v_e.at(i));
7506 0 : oss << "</" << elementName << ">";
7507 0 : return oss.str();
7508 0 : }
7509 :
7510 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CorrelatorNameMod::CorrelatorName> >& vv_e) {
7511 0 : ostringstream oss;
7512 : oss << "<" << elementName << ">"
7513 : << " 2"
7514 0 : << " " <<vv_e.size()
7515 0 : << " " <<vv_e.at(0).size();
7516 :
7517 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
7518 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
7519 0 : oss << " " << CCorrelatorName::name(vv_e.at(i).at(j));
7520 0 : oss << "</" << elementName << ">";
7521 0 : return oss.str();
7522 0 : }
7523 :
7524 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CorrelatorNameMod::CorrelatorName> > >& vvv_e) {
7525 0 : ostringstream oss;
7526 : oss << "<" << elementName << ">"
7527 : << " 3"
7528 0 : << " " <<vvv_e.size()
7529 0 : << " " <<vvv_e.at(0).size()
7530 0 : << " " <<vvv_e.at(0).at(0).size();
7531 :
7532 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
7533 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
7534 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
7535 0 : oss << " " << CCorrelatorName::name(vvv_e.at(i).at(j).at(k));
7536 0 : oss << "</" << elementName << ">";
7537 0 : return oss.str();
7538 0 : }
7539 :
7540 104 : CorrelatorNameMod::CorrelatorName EnumerationParser::getCorrelatorName(const string &name, const string &tableName, const string &xmlDoc) {
7541 104 : string s = getField(xmlDoc,name);
7542 104 : if (s.length() == 0)
7543 0 : throw ConversionException("Error: Missing field \"" +
7544 0 : name + "\" or invalid syntax",tableName);
7545 :
7546 : CorrelatorName result;
7547 : try {
7548 104 : result = CCorrelatorName::newCorrelatorName(s);
7549 : }
7550 0 : catch (...) {
7551 0 : throw ConversionException("Error: could not convert '"+s+"' into a CorrelatorName.", tableName);
7552 0 : }
7553 104 : return result;
7554 104 : }
7555 :
7556 0 : vector<CorrelatorNameMod::CorrelatorName> EnumerationParser::getCorrelatorName1D(const string &name, const string &tableName, const string &xmlDoc) {
7557 0 : vector<CorrelatorNameMod::CorrelatorName> result;
7558 :
7559 0 : string s = getField(xmlDoc,name);
7560 0 : if (s.length() == 0)
7561 0 : throw ConversionException("Error: Missing field \"" +
7562 0 : name + "\" or invalid syntax",tableName);
7563 :
7564 0 : istringstream iss;
7565 0 : iss.str(s);
7566 0 : vector<string> tokens;
7567 :
7568 : // Tokenize.
7569 0 : string buf;
7570 0 : while (iss >> buf) {
7571 0 : tokens.push_back(buf);
7572 : }
7573 :
7574 : // The length must be 2 at the minimum (there may be an empty array)
7575 0 : if (tokens.size() < 2)
7576 0 : throw ConversionException("Error: missing values in field \"" +
7577 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7578 :
7579 :
7580 :
7581 : // The number of dimension should be 1.
7582 0 : if (tokens.at(0) != "1")
7583 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7584 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7585 :
7586 : // Then parse the size of the unique dimension
7587 0 : errno = 0;
7588 0 : int size1 = atoi(tokens.at(1).c_str());
7589 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7590 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7591 :
7592 0 : if (size1 < 0)
7593 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
7594 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7595 :
7596 0 : if (tokens.size() != (unsigned int) (size1 + 2))
7597 0 : throw ConversionException("Error: incorrect number of values in field \"" +
7598 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7599 :
7600 0 : int k = 2;
7601 : try {
7602 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
7603 0 : result.push_back(CCorrelatorName::newCorrelatorName(tokens.at(k).c_str()));
7604 0 : k++;
7605 : }
7606 : }
7607 0 : catch (...) {
7608 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelatorName.", tableName);
7609 0 : }
7610 :
7611 0 : return result;
7612 0 : }
7613 :
7614 0 : vector<vector<CorrelatorNameMod::CorrelatorName> > EnumerationParser::getCorrelatorName2D(const string &name, const string &tableName, const string &xmlDoc) {
7615 0 : vector<vector<CorrelatorNameMod::CorrelatorName> > result;
7616 :
7617 0 : string s = getField(xmlDoc,name);
7618 0 : if (s.length() == 0)
7619 0 : throw ConversionException("Error: Missing field \"" +
7620 0 : name + "\" or invalid syntax",tableName);
7621 :
7622 0 : istringstream iss;
7623 0 : iss.str(s);
7624 0 : vector<string> tokens;
7625 :
7626 : // Tokenize.
7627 0 : string buf;
7628 0 : while (iss >> buf) {
7629 0 : tokens.push_back(buf);
7630 : }
7631 :
7632 : // The length must be 3 at the minimum (there may be an empty array)
7633 0 : if (tokens.size() < 3)
7634 0 : throw ConversionException("Error: missing values in field \"" +
7635 0 : name + "\" or invalid syntax(" + s +"')",tableName);
7636 :
7637 :
7638 : // The number of dimension should be 2.
7639 0 : if (tokens.at(0) != "2")
7640 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7641 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7642 :
7643 : // Then parse the size of the two dimensions
7644 0 : errno = 0;
7645 0 : int size1 = atoi(tokens.at(1).c_str());
7646 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7647 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7648 :
7649 0 : if (size1 <= 0)
7650 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
7651 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7652 0 : errno = 0;
7653 0 : int size2 = atoi(tokens.at(2).c_str());
7654 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7655 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7656 :
7657 0 : if (size2 < 0)
7658 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
7659 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7660 :
7661 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
7662 0 : throw ConversionException("Error: incorrect number of values in field \"" +
7663 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7664 :
7665 0 : int k = 3;
7666 : try {
7667 0 : vector<CorrelatorNameMod::CorrelatorName> v_aux;
7668 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
7669 0 : v_aux.clear();
7670 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
7671 0 : v_aux.push_back(CCorrelatorName::newCorrelatorName(tokens.at(k).c_str()));
7672 0 : k++;
7673 : }
7674 0 : result.push_back(v_aux);
7675 : }
7676 0 : }
7677 0 : catch (...) {
7678 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelatorName.", tableName);
7679 0 : }
7680 0 : return result;
7681 0 : }
7682 :
7683 :
7684 0 : vector<vector<vector<CorrelatorNameMod::CorrelatorName> > > EnumerationParser::getCorrelatorName3D(const string &name, const string &tableName, const string &xmlDoc) {
7685 0 : vector<vector<vector<CorrelatorNameMod::CorrelatorName> > >result;
7686 :
7687 0 : string s = getField(xmlDoc,name);
7688 0 : if (s.length() == 0)
7689 0 : throw ConversionException("Error: Missing field \"" +
7690 0 : name + "\" or invalid syntax",tableName);
7691 :
7692 0 : istringstream iss;
7693 0 : iss.str(s);
7694 0 : vector<string> tokens;
7695 :
7696 : // Tokenize.
7697 0 : string buf;
7698 0 : while (iss >> buf) {
7699 0 : tokens.push_back(buf);
7700 : }
7701 :
7702 : // The length must be 4 at the minimum (there may be an empty array)
7703 0 : if (tokens.size() < 4)
7704 0 : throw ConversionException("Error: missing values in field \"" +
7705 0 : name + "\" or invalid syntax(" + s +"')",tableName);
7706 :
7707 :
7708 : // The number of dimension should be 3.
7709 0 : if (tokens.at(0) != "3")
7710 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7711 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7712 :
7713 : // Then parse the size of the three dimensions
7714 0 : errno = 0;
7715 0 : int size1 = atoi(tokens.at(1).c_str());
7716 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7717 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7718 :
7719 0 : if (size1 <= 0)
7720 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
7721 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7722 :
7723 0 : errno = 0;
7724 0 : int size2 = atoi(tokens.at(2).c_str());
7725 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7726 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7727 :
7728 0 : if (size2 <= 0)
7729 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
7730 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7731 :
7732 0 : errno = 0;
7733 0 : int size3 = atoi(tokens.at(3).c_str());
7734 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7735 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7736 :
7737 :
7738 0 : if (size3 < 0)
7739 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
7740 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7741 :
7742 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
7743 0 : throw ConversionException("Error: incorrect number of values in field \"" +
7744 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7745 :
7746 0 : int k = 4;
7747 : try {
7748 0 : vector<CorrelatorNameMod::CorrelatorName> v_aux;
7749 0 : vector<vector<CorrelatorNameMod::CorrelatorName> > vv_aux;
7750 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
7751 0 : vv_aux.clear();
7752 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
7753 0 : v_aux.clear();
7754 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
7755 0 : v_aux.push_back(CCorrelatorName::newCorrelatorName(tokens.at(k).c_str()));
7756 0 : k++;
7757 : }
7758 0 : vv_aux.push_back(v_aux);
7759 : }
7760 0 : result.push_back(vv_aux);
7761 : }
7762 0 : }
7763 0 : catch (...) {
7764 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelatorName.", tableName);
7765 0 : }
7766 :
7767 0 : return result;
7768 0 : }
7769 :
7770 :
7771 :
7772 :
7773 :
7774 0 : string EnumerationParser::toXML(const string& elementName, WVRMethodMod::WVRMethod e) {
7775 0 : return "<"+elementName+">"+CWVRMethod::name(e)+"</"+elementName+">";
7776 : }
7777 :
7778 0 : string EnumerationParser::toXML(const string& elementName, const vector<WVRMethodMod::WVRMethod>& v_e) {
7779 0 : ostringstream oss;
7780 : oss << "<" << elementName << ">"
7781 : << " 1"
7782 0 : << " " << v_e.size();
7783 :
7784 0 : for (unsigned int i = 0; i < v_e.size(); i++)
7785 0 : oss << " " << CWVRMethod::name(v_e.at(i));
7786 0 : oss << "</" << elementName << ">";
7787 0 : return oss.str();
7788 0 : }
7789 :
7790 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<WVRMethodMod::WVRMethod> >& vv_e) {
7791 0 : ostringstream oss;
7792 : oss << "<" << elementName << ">"
7793 : << " 2"
7794 0 : << " " <<vv_e.size()
7795 0 : << " " <<vv_e.at(0).size();
7796 :
7797 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
7798 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
7799 0 : oss << " " << CWVRMethod::name(vv_e.at(i).at(j));
7800 0 : oss << "</" << elementName << ">";
7801 0 : return oss.str();
7802 0 : }
7803 :
7804 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<WVRMethodMod::WVRMethod> > >& vvv_e) {
7805 0 : ostringstream oss;
7806 : oss << "<" << elementName << ">"
7807 : << " 3"
7808 0 : << " " <<vvv_e.size()
7809 0 : << " " <<vvv_e.at(0).size()
7810 0 : << " " <<vvv_e.at(0).at(0).size();
7811 :
7812 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
7813 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
7814 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
7815 0 : oss << " " << CWVRMethod::name(vvv_e.at(i).at(j).at(k));
7816 0 : oss << "</" << elementName << ">";
7817 0 : return oss.str();
7818 0 : }
7819 :
7820 0 : WVRMethodMod::WVRMethod EnumerationParser::getWVRMethod(const string &name, const string &tableName, const string &xmlDoc) {
7821 0 : string s = getField(xmlDoc,name);
7822 0 : if (s.length() == 0)
7823 0 : throw ConversionException("Error: Missing field \"" +
7824 0 : name + "\" or invalid syntax",tableName);
7825 :
7826 : WVRMethod result;
7827 : try {
7828 0 : result = CWVRMethod::newWVRMethod(s);
7829 : }
7830 0 : catch (...) {
7831 0 : throw ConversionException("Error: could not convert '"+s+"' into a WVRMethod.", tableName);
7832 0 : }
7833 0 : return result;
7834 0 : }
7835 :
7836 0 : vector<WVRMethodMod::WVRMethod> EnumerationParser::getWVRMethod1D(const string &name, const string &tableName, const string &xmlDoc) {
7837 0 : vector<WVRMethodMod::WVRMethod> result;
7838 :
7839 0 : string s = getField(xmlDoc,name);
7840 0 : if (s.length() == 0)
7841 0 : throw ConversionException("Error: Missing field \"" +
7842 0 : name + "\" or invalid syntax",tableName);
7843 :
7844 0 : istringstream iss;
7845 0 : iss.str(s);
7846 0 : vector<string> tokens;
7847 :
7848 : // Tokenize.
7849 0 : string buf;
7850 0 : while (iss >> buf) {
7851 0 : tokens.push_back(buf);
7852 : }
7853 :
7854 : // The length must be 2 at the minimum (there may be an empty array)
7855 0 : if (tokens.size() < 2)
7856 0 : throw ConversionException("Error: missing values in field \"" +
7857 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7858 :
7859 :
7860 :
7861 : // The number of dimension should be 1.
7862 0 : if (tokens.at(0) != "1")
7863 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7864 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7865 :
7866 : // Then parse the size of the unique dimension
7867 0 : errno = 0;
7868 0 : int size1 = atoi(tokens.at(1).c_str());
7869 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7870 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7871 :
7872 0 : if (size1 < 0)
7873 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
7874 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7875 :
7876 0 : if (tokens.size() != (unsigned int) (size1 + 2))
7877 0 : throw ConversionException("Error: incorrect number of values in field \"" +
7878 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7879 :
7880 0 : int k = 2;
7881 : try {
7882 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
7883 0 : result.push_back(CWVRMethod::newWVRMethod(tokens.at(k).c_str()));
7884 0 : k++;
7885 : }
7886 : }
7887 0 : catch (...) {
7888 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a WVRMethod.", tableName);
7889 0 : }
7890 :
7891 0 : return result;
7892 0 : }
7893 :
7894 0 : vector<vector<WVRMethodMod::WVRMethod> > EnumerationParser::getWVRMethod2D(const string &name, const string &tableName, const string &xmlDoc) {
7895 0 : vector<vector<WVRMethodMod::WVRMethod> > result;
7896 :
7897 0 : string s = getField(xmlDoc,name);
7898 0 : if (s.length() == 0)
7899 0 : throw ConversionException("Error: Missing field \"" +
7900 0 : name + "\" or invalid syntax",tableName);
7901 :
7902 0 : istringstream iss;
7903 0 : iss.str(s);
7904 0 : vector<string> tokens;
7905 :
7906 : // Tokenize.
7907 0 : string buf;
7908 0 : while (iss >> buf) {
7909 0 : tokens.push_back(buf);
7910 : }
7911 :
7912 : // The length must be 3 at the minimum (there may be an empty array)
7913 0 : if (tokens.size() < 3)
7914 0 : throw ConversionException("Error: missing values in field \"" +
7915 0 : name + "\" or invalid syntax(" + s +"')",tableName);
7916 :
7917 :
7918 : // The number of dimension should be 2.
7919 0 : if (tokens.at(0) != "2")
7920 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7921 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7922 :
7923 : // Then parse the size of the two dimensions
7924 0 : errno = 0;
7925 0 : int size1 = atoi(tokens.at(1).c_str());
7926 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7927 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7928 :
7929 0 : if (size1 <= 0)
7930 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
7931 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7932 0 : errno = 0;
7933 0 : int size2 = atoi(tokens.at(2).c_str());
7934 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7935 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7936 :
7937 0 : if (size2 < 0)
7938 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
7939 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7940 :
7941 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
7942 0 : throw ConversionException("Error: incorrect number of values in field \"" +
7943 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7944 :
7945 0 : int k = 3;
7946 : try {
7947 0 : vector<WVRMethodMod::WVRMethod> v_aux;
7948 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
7949 0 : v_aux.clear();
7950 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
7951 0 : v_aux.push_back(CWVRMethod::newWVRMethod(tokens.at(k).c_str()));
7952 0 : k++;
7953 : }
7954 0 : result.push_back(v_aux);
7955 : }
7956 0 : }
7957 0 : catch (...) {
7958 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a WVRMethod.", tableName);
7959 0 : }
7960 0 : return result;
7961 0 : }
7962 :
7963 :
7964 0 : vector<vector<vector<WVRMethodMod::WVRMethod> > > EnumerationParser::getWVRMethod3D(const string &name, const string &tableName, const string &xmlDoc) {
7965 0 : vector<vector<vector<WVRMethodMod::WVRMethod> > >result;
7966 :
7967 0 : string s = getField(xmlDoc,name);
7968 0 : if (s.length() == 0)
7969 0 : throw ConversionException("Error: Missing field \"" +
7970 0 : name + "\" or invalid syntax",tableName);
7971 :
7972 0 : istringstream iss;
7973 0 : iss.str(s);
7974 0 : vector<string> tokens;
7975 :
7976 : // Tokenize.
7977 0 : string buf;
7978 0 : while (iss >> buf) {
7979 0 : tokens.push_back(buf);
7980 : }
7981 :
7982 : // The length must be 4 at the minimum (there may be an empty array)
7983 0 : if (tokens.size() < 4)
7984 0 : throw ConversionException("Error: missing values in field \"" +
7985 0 : name + "\" or invalid syntax(" + s +"')",tableName);
7986 :
7987 :
7988 : // The number of dimension should be 3.
7989 0 : if (tokens.at(0) != "3")
7990 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
7991 0 : name + "\" or invalid syntax('" + s +"')",tableName);
7992 :
7993 : // Then parse the size of the three dimensions
7994 0 : errno = 0;
7995 0 : int size1 = atoi(tokens.at(1).c_str());
7996 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
7997 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
7998 :
7999 0 : if (size1 <= 0)
8000 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
8001 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8002 :
8003 0 : errno = 0;
8004 0 : int size2 = atoi(tokens.at(2).c_str());
8005 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8006 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8007 :
8008 0 : if (size2 <= 0)
8009 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
8010 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8011 :
8012 0 : errno = 0;
8013 0 : int size3 = atoi(tokens.at(3).c_str());
8014 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8015 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8016 :
8017 :
8018 0 : if (size3 < 0)
8019 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
8020 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8021 :
8022 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
8023 0 : throw ConversionException("Error: incorrect number of values in field \"" +
8024 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8025 :
8026 0 : int k = 4;
8027 : try {
8028 0 : vector<WVRMethodMod::WVRMethod> v_aux;
8029 0 : vector<vector<WVRMethodMod::WVRMethod> > vv_aux;
8030 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
8031 0 : vv_aux.clear();
8032 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
8033 0 : v_aux.clear();
8034 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
8035 0 : v_aux.push_back(CWVRMethod::newWVRMethod(tokens.at(k).c_str()));
8036 0 : k++;
8037 : }
8038 0 : vv_aux.push_back(v_aux);
8039 : }
8040 0 : result.push_back(vv_aux);
8041 : }
8042 0 : }
8043 0 : catch (...) {
8044 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a WVRMethod.", tableName);
8045 0 : }
8046 :
8047 0 : return result;
8048 0 : }
8049 :
8050 :
8051 :
8052 :
8053 :
8054 0 : string EnumerationParser::toXML(const string& elementName, ScanIntentMod::ScanIntent e) {
8055 0 : return "<"+elementName+">"+CScanIntent::name(e)+"</"+elementName+">";
8056 : }
8057 :
8058 334 : string EnumerationParser::toXML(const string& elementName, const vector<ScanIntentMod::ScanIntent>& v_e) {
8059 334 : ostringstream oss;
8060 : oss << "<" << elementName << ">"
8061 : << " 1"
8062 334 : << " " << v_e.size();
8063 :
8064 668 : for (unsigned int i = 0; i < v_e.size(); i++)
8065 334 : oss << " " << CScanIntent::name(v_e.at(i));
8066 334 : oss << "</" << elementName << ">";
8067 668 : return oss.str();
8068 334 : }
8069 :
8070 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<ScanIntentMod::ScanIntent> >& vv_e) {
8071 0 : ostringstream oss;
8072 : oss << "<" << elementName << ">"
8073 : << " 2"
8074 0 : << " " <<vv_e.size()
8075 0 : << " " <<vv_e.at(0).size();
8076 :
8077 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
8078 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
8079 0 : oss << " " << CScanIntent::name(vv_e.at(i).at(j));
8080 0 : oss << "</" << elementName << ">";
8081 0 : return oss.str();
8082 0 : }
8083 :
8084 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<ScanIntentMod::ScanIntent> > >& vvv_e) {
8085 0 : ostringstream oss;
8086 : oss << "<" << elementName << ">"
8087 : << " 3"
8088 0 : << " " <<vvv_e.size()
8089 0 : << " " <<vvv_e.at(0).size()
8090 0 : << " " <<vvv_e.at(0).at(0).size();
8091 :
8092 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
8093 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
8094 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
8095 0 : oss << " " << CScanIntent::name(vvv_e.at(i).at(j).at(k));
8096 0 : oss << "</" << elementName << ">";
8097 0 : return oss.str();
8098 0 : }
8099 :
8100 0 : ScanIntentMod::ScanIntent EnumerationParser::getScanIntent(const string &name, const string &tableName, const string &xmlDoc) {
8101 0 : string s = getField(xmlDoc,name);
8102 0 : if (s.length() == 0)
8103 0 : throw ConversionException("Error: Missing field \"" +
8104 0 : name + "\" or invalid syntax",tableName);
8105 :
8106 : ScanIntent result;
8107 : try {
8108 0 : result = CScanIntent::newScanIntent(s);
8109 : }
8110 0 : catch (...) {
8111 0 : throw ConversionException("Error: could not convert '"+s+"' into a ScanIntent.", tableName);
8112 0 : }
8113 0 : return result;
8114 0 : }
8115 :
8116 1721 : vector<ScanIntentMod::ScanIntent> EnumerationParser::getScanIntent1D(const string &name, const string &tableName, const string &xmlDoc) {
8117 1721 : vector<ScanIntentMod::ScanIntent> result;
8118 :
8119 1721 : string s = getField(xmlDoc,name);
8120 1721 : if (s.length() == 0)
8121 0 : throw ConversionException("Error: Missing field \"" +
8122 0 : name + "\" or invalid syntax",tableName);
8123 :
8124 1721 : istringstream iss;
8125 1721 : iss.str(s);
8126 1721 : vector<string> tokens;
8127 :
8128 : // Tokenize.
8129 1721 : string buf;
8130 8162 : while (iss >> buf) {
8131 6441 : tokens.push_back(buf);
8132 : }
8133 :
8134 : // The length must be 2 at the minimum (there may be an empty array)
8135 1721 : if (tokens.size() < 2)
8136 0 : throw ConversionException("Error: missing values in field \"" +
8137 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8138 :
8139 :
8140 :
8141 : // The number of dimension should be 1.
8142 1721 : if (tokens.at(0) != "1")
8143 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
8144 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8145 :
8146 : // Then parse the size of the unique dimension
8147 1721 : errno = 0;
8148 1721 : int size1 = atoi(tokens.at(1).c_str());
8149 1721 : if (errno != 0) throw ConversionException("Error: Field \"" +
8150 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8151 :
8152 1721 : if (size1 < 0)
8153 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
8154 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8155 :
8156 1721 : if (tokens.size() != (unsigned int) (size1 + 2))
8157 0 : throw ConversionException("Error: incorrect number of values in field \"" +
8158 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8159 :
8160 1721 : int k = 2;
8161 : try {
8162 4720 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
8163 2999 : result.push_back(CScanIntent::newScanIntent(tokens.at(k).c_str()));
8164 2999 : k++;
8165 : }
8166 : }
8167 0 : catch (...) {
8168 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ScanIntent.", tableName);
8169 0 : }
8170 :
8171 3442 : return result;
8172 1721 : }
8173 :
8174 0 : vector<vector<ScanIntentMod::ScanIntent> > EnumerationParser::getScanIntent2D(const string &name, const string &tableName, const string &xmlDoc) {
8175 0 : vector<vector<ScanIntentMod::ScanIntent> > result;
8176 :
8177 0 : string s = getField(xmlDoc,name);
8178 0 : if (s.length() == 0)
8179 0 : throw ConversionException("Error: Missing field \"" +
8180 0 : name + "\" or invalid syntax",tableName);
8181 :
8182 0 : istringstream iss;
8183 0 : iss.str(s);
8184 0 : vector<string> tokens;
8185 :
8186 : // Tokenize.
8187 0 : string buf;
8188 0 : while (iss >> buf) {
8189 0 : tokens.push_back(buf);
8190 : }
8191 :
8192 : // The length must be 3 at the minimum (there may be an empty array)
8193 0 : if (tokens.size() < 3)
8194 0 : throw ConversionException("Error: missing values in field \"" +
8195 0 : name + "\" or invalid syntax(" + s +"')",tableName);
8196 :
8197 :
8198 : // The number of dimension should be 2.
8199 0 : if (tokens.at(0) != "2")
8200 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
8201 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8202 :
8203 : // Then parse the size of the two dimensions
8204 0 : errno = 0;
8205 0 : int size1 = atoi(tokens.at(1).c_str());
8206 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8207 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8208 :
8209 0 : if (size1 <= 0)
8210 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
8211 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8212 0 : errno = 0;
8213 0 : int size2 = atoi(tokens.at(2).c_str());
8214 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8215 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8216 :
8217 0 : if (size2 < 0)
8218 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
8219 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8220 :
8221 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
8222 0 : throw ConversionException("Error: incorrect number of values in field \"" +
8223 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8224 :
8225 0 : int k = 3;
8226 : try {
8227 0 : vector<ScanIntentMod::ScanIntent> v_aux;
8228 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
8229 0 : v_aux.clear();
8230 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
8231 0 : v_aux.push_back(CScanIntent::newScanIntent(tokens.at(k).c_str()));
8232 0 : k++;
8233 : }
8234 0 : result.push_back(v_aux);
8235 : }
8236 0 : }
8237 0 : catch (...) {
8238 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ScanIntent.", tableName);
8239 0 : }
8240 0 : return result;
8241 0 : }
8242 :
8243 :
8244 0 : vector<vector<vector<ScanIntentMod::ScanIntent> > > EnumerationParser::getScanIntent3D(const string &name, const string &tableName, const string &xmlDoc) {
8245 0 : vector<vector<vector<ScanIntentMod::ScanIntent> > >result;
8246 :
8247 0 : string s = getField(xmlDoc,name);
8248 0 : if (s.length() == 0)
8249 0 : throw ConversionException("Error: Missing field \"" +
8250 0 : name + "\" or invalid syntax",tableName);
8251 :
8252 0 : istringstream iss;
8253 0 : iss.str(s);
8254 0 : vector<string> tokens;
8255 :
8256 : // Tokenize.
8257 0 : string buf;
8258 0 : while (iss >> buf) {
8259 0 : tokens.push_back(buf);
8260 : }
8261 :
8262 : // The length must be 4 at the minimum (there may be an empty array)
8263 0 : if (tokens.size() < 4)
8264 0 : throw ConversionException("Error: missing values in field \"" +
8265 0 : name + "\" or invalid syntax(" + s +"')",tableName);
8266 :
8267 :
8268 : // The number of dimension should be 3.
8269 0 : if (tokens.at(0) != "3")
8270 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
8271 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8272 :
8273 : // Then parse the size of the three dimensions
8274 0 : errno = 0;
8275 0 : int size1 = atoi(tokens.at(1).c_str());
8276 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8277 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8278 :
8279 0 : if (size1 <= 0)
8280 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
8281 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8282 :
8283 0 : errno = 0;
8284 0 : int size2 = atoi(tokens.at(2).c_str());
8285 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8286 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8287 :
8288 0 : if (size2 <= 0)
8289 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
8290 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8291 :
8292 0 : errno = 0;
8293 0 : int size3 = atoi(tokens.at(3).c_str());
8294 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8295 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8296 :
8297 :
8298 0 : if (size3 < 0)
8299 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
8300 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8301 :
8302 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
8303 0 : throw ConversionException("Error: incorrect number of values in field \"" +
8304 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8305 :
8306 0 : int k = 4;
8307 : try {
8308 0 : vector<ScanIntentMod::ScanIntent> v_aux;
8309 0 : vector<vector<ScanIntentMod::ScanIntent> > vv_aux;
8310 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
8311 0 : vv_aux.clear();
8312 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
8313 0 : v_aux.clear();
8314 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
8315 0 : v_aux.push_back(CScanIntent::newScanIntent(tokens.at(k).c_str()));
8316 0 : k++;
8317 : }
8318 0 : vv_aux.push_back(v_aux);
8319 : }
8320 0 : result.push_back(vv_aux);
8321 : }
8322 0 : }
8323 0 : catch (...) {
8324 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a ScanIntent.", tableName);
8325 0 : }
8326 :
8327 0 : return result;
8328 0 : }
8329 :
8330 :
8331 :
8332 :
8333 :
8334 0 : string EnumerationParser::toXML(const string& elementName, CalDataOriginMod::CalDataOrigin e) {
8335 0 : return "<"+elementName+">"+CCalDataOrigin::name(e)+"</"+elementName+">";
8336 : }
8337 :
8338 334 : string EnumerationParser::toXML(const string& elementName, const vector<CalDataOriginMod::CalDataOrigin>& v_e) {
8339 334 : ostringstream oss;
8340 : oss << "<" << elementName << ">"
8341 : << " 1"
8342 334 : << " " << v_e.size();
8343 :
8344 668 : for (unsigned int i = 0; i < v_e.size(); i++)
8345 334 : oss << " " << CCalDataOrigin::name(v_e.at(i));
8346 334 : oss << "</" << elementName << ">";
8347 668 : return oss.str();
8348 334 : }
8349 :
8350 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CalDataOriginMod::CalDataOrigin> >& vv_e) {
8351 0 : ostringstream oss;
8352 : oss << "<" << elementName << ">"
8353 : << " 2"
8354 0 : << " " <<vv_e.size()
8355 0 : << " " <<vv_e.at(0).size();
8356 :
8357 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
8358 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
8359 0 : oss << " " << CCalDataOrigin::name(vv_e.at(i).at(j));
8360 0 : oss << "</" << elementName << ">";
8361 0 : return oss.str();
8362 0 : }
8363 :
8364 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CalDataOriginMod::CalDataOrigin> > >& vvv_e) {
8365 0 : ostringstream oss;
8366 : oss << "<" << elementName << ">"
8367 : << " 3"
8368 0 : << " " <<vvv_e.size()
8369 0 : << " " <<vvv_e.at(0).size()
8370 0 : << " " <<vvv_e.at(0).at(0).size();
8371 :
8372 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
8373 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
8374 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
8375 0 : oss << " " << CCalDataOrigin::name(vvv_e.at(i).at(j).at(k));
8376 0 : oss << "</" << elementName << ">";
8377 0 : return oss.str();
8378 0 : }
8379 :
8380 47 : CalDataOriginMod::CalDataOrigin EnumerationParser::getCalDataOrigin(const string &name, const string &tableName, const string &xmlDoc) {
8381 47 : string s = getField(xmlDoc,name);
8382 47 : if (s.length() == 0)
8383 0 : throw ConversionException("Error: Missing field \"" +
8384 0 : name + "\" or invalid syntax",tableName);
8385 :
8386 : CalDataOrigin result;
8387 : try {
8388 47 : result = CCalDataOrigin::newCalDataOrigin(s);
8389 : }
8390 0 : catch (...) {
8391 0 : throw ConversionException("Error: could not convert '"+s+"' into a CalDataOrigin.", tableName);
8392 0 : }
8393 47 : return result;
8394 47 : }
8395 :
8396 1721 : vector<CalDataOriginMod::CalDataOrigin> EnumerationParser::getCalDataOrigin1D(const string &name, const string &tableName, const string &xmlDoc) {
8397 1721 : vector<CalDataOriginMod::CalDataOrigin> result;
8398 :
8399 1721 : string s = getField(xmlDoc,name);
8400 1721 : if (s.length() == 0)
8401 0 : throw ConversionException("Error: Missing field \"" +
8402 0 : name + "\" or invalid syntax",tableName);
8403 :
8404 1721 : istringstream iss;
8405 1721 : iss.str(s);
8406 1721 : vector<string> tokens;
8407 :
8408 : // Tokenize.
8409 1721 : string buf;
8410 8162 : while (iss >> buf) {
8411 6441 : tokens.push_back(buf);
8412 : }
8413 :
8414 : // The length must be 2 at the minimum (there may be an empty array)
8415 1721 : if (tokens.size() < 2)
8416 0 : throw ConversionException("Error: missing values in field \"" +
8417 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8418 :
8419 :
8420 :
8421 : // The number of dimension should be 1.
8422 1721 : if (tokens.at(0) != "1")
8423 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
8424 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8425 :
8426 : // Then parse the size of the unique dimension
8427 1721 : errno = 0;
8428 1721 : int size1 = atoi(tokens.at(1).c_str());
8429 1721 : if (errno != 0) throw ConversionException("Error: Field \"" +
8430 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8431 :
8432 1721 : if (size1 < 0)
8433 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
8434 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8435 :
8436 1721 : if (tokens.size() != (unsigned int) (size1 + 2))
8437 0 : throw ConversionException("Error: incorrect number of values in field \"" +
8438 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8439 :
8440 1721 : int k = 2;
8441 : try {
8442 4720 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
8443 2999 : result.push_back(CCalDataOrigin::newCalDataOrigin(tokens.at(k).c_str()));
8444 2999 : k++;
8445 : }
8446 : }
8447 0 : catch (...) {
8448 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalDataOrigin.", tableName);
8449 0 : }
8450 :
8451 3442 : return result;
8452 1721 : }
8453 :
8454 0 : vector<vector<CalDataOriginMod::CalDataOrigin> > EnumerationParser::getCalDataOrigin2D(const string &name, const string &tableName, const string &xmlDoc) {
8455 0 : vector<vector<CalDataOriginMod::CalDataOrigin> > result;
8456 :
8457 0 : string s = getField(xmlDoc,name);
8458 0 : if (s.length() == 0)
8459 0 : throw ConversionException("Error: Missing field \"" +
8460 0 : name + "\" or invalid syntax",tableName);
8461 :
8462 0 : istringstream iss;
8463 0 : iss.str(s);
8464 0 : vector<string> tokens;
8465 :
8466 : // Tokenize.
8467 0 : string buf;
8468 0 : while (iss >> buf) {
8469 0 : tokens.push_back(buf);
8470 : }
8471 :
8472 : // The length must be 3 at the minimum (there may be an empty array)
8473 0 : if (tokens.size() < 3)
8474 0 : throw ConversionException("Error: missing values in field \"" +
8475 0 : name + "\" or invalid syntax(" + s +"')",tableName);
8476 :
8477 :
8478 : // The number of dimension should be 2.
8479 0 : if (tokens.at(0) != "2")
8480 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
8481 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8482 :
8483 : // Then parse the size of the two dimensions
8484 0 : errno = 0;
8485 0 : int size1 = atoi(tokens.at(1).c_str());
8486 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8487 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8488 :
8489 0 : if (size1 <= 0)
8490 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
8491 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8492 0 : errno = 0;
8493 0 : int size2 = atoi(tokens.at(2).c_str());
8494 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8495 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8496 :
8497 0 : if (size2 < 0)
8498 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
8499 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8500 :
8501 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
8502 0 : throw ConversionException("Error: incorrect number of values in field \"" +
8503 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8504 :
8505 0 : int k = 3;
8506 : try {
8507 0 : vector<CalDataOriginMod::CalDataOrigin> v_aux;
8508 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
8509 0 : v_aux.clear();
8510 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
8511 0 : v_aux.push_back(CCalDataOrigin::newCalDataOrigin(tokens.at(k).c_str()));
8512 0 : k++;
8513 : }
8514 0 : result.push_back(v_aux);
8515 : }
8516 0 : }
8517 0 : catch (...) {
8518 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalDataOrigin.", tableName);
8519 0 : }
8520 0 : return result;
8521 0 : }
8522 :
8523 :
8524 0 : vector<vector<vector<CalDataOriginMod::CalDataOrigin> > > EnumerationParser::getCalDataOrigin3D(const string &name, const string &tableName, const string &xmlDoc) {
8525 0 : vector<vector<vector<CalDataOriginMod::CalDataOrigin> > >result;
8526 :
8527 0 : string s = getField(xmlDoc,name);
8528 0 : if (s.length() == 0)
8529 0 : throw ConversionException("Error: Missing field \"" +
8530 0 : name + "\" or invalid syntax",tableName);
8531 :
8532 0 : istringstream iss;
8533 0 : iss.str(s);
8534 0 : vector<string> tokens;
8535 :
8536 : // Tokenize.
8537 0 : string buf;
8538 0 : while (iss >> buf) {
8539 0 : tokens.push_back(buf);
8540 : }
8541 :
8542 : // The length must be 4 at the minimum (there may be an empty array)
8543 0 : if (tokens.size() < 4)
8544 0 : throw ConversionException("Error: missing values in field \"" +
8545 0 : name + "\" or invalid syntax(" + s +"')",tableName);
8546 :
8547 :
8548 : // The number of dimension should be 3.
8549 0 : if (tokens.at(0) != "3")
8550 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
8551 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8552 :
8553 : // Then parse the size of the three dimensions
8554 0 : errno = 0;
8555 0 : int size1 = atoi(tokens.at(1).c_str());
8556 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8557 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8558 :
8559 0 : if (size1 <= 0)
8560 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
8561 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8562 :
8563 0 : errno = 0;
8564 0 : int size2 = atoi(tokens.at(2).c_str());
8565 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8566 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8567 :
8568 0 : if (size2 <= 0)
8569 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
8570 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8571 :
8572 0 : errno = 0;
8573 0 : int size3 = atoi(tokens.at(3).c_str());
8574 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8575 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8576 :
8577 :
8578 0 : if (size3 < 0)
8579 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
8580 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8581 :
8582 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
8583 0 : throw ConversionException("Error: incorrect number of values in field \"" +
8584 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8585 :
8586 0 : int k = 4;
8587 : try {
8588 0 : vector<CalDataOriginMod::CalDataOrigin> v_aux;
8589 0 : vector<vector<CalDataOriginMod::CalDataOrigin> > vv_aux;
8590 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
8591 0 : vv_aux.clear();
8592 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
8593 0 : v_aux.clear();
8594 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
8595 0 : v_aux.push_back(CCalDataOrigin::newCalDataOrigin(tokens.at(k).c_str()));
8596 0 : k++;
8597 : }
8598 0 : vv_aux.push_back(v_aux);
8599 : }
8600 0 : result.push_back(vv_aux);
8601 : }
8602 0 : }
8603 0 : catch (...) {
8604 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalDataOrigin.", tableName);
8605 0 : }
8606 :
8607 0 : return result;
8608 0 : }
8609 :
8610 :
8611 :
8612 :
8613 :
8614 0 : string EnumerationParser::toXML(const string& elementName, CalibrationFunctionMod::CalibrationFunction e) {
8615 0 : return "<"+elementName+">"+CCalibrationFunction::name(e)+"</"+elementName+">";
8616 : }
8617 :
8618 0 : string EnumerationParser::toXML(const string& elementName, const vector<CalibrationFunctionMod::CalibrationFunction>& v_e) {
8619 0 : ostringstream oss;
8620 : oss << "<" << elementName << ">"
8621 : << " 1"
8622 0 : << " " << v_e.size();
8623 :
8624 0 : for (unsigned int i = 0; i < v_e.size(); i++)
8625 0 : oss << " " << CCalibrationFunction::name(v_e.at(i));
8626 0 : oss << "</" << elementName << ">";
8627 0 : return oss.str();
8628 0 : }
8629 :
8630 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CalibrationFunctionMod::CalibrationFunction> >& vv_e) {
8631 0 : ostringstream oss;
8632 : oss << "<" << elementName << ">"
8633 : << " 2"
8634 0 : << " " <<vv_e.size()
8635 0 : << " " <<vv_e.at(0).size();
8636 :
8637 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
8638 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
8639 0 : oss << " " << CCalibrationFunction::name(vv_e.at(i).at(j));
8640 0 : oss << "</" << elementName << ">";
8641 0 : return oss.str();
8642 0 : }
8643 :
8644 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CalibrationFunctionMod::CalibrationFunction> > >& vvv_e) {
8645 0 : ostringstream oss;
8646 : oss << "<" << elementName << ">"
8647 : << " 3"
8648 0 : << " " <<vvv_e.size()
8649 0 : << " " <<vvv_e.at(0).size()
8650 0 : << " " <<vvv_e.at(0).at(0).size();
8651 :
8652 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
8653 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
8654 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
8655 0 : oss << " " << CCalibrationFunction::name(vvv_e.at(i).at(j).at(k));
8656 0 : oss << "</" << elementName << ">";
8657 0 : return oss.str();
8658 0 : }
8659 :
8660 0 : CalibrationFunctionMod::CalibrationFunction EnumerationParser::getCalibrationFunction(const string &name, const string &tableName, const string &xmlDoc) {
8661 0 : string s = getField(xmlDoc,name);
8662 0 : if (s.length() == 0)
8663 0 : throw ConversionException("Error: Missing field \"" +
8664 0 : name + "\" or invalid syntax",tableName);
8665 :
8666 : CalibrationFunction result;
8667 : try {
8668 0 : result = CCalibrationFunction::newCalibrationFunction(s);
8669 : }
8670 0 : catch (...) {
8671 0 : throw ConversionException("Error: could not convert '"+s+"' into a CalibrationFunction.", tableName);
8672 0 : }
8673 0 : return result;
8674 0 : }
8675 :
8676 1333 : vector<CalibrationFunctionMod::CalibrationFunction> EnumerationParser::getCalibrationFunction1D(const string &name, const string &tableName, const string &xmlDoc) {
8677 1333 : vector<CalibrationFunctionMod::CalibrationFunction> result;
8678 :
8679 1333 : string s = getField(xmlDoc,name);
8680 1333 : if (s.length() == 0)
8681 0 : throw ConversionException("Error: Missing field \"" +
8682 0 : name + "\" or invalid syntax",tableName);
8683 :
8684 1333 : istringstream iss;
8685 1333 : iss.str(s);
8686 1333 : vector<string> tokens;
8687 :
8688 : // Tokenize.
8689 1333 : string buf;
8690 6550 : while (iss >> buf) {
8691 5217 : tokens.push_back(buf);
8692 : }
8693 :
8694 : // The length must be 2 at the minimum (there may be an empty array)
8695 1333 : if (tokens.size() < 2)
8696 0 : throw ConversionException("Error: missing values in field \"" +
8697 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8698 :
8699 :
8700 :
8701 : // The number of dimension should be 1.
8702 1333 : if (tokens.at(0) != "1")
8703 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
8704 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8705 :
8706 : // Then parse the size of the unique dimension
8707 1333 : errno = 0;
8708 1333 : int size1 = atoi(tokens.at(1).c_str());
8709 1333 : if (errno != 0) throw ConversionException("Error: Field \"" +
8710 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8711 :
8712 1333 : if (size1 < 0)
8713 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
8714 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8715 :
8716 1333 : if (tokens.size() != (unsigned int) (size1 + 2))
8717 0 : throw ConversionException("Error: incorrect number of values in field \"" +
8718 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8719 :
8720 1333 : int k = 2;
8721 : try {
8722 3884 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
8723 2551 : result.push_back(CCalibrationFunction::newCalibrationFunction(tokens.at(k).c_str()));
8724 2551 : k++;
8725 : }
8726 : }
8727 0 : catch (...) {
8728 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationFunction.", tableName);
8729 0 : }
8730 :
8731 2666 : return result;
8732 1333 : }
8733 :
8734 0 : vector<vector<CalibrationFunctionMod::CalibrationFunction> > EnumerationParser::getCalibrationFunction2D(const string &name, const string &tableName, const string &xmlDoc) {
8735 0 : vector<vector<CalibrationFunctionMod::CalibrationFunction> > result;
8736 :
8737 0 : string s = getField(xmlDoc,name);
8738 0 : if (s.length() == 0)
8739 0 : throw ConversionException("Error: Missing field \"" +
8740 0 : name + "\" or invalid syntax",tableName);
8741 :
8742 0 : istringstream iss;
8743 0 : iss.str(s);
8744 0 : vector<string> tokens;
8745 :
8746 : // Tokenize.
8747 0 : string buf;
8748 0 : while (iss >> buf) {
8749 0 : tokens.push_back(buf);
8750 : }
8751 :
8752 : // The length must be 3 at the minimum (there may be an empty array)
8753 0 : if (tokens.size() < 3)
8754 0 : throw ConversionException("Error: missing values in field \"" +
8755 0 : name + "\" or invalid syntax(" + s +"')",tableName);
8756 :
8757 :
8758 : // The number of dimension should be 2.
8759 0 : if (tokens.at(0) != "2")
8760 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
8761 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8762 :
8763 : // Then parse the size of the two dimensions
8764 0 : errno = 0;
8765 0 : int size1 = atoi(tokens.at(1).c_str());
8766 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8767 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8768 :
8769 0 : if (size1 <= 0)
8770 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
8771 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8772 0 : errno = 0;
8773 0 : int size2 = atoi(tokens.at(2).c_str());
8774 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8775 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8776 :
8777 0 : if (size2 < 0)
8778 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
8779 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8780 :
8781 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
8782 0 : throw ConversionException("Error: incorrect number of values in field \"" +
8783 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8784 :
8785 0 : int k = 3;
8786 : try {
8787 0 : vector<CalibrationFunctionMod::CalibrationFunction> v_aux;
8788 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
8789 0 : v_aux.clear();
8790 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
8791 0 : v_aux.push_back(CCalibrationFunction::newCalibrationFunction(tokens.at(k).c_str()));
8792 0 : k++;
8793 : }
8794 0 : result.push_back(v_aux);
8795 : }
8796 0 : }
8797 0 : catch (...) {
8798 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationFunction.", tableName);
8799 0 : }
8800 0 : return result;
8801 0 : }
8802 :
8803 :
8804 0 : vector<vector<vector<CalibrationFunctionMod::CalibrationFunction> > > EnumerationParser::getCalibrationFunction3D(const string &name, const string &tableName, const string &xmlDoc) {
8805 0 : vector<vector<vector<CalibrationFunctionMod::CalibrationFunction> > >result;
8806 :
8807 0 : string s = getField(xmlDoc,name);
8808 0 : if (s.length() == 0)
8809 0 : throw ConversionException("Error: Missing field \"" +
8810 0 : name + "\" or invalid syntax",tableName);
8811 :
8812 0 : istringstream iss;
8813 0 : iss.str(s);
8814 0 : vector<string> tokens;
8815 :
8816 : // Tokenize.
8817 0 : string buf;
8818 0 : while (iss >> buf) {
8819 0 : tokens.push_back(buf);
8820 : }
8821 :
8822 : // The length must be 4 at the minimum (there may be an empty array)
8823 0 : if (tokens.size() < 4)
8824 0 : throw ConversionException("Error: missing values in field \"" +
8825 0 : name + "\" or invalid syntax(" + s +"')",tableName);
8826 :
8827 :
8828 : // The number of dimension should be 3.
8829 0 : if (tokens.at(0) != "3")
8830 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
8831 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8832 :
8833 : // Then parse the size of the three dimensions
8834 0 : errno = 0;
8835 0 : int size1 = atoi(tokens.at(1).c_str());
8836 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8837 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8838 :
8839 0 : if (size1 <= 0)
8840 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
8841 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8842 :
8843 0 : errno = 0;
8844 0 : int size2 = atoi(tokens.at(2).c_str());
8845 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8846 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8847 :
8848 0 : if (size2 <= 0)
8849 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
8850 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8851 :
8852 0 : errno = 0;
8853 0 : int size3 = atoi(tokens.at(3).c_str());
8854 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
8855 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8856 :
8857 :
8858 0 : if (size3 < 0)
8859 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
8860 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8861 :
8862 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
8863 0 : throw ConversionException("Error: incorrect number of values in field \"" +
8864 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8865 :
8866 0 : int k = 4;
8867 : try {
8868 0 : vector<CalibrationFunctionMod::CalibrationFunction> v_aux;
8869 0 : vector<vector<CalibrationFunctionMod::CalibrationFunction> > vv_aux;
8870 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
8871 0 : vv_aux.clear();
8872 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
8873 0 : v_aux.clear();
8874 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
8875 0 : v_aux.push_back(CCalibrationFunction::newCalibrationFunction(tokens.at(k).c_str()));
8876 0 : k++;
8877 : }
8878 0 : vv_aux.push_back(v_aux);
8879 : }
8880 0 : result.push_back(vv_aux);
8881 : }
8882 0 : }
8883 0 : catch (...) {
8884 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationFunction.", tableName);
8885 0 : }
8886 :
8887 0 : return result;
8888 0 : }
8889 :
8890 :
8891 :
8892 :
8893 :
8894 0 : string EnumerationParser::toXML(const string& elementName, CalibrationSetMod::CalibrationSet e) {
8895 0 : return "<"+elementName+">"+CCalibrationSet::name(e)+"</"+elementName+">";
8896 : }
8897 :
8898 0 : string EnumerationParser::toXML(const string& elementName, const vector<CalibrationSetMod::CalibrationSet>& v_e) {
8899 0 : ostringstream oss;
8900 : oss << "<" << elementName << ">"
8901 : << " 1"
8902 0 : << " " << v_e.size();
8903 :
8904 0 : for (unsigned int i = 0; i < v_e.size(); i++)
8905 0 : oss << " " << CCalibrationSet::name(v_e.at(i));
8906 0 : oss << "</" << elementName << ">";
8907 0 : return oss.str();
8908 0 : }
8909 :
8910 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CalibrationSetMod::CalibrationSet> >& vv_e) {
8911 0 : ostringstream oss;
8912 : oss << "<" << elementName << ">"
8913 : << " 2"
8914 0 : << " " <<vv_e.size()
8915 0 : << " " <<vv_e.at(0).size();
8916 :
8917 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
8918 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
8919 0 : oss << " " << CCalibrationSet::name(vv_e.at(i).at(j));
8920 0 : oss << "</" << elementName << ">";
8921 0 : return oss.str();
8922 0 : }
8923 :
8924 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CalibrationSetMod::CalibrationSet> > >& vvv_e) {
8925 0 : ostringstream oss;
8926 : oss << "<" << elementName << ">"
8927 : << " 3"
8928 0 : << " " <<vvv_e.size()
8929 0 : << " " <<vvv_e.at(0).size()
8930 0 : << " " <<vvv_e.at(0).at(0).size();
8931 :
8932 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
8933 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
8934 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
8935 0 : oss << " " << CCalibrationSet::name(vvv_e.at(i).at(j).at(k));
8936 0 : oss << "</" << elementName << ">";
8937 0 : return oss.str();
8938 0 : }
8939 :
8940 0 : CalibrationSetMod::CalibrationSet EnumerationParser::getCalibrationSet(const string &name, const string &tableName, const string &xmlDoc) {
8941 0 : string s = getField(xmlDoc,name);
8942 0 : if (s.length() == 0)
8943 0 : throw ConversionException("Error: Missing field \"" +
8944 0 : name + "\" or invalid syntax",tableName);
8945 :
8946 : CalibrationSet result;
8947 : try {
8948 0 : result = CCalibrationSet::newCalibrationSet(s);
8949 : }
8950 0 : catch (...) {
8951 0 : throw ConversionException("Error: could not convert '"+s+"' into a CalibrationSet.", tableName);
8952 0 : }
8953 0 : return result;
8954 0 : }
8955 :
8956 1333 : vector<CalibrationSetMod::CalibrationSet> EnumerationParser::getCalibrationSet1D(const string &name, const string &tableName, const string &xmlDoc) {
8957 1333 : vector<CalibrationSetMod::CalibrationSet> result;
8958 :
8959 1333 : string s = getField(xmlDoc,name);
8960 1333 : if (s.length() == 0)
8961 0 : throw ConversionException("Error: Missing field \"" +
8962 0 : name + "\" or invalid syntax",tableName);
8963 :
8964 1333 : istringstream iss;
8965 1333 : iss.str(s);
8966 1333 : vector<string> tokens;
8967 :
8968 : // Tokenize.
8969 1333 : string buf;
8970 6550 : while (iss >> buf) {
8971 5217 : tokens.push_back(buf);
8972 : }
8973 :
8974 : // The length must be 2 at the minimum (there may be an empty array)
8975 1333 : if (tokens.size() < 2)
8976 0 : throw ConversionException("Error: missing values in field \"" +
8977 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8978 :
8979 :
8980 :
8981 : // The number of dimension should be 1.
8982 1333 : if (tokens.at(0) != "1")
8983 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
8984 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8985 :
8986 : // Then parse the size of the unique dimension
8987 1333 : errno = 0;
8988 1333 : int size1 = atoi(tokens.at(1).c_str());
8989 1333 : if (errno != 0) throw ConversionException("Error: Field \"" +
8990 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
8991 :
8992 1333 : if (size1 < 0)
8993 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
8994 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8995 :
8996 1333 : if (tokens.size() != (unsigned int) (size1 + 2))
8997 0 : throw ConversionException("Error: incorrect number of values in field \"" +
8998 0 : name + "\" or invalid syntax('" + s +"')",tableName);
8999 :
9000 1333 : int k = 2;
9001 : try {
9002 3884 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
9003 2551 : result.push_back(CCalibrationSet::newCalibrationSet(tokens.at(k).c_str()));
9004 2551 : k++;
9005 : }
9006 : }
9007 0 : catch (...) {
9008 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationSet.", tableName);
9009 0 : }
9010 :
9011 2666 : return result;
9012 1333 : }
9013 :
9014 0 : vector<vector<CalibrationSetMod::CalibrationSet> > EnumerationParser::getCalibrationSet2D(const string &name, const string &tableName, const string &xmlDoc) {
9015 0 : vector<vector<CalibrationSetMod::CalibrationSet> > result;
9016 :
9017 0 : string s = getField(xmlDoc,name);
9018 0 : if (s.length() == 0)
9019 0 : throw ConversionException("Error: Missing field \"" +
9020 0 : name + "\" or invalid syntax",tableName);
9021 :
9022 0 : istringstream iss;
9023 0 : iss.str(s);
9024 0 : vector<string> tokens;
9025 :
9026 : // Tokenize.
9027 0 : string buf;
9028 0 : while (iss >> buf) {
9029 0 : tokens.push_back(buf);
9030 : }
9031 :
9032 : // The length must be 3 at the minimum (there may be an empty array)
9033 0 : if (tokens.size() < 3)
9034 0 : throw ConversionException("Error: missing values in field \"" +
9035 0 : name + "\" or invalid syntax(" + s +"')",tableName);
9036 :
9037 :
9038 : // The number of dimension should be 2.
9039 0 : if (tokens.at(0) != "2")
9040 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
9041 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9042 :
9043 : // Then parse the size of the two dimensions
9044 0 : errno = 0;
9045 0 : int size1 = atoi(tokens.at(1).c_str());
9046 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9047 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9048 :
9049 0 : if (size1 <= 0)
9050 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9051 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9052 0 : errno = 0;
9053 0 : int size2 = atoi(tokens.at(2).c_str());
9054 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9055 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9056 :
9057 0 : if (size2 < 0)
9058 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
9059 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9060 :
9061 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
9062 0 : throw ConversionException("Error: incorrect number of values in field \"" +
9063 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9064 :
9065 0 : int k = 3;
9066 : try {
9067 0 : vector<CalibrationSetMod::CalibrationSet> v_aux;
9068 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
9069 0 : v_aux.clear();
9070 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
9071 0 : v_aux.push_back(CCalibrationSet::newCalibrationSet(tokens.at(k).c_str()));
9072 0 : k++;
9073 : }
9074 0 : result.push_back(v_aux);
9075 : }
9076 0 : }
9077 0 : catch (...) {
9078 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationSet.", tableName);
9079 0 : }
9080 0 : return result;
9081 0 : }
9082 :
9083 :
9084 0 : vector<vector<vector<CalibrationSetMod::CalibrationSet> > > EnumerationParser::getCalibrationSet3D(const string &name, const string &tableName, const string &xmlDoc) {
9085 0 : vector<vector<vector<CalibrationSetMod::CalibrationSet> > >result;
9086 :
9087 0 : string s = getField(xmlDoc,name);
9088 0 : if (s.length() == 0)
9089 0 : throw ConversionException("Error: Missing field \"" +
9090 0 : name + "\" or invalid syntax",tableName);
9091 :
9092 0 : istringstream iss;
9093 0 : iss.str(s);
9094 0 : vector<string> tokens;
9095 :
9096 : // Tokenize.
9097 0 : string buf;
9098 0 : while (iss >> buf) {
9099 0 : tokens.push_back(buf);
9100 : }
9101 :
9102 : // The length must be 4 at the minimum (there may be an empty array)
9103 0 : if (tokens.size() < 4)
9104 0 : throw ConversionException("Error: missing values in field \"" +
9105 0 : name + "\" or invalid syntax(" + s +"')",tableName);
9106 :
9107 :
9108 : // The number of dimension should be 3.
9109 0 : if (tokens.at(0) != "3")
9110 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
9111 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9112 :
9113 : // Then parse the size of the three dimensions
9114 0 : errno = 0;
9115 0 : int size1 = atoi(tokens.at(1).c_str());
9116 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9117 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9118 :
9119 0 : if (size1 <= 0)
9120 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9121 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9122 :
9123 0 : errno = 0;
9124 0 : int size2 = atoi(tokens.at(2).c_str());
9125 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9126 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9127 :
9128 0 : if (size2 <= 0)
9129 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9130 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9131 :
9132 0 : errno = 0;
9133 0 : int size3 = atoi(tokens.at(3).c_str());
9134 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9135 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9136 :
9137 :
9138 0 : if (size3 < 0)
9139 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
9140 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9141 :
9142 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
9143 0 : throw ConversionException("Error: incorrect number of values in field \"" +
9144 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9145 :
9146 0 : int k = 4;
9147 : try {
9148 0 : vector<CalibrationSetMod::CalibrationSet> v_aux;
9149 0 : vector<vector<CalibrationSetMod::CalibrationSet> > vv_aux;
9150 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
9151 0 : vv_aux.clear();
9152 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
9153 0 : v_aux.clear();
9154 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
9155 0 : v_aux.push_back(CCalibrationSet::newCalibrationSet(tokens.at(k).c_str()));
9156 0 : k++;
9157 : }
9158 0 : vv_aux.push_back(v_aux);
9159 : }
9160 0 : result.push_back(vv_aux);
9161 : }
9162 0 : }
9163 0 : catch (...) {
9164 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationSet.", tableName);
9165 0 : }
9166 :
9167 0 : return result;
9168 0 : }
9169 :
9170 :
9171 :
9172 :
9173 :
9174 0 : string EnumerationParser::toXML(const string& elementName, AntennaMotionPatternMod::AntennaMotionPattern e) {
9175 0 : return "<"+elementName+">"+CAntennaMotionPattern::name(e)+"</"+elementName+">";
9176 : }
9177 :
9178 0 : string EnumerationParser::toXML(const string& elementName, const vector<AntennaMotionPatternMod::AntennaMotionPattern>& v_e) {
9179 0 : ostringstream oss;
9180 : oss << "<" << elementName << ">"
9181 : << " 1"
9182 0 : << " " << v_e.size();
9183 :
9184 0 : for (unsigned int i = 0; i < v_e.size(); i++)
9185 0 : oss << " " << CAntennaMotionPattern::name(v_e.at(i));
9186 0 : oss << "</" << elementName << ">";
9187 0 : return oss.str();
9188 0 : }
9189 :
9190 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<AntennaMotionPatternMod::AntennaMotionPattern> >& vv_e) {
9191 0 : ostringstream oss;
9192 : oss << "<" << elementName << ">"
9193 : << " 2"
9194 0 : << " " <<vv_e.size()
9195 0 : << " " <<vv_e.at(0).size();
9196 :
9197 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
9198 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
9199 0 : oss << " " << CAntennaMotionPattern::name(vv_e.at(i).at(j));
9200 0 : oss << "</" << elementName << ">";
9201 0 : return oss.str();
9202 0 : }
9203 :
9204 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<AntennaMotionPatternMod::AntennaMotionPattern> > >& vvv_e) {
9205 0 : ostringstream oss;
9206 : oss << "<" << elementName << ">"
9207 : << " 3"
9208 0 : << " " <<vvv_e.size()
9209 0 : << " " <<vvv_e.at(0).size()
9210 0 : << " " <<vvv_e.at(0).at(0).size();
9211 :
9212 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
9213 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
9214 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
9215 0 : oss << " " << CAntennaMotionPattern::name(vvv_e.at(i).at(j).at(k));
9216 0 : oss << "</" << elementName << ">";
9217 0 : return oss.str();
9218 0 : }
9219 :
9220 0 : AntennaMotionPatternMod::AntennaMotionPattern EnumerationParser::getAntennaMotionPattern(const string &name, const string &tableName, const string &xmlDoc) {
9221 0 : string s = getField(xmlDoc,name);
9222 0 : if (s.length() == 0)
9223 0 : throw ConversionException("Error: Missing field \"" +
9224 0 : name + "\" or invalid syntax",tableName);
9225 :
9226 : AntennaMotionPattern result;
9227 : try {
9228 0 : result = CAntennaMotionPattern::newAntennaMotionPattern(s);
9229 : }
9230 0 : catch (...) {
9231 0 : throw ConversionException("Error: could not convert '"+s+"' into a AntennaMotionPattern.", tableName);
9232 0 : }
9233 0 : return result;
9234 0 : }
9235 :
9236 1333 : vector<AntennaMotionPatternMod::AntennaMotionPattern> EnumerationParser::getAntennaMotionPattern1D(const string &name, const string &tableName, const string &xmlDoc) {
9237 1333 : vector<AntennaMotionPatternMod::AntennaMotionPattern> result;
9238 :
9239 1333 : string s = getField(xmlDoc,name);
9240 1333 : if (s.length() == 0)
9241 0 : throw ConversionException("Error: Missing field \"" +
9242 0 : name + "\" or invalid syntax",tableName);
9243 :
9244 1333 : istringstream iss;
9245 1333 : iss.str(s);
9246 1333 : vector<string> tokens;
9247 :
9248 : // Tokenize.
9249 1333 : string buf;
9250 6550 : while (iss >> buf) {
9251 5217 : tokens.push_back(buf);
9252 : }
9253 :
9254 : // The length must be 2 at the minimum (there may be an empty array)
9255 1333 : if (tokens.size() < 2)
9256 0 : throw ConversionException("Error: missing values in field \"" +
9257 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9258 :
9259 :
9260 :
9261 : // The number of dimension should be 1.
9262 1333 : if (tokens.at(0) != "1")
9263 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
9264 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9265 :
9266 : // Then parse the size of the unique dimension
9267 1333 : errno = 0;
9268 1333 : int size1 = atoi(tokens.at(1).c_str());
9269 1333 : if (errno != 0) throw ConversionException("Error: Field \"" +
9270 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9271 :
9272 1333 : if (size1 < 0)
9273 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
9274 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9275 :
9276 1333 : if (tokens.size() != (unsigned int) (size1 + 2))
9277 0 : throw ConversionException("Error: incorrect number of values in field \"" +
9278 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9279 :
9280 1333 : int k = 2;
9281 : try {
9282 3884 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
9283 2551 : result.push_back(CAntennaMotionPattern::newAntennaMotionPattern(tokens.at(k).c_str()));
9284 2551 : k++;
9285 : }
9286 : }
9287 0 : catch (...) {
9288 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AntennaMotionPattern.", tableName);
9289 0 : }
9290 :
9291 2666 : return result;
9292 1333 : }
9293 :
9294 0 : vector<vector<AntennaMotionPatternMod::AntennaMotionPattern> > EnumerationParser::getAntennaMotionPattern2D(const string &name, const string &tableName, const string &xmlDoc) {
9295 0 : vector<vector<AntennaMotionPatternMod::AntennaMotionPattern> > result;
9296 :
9297 0 : string s = getField(xmlDoc,name);
9298 0 : if (s.length() == 0)
9299 0 : throw ConversionException("Error: Missing field \"" +
9300 0 : name + "\" or invalid syntax",tableName);
9301 :
9302 0 : istringstream iss;
9303 0 : iss.str(s);
9304 0 : vector<string> tokens;
9305 :
9306 : // Tokenize.
9307 0 : string buf;
9308 0 : while (iss >> buf) {
9309 0 : tokens.push_back(buf);
9310 : }
9311 :
9312 : // The length must be 3 at the minimum (there may be an empty array)
9313 0 : if (tokens.size() < 3)
9314 0 : throw ConversionException("Error: missing values in field \"" +
9315 0 : name + "\" or invalid syntax(" + s +"')",tableName);
9316 :
9317 :
9318 : // The number of dimension should be 2.
9319 0 : if (tokens.at(0) != "2")
9320 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
9321 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9322 :
9323 : // Then parse the size of the two dimensions
9324 0 : errno = 0;
9325 0 : int size1 = atoi(tokens.at(1).c_str());
9326 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9327 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9328 :
9329 0 : if (size1 <= 0)
9330 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9331 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9332 0 : errno = 0;
9333 0 : int size2 = atoi(tokens.at(2).c_str());
9334 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9335 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9336 :
9337 0 : if (size2 < 0)
9338 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
9339 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9340 :
9341 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
9342 0 : throw ConversionException("Error: incorrect number of values in field \"" +
9343 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9344 :
9345 0 : int k = 3;
9346 : try {
9347 0 : vector<AntennaMotionPatternMod::AntennaMotionPattern> v_aux;
9348 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
9349 0 : v_aux.clear();
9350 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
9351 0 : v_aux.push_back(CAntennaMotionPattern::newAntennaMotionPattern(tokens.at(k).c_str()));
9352 0 : k++;
9353 : }
9354 0 : result.push_back(v_aux);
9355 : }
9356 0 : }
9357 0 : catch (...) {
9358 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AntennaMotionPattern.", tableName);
9359 0 : }
9360 0 : return result;
9361 0 : }
9362 :
9363 :
9364 0 : vector<vector<vector<AntennaMotionPatternMod::AntennaMotionPattern> > > EnumerationParser::getAntennaMotionPattern3D(const string &name, const string &tableName, const string &xmlDoc) {
9365 0 : vector<vector<vector<AntennaMotionPatternMod::AntennaMotionPattern> > >result;
9366 :
9367 0 : string s = getField(xmlDoc,name);
9368 0 : if (s.length() == 0)
9369 0 : throw ConversionException("Error: Missing field \"" +
9370 0 : name + "\" or invalid syntax",tableName);
9371 :
9372 0 : istringstream iss;
9373 0 : iss.str(s);
9374 0 : vector<string> tokens;
9375 :
9376 : // Tokenize.
9377 0 : string buf;
9378 0 : while (iss >> buf) {
9379 0 : tokens.push_back(buf);
9380 : }
9381 :
9382 : // The length must be 4 at the minimum (there may be an empty array)
9383 0 : if (tokens.size() < 4)
9384 0 : throw ConversionException("Error: missing values in field \"" +
9385 0 : name + "\" or invalid syntax(" + s +"')",tableName);
9386 :
9387 :
9388 : // The number of dimension should be 3.
9389 0 : if (tokens.at(0) != "3")
9390 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
9391 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9392 :
9393 : // Then parse the size of the three dimensions
9394 0 : errno = 0;
9395 0 : int size1 = atoi(tokens.at(1).c_str());
9396 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9397 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9398 :
9399 0 : if (size1 <= 0)
9400 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9401 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9402 :
9403 0 : errno = 0;
9404 0 : int size2 = atoi(tokens.at(2).c_str());
9405 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9406 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9407 :
9408 0 : if (size2 <= 0)
9409 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9410 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9411 :
9412 0 : errno = 0;
9413 0 : int size3 = atoi(tokens.at(3).c_str());
9414 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9415 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9416 :
9417 :
9418 0 : if (size3 < 0)
9419 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
9420 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9421 :
9422 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
9423 0 : throw ConversionException("Error: incorrect number of values in field \"" +
9424 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9425 :
9426 0 : int k = 4;
9427 : try {
9428 0 : vector<AntennaMotionPatternMod::AntennaMotionPattern> v_aux;
9429 0 : vector<vector<AntennaMotionPatternMod::AntennaMotionPattern> > vv_aux;
9430 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
9431 0 : vv_aux.clear();
9432 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
9433 0 : v_aux.clear();
9434 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
9435 0 : v_aux.push_back(CAntennaMotionPattern::newAntennaMotionPattern(tokens.at(k).c_str()));
9436 0 : k++;
9437 : }
9438 0 : vv_aux.push_back(v_aux);
9439 : }
9440 0 : result.push_back(vv_aux);
9441 : }
9442 0 : }
9443 0 : catch (...) {
9444 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a AntennaMotionPattern.", tableName);
9445 0 : }
9446 :
9447 0 : return result;
9448 0 : }
9449 :
9450 :
9451 :
9452 :
9453 :
9454 536 : string EnumerationParser::toXML(const string& elementName, SubscanIntentMod::SubscanIntent e) {
9455 1072 : return "<"+elementName+">"+CSubscanIntent::name(e)+"</"+elementName+">";
9456 : }
9457 :
9458 0 : string EnumerationParser::toXML(const string& elementName, const vector<SubscanIntentMod::SubscanIntent>& v_e) {
9459 0 : ostringstream oss;
9460 : oss << "<" << elementName << ">"
9461 : << " 1"
9462 0 : << " " << v_e.size();
9463 :
9464 0 : for (unsigned int i = 0; i < v_e.size(); i++)
9465 0 : oss << " " << CSubscanIntent::name(v_e.at(i));
9466 0 : oss << "</" << elementName << ">";
9467 0 : return oss.str();
9468 0 : }
9469 :
9470 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<SubscanIntentMod::SubscanIntent> >& vv_e) {
9471 0 : ostringstream oss;
9472 : oss << "<" << elementName << ">"
9473 : << " 2"
9474 0 : << " " <<vv_e.size()
9475 0 : << " " <<vv_e.at(0).size();
9476 :
9477 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
9478 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
9479 0 : oss << " " << CSubscanIntent::name(vv_e.at(i).at(j));
9480 0 : oss << "</" << elementName << ">";
9481 0 : return oss.str();
9482 0 : }
9483 :
9484 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<SubscanIntentMod::SubscanIntent> > >& vvv_e) {
9485 0 : ostringstream oss;
9486 : oss << "<" << elementName << ">"
9487 : << " 3"
9488 0 : << " " <<vvv_e.size()
9489 0 : << " " <<vvv_e.at(0).size()
9490 0 : << " " <<vvv_e.at(0).at(0).size();
9491 :
9492 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
9493 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
9494 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
9495 0 : oss << " " << CSubscanIntent::name(vvv_e.at(i).at(j).at(k));
9496 0 : oss << "</" << elementName << ">";
9497 0 : return oss.str();
9498 0 : }
9499 :
9500 7694 : SubscanIntentMod::SubscanIntent EnumerationParser::getSubscanIntent(const string &name, const string &tableName, const string &xmlDoc) {
9501 7694 : string s = getField(xmlDoc,name);
9502 7694 : if (s.length() == 0)
9503 0 : throw ConversionException("Error: Missing field \"" +
9504 0 : name + "\" or invalid syntax",tableName);
9505 :
9506 : SubscanIntent result;
9507 : try {
9508 7694 : result = CSubscanIntent::newSubscanIntent(s);
9509 : }
9510 0 : catch (...) {
9511 0 : throw ConversionException("Error: could not convert '"+s+"' into a SubscanIntent.", tableName);
9512 0 : }
9513 7694 : return result;
9514 7694 : }
9515 :
9516 0 : vector<SubscanIntentMod::SubscanIntent> EnumerationParser::getSubscanIntent1D(const string &name, const string &tableName, const string &xmlDoc) {
9517 0 : vector<SubscanIntentMod::SubscanIntent> result;
9518 :
9519 0 : string s = getField(xmlDoc,name);
9520 0 : if (s.length() == 0)
9521 0 : throw ConversionException("Error: Missing field \"" +
9522 0 : name + "\" or invalid syntax",tableName);
9523 :
9524 0 : istringstream iss;
9525 0 : iss.str(s);
9526 0 : vector<string> tokens;
9527 :
9528 : // Tokenize.
9529 0 : string buf;
9530 0 : while (iss >> buf) {
9531 0 : tokens.push_back(buf);
9532 : }
9533 :
9534 : // The length must be 2 at the minimum (there may be an empty array)
9535 0 : if (tokens.size() < 2)
9536 0 : throw ConversionException("Error: missing values in field \"" +
9537 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9538 :
9539 :
9540 :
9541 : // The number of dimension should be 1.
9542 0 : if (tokens.at(0) != "1")
9543 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
9544 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9545 :
9546 : // Then parse the size of the unique dimension
9547 0 : errno = 0;
9548 0 : int size1 = atoi(tokens.at(1).c_str());
9549 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9550 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9551 :
9552 0 : if (size1 < 0)
9553 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
9554 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9555 :
9556 0 : if (tokens.size() != (unsigned int) (size1 + 2))
9557 0 : throw ConversionException("Error: incorrect number of values in field \"" +
9558 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9559 :
9560 0 : int k = 2;
9561 : try {
9562 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
9563 0 : result.push_back(CSubscanIntent::newSubscanIntent(tokens.at(k).c_str()));
9564 0 : k++;
9565 : }
9566 : }
9567 0 : catch (...) {
9568 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SubscanIntent.", tableName);
9569 0 : }
9570 :
9571 0 : return result;
9572 0 : }
9573 :
9574 0 : vector<vector<SubscanIntentMod::SubscanIntent> > EnumerationParser::getSubscanIntent2D(const string &name, const string &tableName, const string &xmlDoc) {
9575 0 : vector<vector<SubscanIntentMod::SubscanIntent> > result;
9576 :
9577 0 : string s = getField(xmlDoc,name);
9578 0 : if (s.length() == 0)
9579 0 : throw ConversionException("Error: Missing field \"" +
9580 0 : name + "\" or invalid syntax",tableName);
9581 :
9582 0 : istringstream iss;
9583 0 : iss.str(s);
9584 0 : vector<string> tokens;
9585 :
9586 : // Tokenize.
9587 0 : string buf;
9588 0 : while (iss >> buf) {
9589 0 : tokens.push_back(buf);
9590 : }
9591 :
9592 : // The length must be 3 at the minimum (there may be an empty array)
9593 0 : if (tokens.size() < 3)
9594 0 : throw ConversionException("Error: missing values in field \"" +
9595 0 : name + "\" or invalid syntax(" + s +"')",tableName);
9596 :
9597 :
9598 : // The number of dimension should be 2.
9599 0 : if (tokens.at(0) != "2")
9600 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
9601 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9602 :
9603 : // Then parse the size of the two dimensions
9604 0 : errno = 0;
9605 0 : int size1 = atoi(tokens.at(1).c_str());
9606 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9607 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9608 :
9609 0 : if (size1 <= 0)
9610 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9611 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9612 0 : errno = 0;
9613 0 : int size2 = atoi(tokens.at(2).c_str());
9614 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9615 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9616 :
9617 0 : if (size2 < 0)
9618 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
9619 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9620 :
9621 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
9622 0 : throw ConversionException("Error: incorrect number of values in field \"" +
9623 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9624 :
9625 0 : int k = 3;
9626 : try {
9627 0 : vector<SubscanIntentMod::SubscanIntent> v_aux;
9628 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
9629 0 : v_aux.clear();
9630 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
9631 0 : v_aux.push_back(CSubscanIntent::newSubscanIntent(tokens.at(k).c_str()));
9632 0 : k++;
9633 : }
9634 0 : result.push_back(v_aux);
9635 : }
9636 0 : }
9637 0 : catch (...) {
9638 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SubscanIntent.", tableName);
9639 0 : }
9640 0 : return result;
9641 0 : }
9642 :
9643 :
9644 0 : vector<vector<vector<SubscanIntentMod::SubscanIntent> > > EnumerationParser::getSubscanIntent3D(const string &name, const string &tableName, const string &xmlDoc) {
9645 0 : vector<vector<vector<SubscanIntentMod::SubscanIntent> > >result;
9646 :
9647 0 : string s = getField(xmlDoc,name);
9648 0 : if (s.length() == 0)
9649 0 : throw ConversionException("Error: Missing field \"" +
9650 0 : name + "\" or invalid syntax",tableName);
9651 :
9652 0 : istringstream iss;
9653 0 : iss.str(s);
9654 0 : vector<string> tokens;
9655 :
9656 : // Tokenize.
9657 0 : string buf;
9658 0 : while (iss >> buf) {
9659 0 : tokens.push_back(buf);
9660 : }
9661 :
9662 : // The length must be 4 at the minimum (there may be an empty array)
9663 0 : if (tokens.size() < 4)
9664 0 : throw ConversionException("Error: missing values in field \"" +
9665 0 : name + "\" or invalid syntax(" + s +"')",tableName);
9666 :
9667 :
9668 : // The number of dimension should be 3.
9669 0 : if (tokens.at(0) != "3")
9670 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
9671 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9672 :
9673 : // Then parse the size of the three dimensions
9674 0 : errno = 0;
9675 0 : int size1 = atoi(tokens.at(1).c_str());
9676 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9677 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9678 :
9679 0 : if (size1 <= 0)
9680 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9681 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9682 :
9683 0 : errno = 0;
9684 0 : int size2 = atoi(tokens.at(2).c_str());
9685 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9686 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9687 :
9688 0 : if (size2 <= 0)
9689 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9690 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9691 :
9692 0 : errno = 0;
9693 0 : int size3 = atoi(tokens.at(3).c_str());
9694 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9695 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9696 :
9697 :
9698 0 : if (size3 < 0)
9699 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
9700 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9701 :
9702 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
9703 0 : throw ConversionException("Error: incorrect number of values in field \"" +
9704 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9705 :
9706 0 : int k = 4;
9707 : try {
9708 0 : vector<SubscanIntentMod::SubscanIntent> v_aux;
9709 0 : vector<vector<SubscanIntentMod::SubscanIntent> > vv_aux;
9710 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
9711 0 : vv_aux.clear();
9712 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
9713 0 : v_aux.clear();
9714 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
9715 0 : v_aux.push_back(CSubscanIntent::newSubscanIntent(tokens.at(k).c_str()));
9716 0 : k++;
9717 : }
9718 0 : vv_aux.push_back(v_aux);
9719 : }
9720 0 : result.push_back(vv_aux);
9721 : }
9722 0 : }
9723 0 : catch (...) {
9724 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a SubscanIntent.", tableName);
9725 0 : }
9726 :
9727 0 : return result;
9728 0 : }
9729 :
9730 :
9731 :
9732 :
9733 :
9734 0 : string EnumerationParser::toXML(const string& elementName, SwitchingModeMod::SwitchingMode e) {
9735 0 : return "<"+elementName+">"+CSwitchingMode::name(e)+"</"+elementName+">";
9736 : }
9737 :
9738 0 : string EnumerationParser::toXML(const string& elementName, const vector<SwitchingModeMod::SwitchingMode>& v_e) {
9739 0 : ostringstream oss;
9740 : oss << "<" << elementName << ">"
9741 : << " 1"
9742 0 : << " " << v_e.size();
9743 :
9744 0 : for (unsigned int i = 0; i < v_e.size(); i++)
9745 0 : oss << " " << CSwitchingMode::name(v_e.at(i));
9746 0 : oss << "</" << elementName << ">";
9747 0 : return oss.str();
9748 0 : }
9749 :
9750 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<SwitchingModeMod::SwitchingMode> >& vv_e) {
9751 0 : ostringstream oss;
9752 : oss << "<" << elementName << ">"
9753 : << " 2"
9754 0 : << " " <<vv_e.size()
9755 0 : << " " <<vv_e.at(0).size();
9756 :
9757 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
9758 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
9759 0 : oss << " " << CSwitchingMode::name(vv_e.at(i).at(j));
9760 0 : oss << "</" << elementName << ">";
9761 0 : return oss.str();
9762 0 : }
9763 :
9764 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<SwitchingModeMod::SwitchingMode> > >& vvv_e) {
9765 0 : ostringstream oss;
9766 : oss << "<" << elementName << ">"
9767 : << " 3"
9768 0 : << " " <<vvv_e.size()
9769 0 : << " " <<vvv_e.at(0).size()
9770 0 : << " " <<vvv_e.at(0).at(0).size();
9771 :
9772 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
9773 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
9774 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
9775 0 : oss << " " << CSwitchingMode::name(vvv_e.at(i).at(j).at(k));
9776 0 : oss << "</" << elementName << ">";
9777 0 : return oss.str();
9778 0 : }
9779 :
9780 7275 : SwitchingModeMod::SwitchingMode EnumerationParser::getSwitchingMode(const string &name, const string &tableName, const string &xmlDoc) {
9781 7275 : string s = getField(xmlDoc,name);
9782 7275 : if (s.length() == 0)
9783 0 : throw ConversionException("Error: Missing field \"" +
9784 0 : name + "\" or invalid syntax",tableName);
9785 :
9786 : SwitchingMode result;
9787 : try {
9788 7275 : result = CSwitchingMode::newSwitchingMode(s);
9789 : }
9790 0 : catch (...) {
9791 0 : throw ConversionException("Error: could not convert '"+s+"' into a SwitchingMode.", tableName);
9792 0 : }
9793 7275 : return result;
9794 7275 : }
9795 :
9796 0 : vector<SwitchingModeMod::SwitchingMode> EnumerationParser::getSwitchingMode1D(const string &name, const string &tableName, const string &xmlDoc) {
9797 0 : vector<SwitchingModeMod::SwitchingMode> result;
9798 :
9799 0 : string s = getField(xmlDoc,name);
9800 0 : if (s.length() == 0)
9801 0 : throw ConversionException("Error: Missing field \"" +
9802 0 : name + "\" or invalid syntax",tableName);
9803 :
9804 0 : istringstream iss;
9805 0 : iss.str(s);
9806 0 : vector<string> tokens;
9807 :
9808 : // Tokenize.
9809 0 : string buf;
9810 0 : while (iss >> buf) {
9811 0 : tokens.push_back(buf);
9812 : }
9813 :
9814 : // The length must be 2 at the minimum (there may be an empty array)
9815 0 : if (tokens.size() < 2)
9816 0 : throw ConversionException("Error: missing values in field \"" +
9817 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9818 :
9819 :
9820 :
9821 : // The number of dimension should be 1.
9822 0 : if (tokens.at(0) != "1")
9823 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
9824 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9825 :
9826 : // Then parse the size of the unique dimension
9827 0 : errno = 0;
9828 0 : int size1 = atoi(tokens.at(1).c_str());
9829 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9830 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9831 :
9832 0 : if (size1 < 0)
9833 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
9834 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9835 :
9836 0 : if (tokens.size() != (unsigned int) (size1 + 2))
9837 0 : throw ConversionException("Error: incorrect number of values in field \"" +
9838 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9839 :
9840 0 : int k = 2;
9841 : try {
9842 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
9843 0 : result.push_back(CSwitchingMode::newSwitchingMode(tokens.at(k).c_str()));
9844 0 : k++;
9845 : }
9846 : }
9847 0 : catch (...) {
9848 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SwitchingMode.", tableName);
9849 0 : }
9850 :
9851 0 : return result;
9852 0 : }
9853 :
9854 0 : vector<vector<SwitchingModeMod::SwitchingMode> > EnumerationParser::getSwitchingMode2D(const string &name, const string &tableName, const string &xmlDoc) {
9855 0 : vector<vector<SwitchingModeMod::SwitchingMode> > result;
9856 :
9857 0 : string s = getField(xmlDoc,name);
9858 0 : if (s.length() == 0)
9859 0 : throw ConversionException("Error: Missing field \"" +
9860 0 : name + "\" or invalid syntax",tableName);
9861 :
9862 0 : istringstream iss;
9863 0 : iss.str(s);
9864 0 : vector<string> tokens;
9865 :
9866 : // Tokenize.
9867 0 : string buf;
9868 0 : while (iss >> buf) {
9869 0 : tokens.push_back(buf);
9870 : }
9871 :
9872 : // The length must be 3 at the minimum (there may be an empty array)
9873 0 : if (tokens.size() < 3)
9874 0 : throw ConversionException("Error: missing values in field \"" +
9875 0 : name + "\" or invalid syntax(" + s +"')",tableName);
9876 :
9877 :
9878 : // The number of dimension should be 2.
9879 0 : if (tokens.at(0) != "2")
9880 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
9881 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9882 :
9883 : // Then parse the size of the two dimensions
9884 0 : errno = 0;
9885 0 : int size1 = atoi(tokens.at(1).c_str());
9886 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9887 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9888 :
9889 0 : if (size1 <= 0)
9890 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9891 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9892 0 : errno = 0;
9893 0 : int size2 = atoi(tokens.at(2).c_str());
9894 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9895 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9896 :
9897 0 : if (size2 < 0)
9898 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
9899 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9900 :
9901 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
9902 0 : throw ConversionException("Error: incorrect number of values in field \"" +
9903 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9904 :
9905 0 : int k = 3;
9906 : try {
9907 0 : vector<SwitchingModeMod::SwitchingMode> v_aux;
9908 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
9909 0 : v_aux.clear();
9910 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
9911 0 : v_aux.push_back(CSwitchingMode::newSwitchingMode(tokens.at(k).c_str()));
9912 0 : k++;
9913 : }
9914 0 : result.push_back(v_aux);
9915 : }
9916 0 : }
9917 0 : catch (...) {
9918 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SwitchingMode.", tableName);
9919 0 : }
9920 0 : return result;
9921 0 : }
9922 :
9923 :
9924 0 : vector<vector<vector<SwitchingModeMod::SwitchingMode> > > EnumerationParser::getSwitchingMode3D(const string &name, const string &tableName, const string &xmlDoc) {
9925 0 : vector<vector<vector<SwitchingModeMod::SwitchingMode> > >result;
9926 :
9927 0 : string s = getField(xmlDoc,name);
9928 0 : if (s.length() == 0)
9929 0 : throw ConversionException("Error: Missing field \"" +
9930 0 : name + "\" or invalid syntax",tableName);
9931 :
9932 0 : istringstream iss;
9933 0 : iss.str(s);
9934 0 : vector<string> tokens;
9935 :
9936 : // Tokenize.
9937 0 : string buf;
9938 0 : while (iss >> buf) {
9939 0 : tokens.push_back(buf);
9940 : }
9941 :
9942 : // The length must be 4 at the minimum (there may be an empty array)
9943 0 : if (tokens.size() < 4)
9944 0 : throw ConversionException("Error: missing values in field \"" +
9945 0 : name + "\" or invalid syntax(" + s +"')",tableName);
9946 :
9947 :
9948 : // The number of dimension should be 3.
9949 0 : if (tokens.at(0) != "3")
9950 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
9951 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9952 :
9953 : // Then parse the size of the three dimensions
9954 0 : errno = 0;
9955 0 : int size1 = atoi(tokens.at(1).c_str());
9956 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9957 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9958 :
9959 0 : if (size1 <= 0)
9960 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9961 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9962 :
9963 0 : errno = 0;
9964 0 : int size2 = atoi(tokens.at(2).c_str());
9965 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9966 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9967 :
9968 0 : if (size2 <= 0)
9969 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
9970 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9971 :
9972 0 : errno = 0;
9973 0 : int size3 = atoi(tokens.at(3).c_str());
9974 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
9975 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
9976 :
9977 :
9978 0 : if (size3 < 0)
9979 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
9980 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9981 :
9982 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
9983 0 : throw ConversionException("Error: incorrect number of values in field \"" +
9984 0 : name + "\" or invalid syntax('" + s +"')",tableName);
9985 :
9986 0 : int k = 4;
9987 : try {
9988 0 : vector<SwitchingModeMod::SwitchingMode> v_aux;
9989 0 : vector<vector<SwitchingModeMod::SwitchingMode> > vv_aux;
9990 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
9991 0 : vv_aux.clear();
9992 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
9993 0 : v_aux.clear();
9994 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
9995 0 : v_aux.push_back(CSwitchingMode::newSwitchingMode(tokens.at(k).c_str()));
9996 0 : k++;
9997 : }
9998 0 : vv_aux.push_back(v_aux);
9999 : }
10000 0 : result.push_back(vv_aux);
10001 : }
10002 0 : }
10003 0 : catch (...) {
10004 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a SwitchingMode.", tableName);
10005 0 : }
10006 :
10007 0 : return result;
10008 0 : }
10009 :
10010 :
10011 :
10012 :
10013 :
10014 0 : string EnumerationParser::toXML(const string& elementName, CorrelatorCalibrationMod::CorrelatorCalibration e) {
10015 0 : return "<"+elementName+">"+CCorrelatorCalibration::name(e)+"</"+elementName+">";
10016 : }
10017 :
10018 0 : string EnumerationParser::toXML(const string& elementName, const vector<CorrelatorCalibrationMod::CorrelatorCalibration>& v_e) {
10019 0 : ostringstream oss;
10020 : oss << "<" << elementName << ">"
10021 : << " 1"
10022 0 : << " " << v_e.size();
10023 :
10024 0 : for (unsigned int i = 0; i < v_e.size(); i++)
10025 0 : oss << " " << CCorrelatorCalibration::name(v_e.at(i));
10026 0 : oss << "</" << elementName << ">";
10027 0 : return oss.str();
10028 0 : }
10029 :
10030 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CorrelatorCalibrationMod::CorrelatorCalibration> >& vv_e) {
10031 0 : ostringstream oss;
10032 : oss << "<" << elementName << ">"
10033 : << " 2"
10034 0 : << " " <<vv_e.size()
10035 0 : << " " <<vv_e.at(0).size();
10036 :
10037 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
10038 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
10039 0 : oss << " " << CCorrelatorCalibration::name(vv_e.at(i).at(j));
10040 0 : oss << "</" << elementName << ">";
10041 0 : return oss.str();
10042 0 : }
10043 :
10044 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CorrelatorCalibrationMod::CorrelatorCalibration> > >& vvv_e) {
10045 0 : ostringstream oss;
10046 : oss << "<" << elementName << ">"
10047 : << " 3"
10048 0 : << " " <<vvv_e.size()
10049 0 : << " " <<vvv_e.at(0).size()
10050 0 : << " " <<vvv_e.at(0).at(0).size();
10051 :
10052 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
10053 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
10054 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
10055 0 : oss << " " << CCorrelatorCalibration::name(vvv_e.at(i).at(j).at(k));
10056 0 : oss << "</" << elementName << ">";
10057 0 : return oss.str();
10058 0 : }
10059 :
10060 7275 : CorrelatorCalibrationMod::CorrelatorCalibration EnumerationParser::getCorrelatorCalibration(const string &name, const string &tableName, const string &xmlDoc) {
10061 7275 : string s = getField(xmlDoc,name);
10062 7275 : if (s.length() == 0)
10063 0 : throw ConversionException("Error: Missing field \"" +
10064 0 : name + "\" or invalid syntax",tableName);
10065 :
10066 : CorrelatorCalibration result;
10067 : try {
10068 7275 : result = CCorrelatorCalibration::newCorrelatorCalibration(s);
10069 : }
10070 0 : catch (...) {
10071 0 : throw ConversionException("Error: could not convert '"+s+"' into a CorrelatorCalibration.", tableName);
10072 0 : }
10073 7275 : return result;
10074 7275 : }
10075 :
10076 0 : vector<CorrelatorCalibrationMod::CorrelatorCalibration> EnumerationParser::getCorrelatorCalibration1D(const string &name, const string &tableName, const string &xmlDoc) {
10077 0 : vector<CorrelatorCalibrationMod::CorrelatorCalibration> result;
10078 :
10079 0 : string s = getField(xmlDoc,name);
10080 0 : if (s.length() == 0)
10081 0 : throw ConversionException("Error: Missing field \"" +
10082 0 : name + "\" or invalid syntax",tableName);
10083 :
10084 0 : istringstream iss;
10085 0 : iss.str(s);
10086 0 : vector<string> tokens;
10087 :
10088 : // Tokenize.
10089 0 : string buf;
10090 0 : while (iss >> buf) {
10091 0 : tokens.push_back(buf);
10092 : }
10093 :
10094 : // The length must be 2 at the minimum (there may be an empty array)
10095 0 : if (tokens.size() < 2)
10096 0 : throw ConversionException("Error: missing values in field \"" +
10097 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10098 :
10099 :
10100 :
10101 : // The number of dimension should be 1.
10102 0 : if (tokens.at(0) != "1")
10103 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
10104 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10105 :
10106 : // Then parse the size of the unique dimension
10107 0 : errno = 0;
10108 0 : int size1 = atoi(tokens.at(1).c_str());
10109 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10110 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10111 :
10112 0 : if (size1 < 0)
10113 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
10114 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10115 :
10116 0 : if (tokens.size() != (unsigned int) (size1 + 2))
10117 0 : throw ConversionException("Error: incorrect number of values in field \"" +
10118 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10119 :
10120 0 : int k = 2;
10121 : try {
10122 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
10123 0 : result.push_back(CCorrelatorCalibration::newCorrelatorCalibration(tokens.at(k).c_str()));
10124 0 : k++;
10125 : }
10126 : }
10127 0 : catch (...) {
10128 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelatorCalibration.", tableName);
10129 0 : }
10130 :
10131 0 : return result;
10132 0 : }
10133 :
10134 0 : vector<vector<CorrelatorCalibrationMod::CorrelatorCalibration> > EnumerationParser::getCorrelatorCalibration2D(const string &name, const string &tableName, const string &xmlDoc) {
10135 0 : vector<vector<CorrelatorCalibrationMod::CorrelatorCalibration> > result;
10136 :
10137 0 : string s = getField(xmlDoc,name);
10138 0 : if (s.length() == 0)
10139 0 : throw ConversionException("Error: Missing field \"" +
10140 0 : name + "\" or invalid syntax",tableName);
10141 :
10142 0 : istringstream iss;
10143 0 : iss.str(s);
10144 0 : vector<string> tokens;
10145 :
10146 : // Tokenize.
10147 0 : string buf;
10148 0 : while (iss >> buf) {
10149 0 : tokens.push_back(buf);
10150 : }
10151 :
10152 : // The length must be 3 at the minimum (there may be an empty array)
10153 0 : if (tokens.size() < 3)
10154 0 : throw ConversionException("Error: missing values in field \"" +
10155 0 : name + "\" or invalid syntax(" + s +"')",tableName);
10156 :
10157 :
10158 : // The number of dimension should be 2.
10159 0 : if (tokens.at(0) != "2")
10160 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
10161 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10162 :
10163 : // Then parse the size of the two dimensions
10164 0 : errno = 0;
10165 0 : int size1 = atoi(tokens.at(1).c_str());
10166 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10167 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10168 :
10169 0 : if (size1 <= 0)
10170 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
10171 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10172 0 : errno = 0;
10173 0 : int size2 = atoi(tokens.at(2).c_str());
10174 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10175 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10176 :
10177 0 : if (size2 < 0)
10178 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
10179 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10180 :
10181 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
10182 0 : throw ConversionException("Error: incorrect number of values in field \"" +
10183 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10184 :
10185 0 : int k = 3;
10186 : try {
10187 0 : vector<CorrelatorCalibrationMod::CorrelatorCalibration> v_aux;
10188 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
10189 0 : v_aux.clear();
10190 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
10191 0 : v_aux.push_back(CCorrelatorCalibration::newCorrelatorCalibration(tokens.at(k).c_str()));
10192 0 : k++;
10193 : }
10194 0 : result.push_back(v_aux);
10195 : }
10196 0 : }
10197 0 : catch (...) {
10198 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelatorCalibration.", tableName);
10199 0 : }
10200 0 : return result;
10201 0 : }
10202 :
10203 :
10204 0 : vector<vector<vector<CorrelatorCalibrationMod::CorrelatorCalibration> > > EnumerationParser::getCorrelatorCalibration3D(const string &name, const string &tableName, const string &xmlDoc) {
10205 0 : vector<vector<vector<CorrelatorCalibrationMod::CorrelatorCalibration> > >result;
10206 :
10207 0 : string s = getField(xmlDoc,name);
10208 0 : if (s.length() == 0)
10209 0 : throw ConversionException("Error: Missing field \"" +
10210 0 : name + "\" or invalid syntax",tableName);
10211 :
10212 0 : istringstream iss;
10213 0 : iss.str(s);
10214 0 : vector<string> tokens;
10215 :
10216 : // Tokenize.
10217 0 : string buf;
10218 0 : while (iss >> buf) {
10219 0 : tokens.push_back(buf);
10220 : }
10221 :
10222 : // The length must be 4 at the minimum (there may be an empty array)
10223 0 : if (tokens.size() < 4)
10224 0 : throw ConversionException("Error: missing values in field \"" +
10225 0 : name + "\" or invalid syntax(" + s +"')",tableName);
10226 :
10227 :
10228 : // The number of dimension should be 3.
10229 0 : if (tokens.at(0) != "3")
10230 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
10231 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10232 :
10233 : // Then parse the size of the three dimensions
10234 0 : errno = 0;
10235 0 : int size1 = atoi(tokens.at(1).c_str());
10236 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10237 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10238 :
10239 0 : if (size1 <= 0)
10240 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
10241 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10242 :
10243 0 : errno = 0;
10244 0 : int size2 = atoi(tokens.at(2).c_str());
10245 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10246 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10247 :
10248 0 : if (size2 <= 0)
10249 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
10250 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10251 :
10252 0 : errno = 0;
10253 0 : int size3 = atoi(tokens.at(3).c_str());
10254 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10255 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10256 :
10257 :
10258 0 : if (size3 < 0)
10259 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
10260 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10261 :
10262 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
10263 0 : throw ConversionException("Error: incorrect number of values in field \"" +
10264 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10265 :
10266 0 : int k = 4;
10267 : try {
10268 0 : vector<CorrelatorCalibrationMod::CorrelatorCalibration> v_aux;
10269 0 : vector<vector<CorrelatorCalibrationMod::CorrelatorCalibration> > vv_aux;
10270 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
10271 0 : vv_aux.clear();
10272 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
10273 0 : v_aux.clear();
10274 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
10275 0 : v_aux.push_back(CCorrelatorCalibration::newCorrelatorCalibration(tokens.at(k).c_str()));
10276 0 : k++;
10277 : }
10278 0 : vv_aux.push_back(v_aux);
10279 : }
10280 0 : result.push_back(vv_aux);
10281 : }
10282 0 : }
10283 0 : catch (...) {
10284 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelatorCalibration.", tableName);
10285 0 : }
10286 :
10287 0 : return result;
10288 0 : }
10289 :
10290 :
10291 :
10292 :
10293 :
10294 536 : string EnumerationParser::toXML(const string& elementName, TimeSamplingMod::TimeSampling e) {
10295 1072 : return "<"+elementName+">"+CTimeSampling::name(e)+"</"+elementName+">";
10296 : }
10297 :
10298 0 : string EnumerationParser::toXML(const string& elementName, const vector<TimeSamplingMod::TimeSampling>& v_e) {
10299 0 : ostringstream oss;
10300 : oss << "<" << elementName << ">"
10301 : << " 1"
10302 0 : << " " << v_e.size();
10303 :
10304 0 : for (unsigned int i = 0; i < v_e.size(); i++)
10305 0 : oss << " " << CTimeSampling::name(v_e.at(i));
10306 0 : oss << "</" << elementName << ">";
10307 0 : return oss.str();
10308 0 : }
10309 :
10310 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<TimeSamplingMod::TimeSampling> >& vv_e) {
10311 0 : ostringstream oss;
10312 : oss << "<" << elementName << ">"
10313 : << " 2"
10314 0 : << " " <<vv_e.size()
10315 0 : << " " <<vv_e.at(0).size();
10316 :
10317 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
10318 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
10319 0 : oss << " " << CTimeSampling::name(vv_e.at(i).at(j));
10320 0 : oss << "</" << elementName << ">";
10321 0 : return oss.str();
10322 0 : }
10323 :
10324 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<TimeSamplingMod::TimeSampling> > >& vvv_e) {
10325 0 : ostringstream oss;
10326 : oss << "<" << elementName << ">"
10327 : << " 3"
10328 0 : << " " <<vvv_e.size()
10329 0 : << " " <<vvv_e.at(0).size()
10330 0 : << " " <<vvv_e.at(0).at(0).size();
10331 :
10332 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
10333 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
10334 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
10335 0 : oss << " " << CTimeSampling::name(vvv_e.at(i).at(j).at(k));
10336 0 : oss << "</" << elementName << ">";
10337 0 : return oss.str();
10338 0 : }
10339 :
10340 7737 : TimeSamplingMod::TimeSampling EnumerationParser::getTimeSampling(const string &name, const string &tableName, const string &xmlDoc) {
10341 7737 : string s = getField(xmlDoc,name);
10342 7737 : if (s.length() == 0)
10343 0 : throw ConversionException("Error: Missing field \"" +
10344 0 : name + "\" or invalid syntax",tableName);
10345 :
10346 : TimeSampling result;
10347 : try {
10348 7737 : result = CTimeSampling::newTimeSampling(s);
10349 : }
10350 0 : catch (...) {
10351 0 : throw ConversionException("Error: could not convert '"+s+"' into a TimeSampling.", tableName);
10352 0 : }
10353 7737 : return result;
10354 7737 : }
10355 :
10356 0 : vector<TimeSamplingMod::TimeSampling> EnumerationParser::getTimeSampling1D(const string &name, const string &tableName, const string &xmlDoc) {
10357 0 : vector<TimeSamplingMod::TimeSampling> result;
10358 :
10359 0 : string s = getField(xmlDoc,name);
10360 0 : if (s.length() == 0)
10361 0 : throw ConversionException("Error: Missing field \"" +
10362 0 : name + "\" or invalid syntax",tableName);
10363 :
10364 0 : istringstream iss;
10365 0 : iss.str(s);
10366 0 : vector<string> tokens;
10367 :
10368 : // Tokenize.
10369 0 : string buf;
10370 0 : while (iss >> buf) {
10371 0 : tokens.push_back(buf);
10372 : }
10373 :
10374 : // The length must be 2 at the minimum (there may be an empty array)
10375 0 : if (tokens.size() < 2)
10376 0 : throw ConversionException("Error: missing values in field \"" +
10377 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10378 :
10379 :
10380 :
10381 : // The number of dimension should be 1.
10382 0 : if (tokens.at(0) != "1")
10383 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
10384 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10385 :
10386 : // Then parse the size of the unique dimension
10387 0 : errno = 0;
10388 0 : int size1 = atoi(tokens.at(1).c_str());
10389 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10390 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10391 :
10392 0 : if (size1 < 0)
10393 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
10394 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10395 :
10396 0 : if (tokens.size() != (unsigned int) (size1 + 2))
10397 0 : throw ConversionException("Error: incorrect number of values in field \"" +
10398 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10399 :
10400 0 : int k = 2;
10401 : try {
10402 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
10403 0 : result.push_back(CTimeSampling::newTimeSampling(tokens.at(k).c_str()));
10404 0 : k++;
10405 : }
10406 : }
10407 0 : catch (...) {
10408 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a TimeSampling.", tableName);
10409 0 : }
10410 :
10411 0 : return result;
10412 0 : }
10413 :
10414 0 : vector<vector<TimeSamplingMod::TimeSampling> > EnumerationParser::getTimeSampling2D(const string &name, const string &tableName, const string &xmlDoc) {
10415 0 : vector<vector<TimeSamplingMod::TimeSampling> > result;
10416 :
10417 0 : string s = getField(xmlDoc,name);
10418 0 : if (s.length() == 0)
10419 0 : throw ConversionException("Error: Missing field \"" +
10420 0 : name + "\" or invalid syntax",tableName);
10421 :
10422 0 : istringstream iss;
10423 0 : iss.str(s);
10424 0 : vector<string> tokens;
10425 :
10426 : // Tokenize.
10427 0 : string buf;
10428 0 : while (iss >> buf) {
10429 0 : tokens.push_back(buf);
10430 : }
10431 :
10432 : // The length must be 3 at the minimum (there may be an empty array)
10433 0 : if (tokens.size() < 3)
10434 0 : throw ConversionException("Error: missing values in field \"" +
10435 0 : name + "\" or invalid syntax(" + s +"')",tableName);
10436 :
10437 :
10438 : // The number of dimension should be 2.
10439 0 : if (tokens.at(0) != "2")
10440 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
10441 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10442 :
10443 : // Then parse the size of the two dimensions
10444 0 : errno = 0;
10445 0 : int size1 = atoi(tokens.at(1).c_str());
10446 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10447 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10448 :
10449 0 : if (size1 <= 0)
10450 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
10451 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10452 0 : errno = 0;
10453 0 : int size2 = atoi(tokens.at(2).c_str());
10454 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10455 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10456 :
10457 0 : if (size2 < 0)
10458 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
10459 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10460 :
10461 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
10462 0 : throw ConversionException("Error: incorrect number of values in field \"" +
10463 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10464 :
10465 0 : int k = 3;
10466 : try {
10467 0 : vector<TimeSamplingMod::TimeSampling> v_aux;
10468 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
10469 0 : v_aux.clear();
10470 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
10471 0 : v_aux.push_back(CTimeSampling::newTimeSampling(tokens.at(k).c_str()));
10472 0 : k++;
10473 : }
10474 0 : result.push_back(v_aux);
10475 : }
10476 0 : }
10477 0 : catch (...) {
10478 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a TimeSampling.", tableName);
10479 0 : }
10480 0 : return result;
10481 0 : }
10482 :
10483 :
10484 0 : vector<vector<vector<TimeSamplingMod::TimeSampling> > > EnumerationParser::getTimeSampling3D(const string &name, const string &tableName, const string &xmlDoc) {
10485 0 : vector<vector<vector<TimeSamplingMod::TimeSampling> > >result;
10486 :
10487 0 : string s = getField(xmlDoc,name);
10488 0 : if (s.length() == 0)
10489 0 : throw ConversionException("Error: Missing field \"" +
10490 0 : name + "\" or invalid syntax",tableName);
10491 :
10492 0 : istringstream iss;
10493 0 : iss.str(s);
10494 0 : vector<string> tokens;
10495 :
10496 : // Tokenize.
10497 0 : string buf;
10498 0 : while (iss >> buf) {
10499 0 : tokens.push_back(buf);
10500 : }
10501 :
10502 : // The length must be 4 at the minimum (there may be an empty array)
10503 0 : if (tokens.size() < 4)
10504 0 : throw ConversionException("Error: missing values in field \"" +
10505 0 : name + "\" or invalid syntax(" + s +"')",tableName);
10506 :
10507 :
10508 : // The number of dimension should be 3.
10509 0 : if (tokens.at(0) != "3")
10510 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
10511 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10512 :
10513 : // Then parse the size of the three dimensions
10514 0 : errno = 0;
10515 0 : int size1 = atoi(tokens.at(1).c_str());
10516 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10517 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10518 :
10519 0 : if (size1 <= 0)
10520 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
10521 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10522 :
10523 0 : errno = 0;
10524 0 : int size2 = atoi(tokens.at(2).c_str());
10525 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10526 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10527 :
10528 0 : if (size2 <= 0)
10529 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
10530 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10531 :
10532 0 : errno = 0;
10533 0 : int size3 = atoi(tokens.at(3).c_str());
10534 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10535 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10536 :
10537 :
10538 0 : if (size3 < 0)
10539 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
10540 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10541 :
10542 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
10543 0 : throw ConversionException("Error: incorrect number of values in field \"" +
10544 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10545 :
10546 0 : int k = 4;
10547 : try {
10548 0 : vector<TimeSamplingMod::TimeSampling> v_aux;
10549 0 : vector<vector<TimeSamplingMod::TimeSampling> > vv_aux;
10550 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
10551 0 : vv_aux.clear();
10552 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
10553 0 : v_aux.clear();
10554 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
10555 0 : v_aux.push_back(CTimeSampling::newTimeSampling(tokens.at(k).c_str()));
10556 0 : k++;
10557 : }
10558 0 : vv_aux.push_back(v_aux);
10559 : }
10560 0 : result.push_back(vv_aux);
10561 : }
10562 0 : }
10563 0 : catch (...) {
10564 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a TimeSampling.", tableName);
10565 0 : }
10566 :
10567 0 : return result;
10568 0 : }
10569 :
10570 :
10571 :
10572 :
10573 :
10574 0 : string EnumerationParser::toXML(const string& elementName, CalTypeMod::CalType e) {
10575 0 : return "<"+elementName+">"+CCalType::name(e)+"</"+elementName+">";
10576 : }
10577 :
10578 0 : string EnumerationParser::toXML(const string& elementName, const vector<CalTypeMod::CalType>& v_e) {
10579 0 : ostringstream oss;
10580 : oss << "<" << elementName << ">"
10581 : << " 1"
10582 0 : << " " << v_e.size();
10583 :
10584 0 : for (unsigned int i = 0; i < v_e.size(); i++)
10585 0 : oss << " " << CCalType::name(v_e.at(i));
10586 0 : oss << "</" << elementName << ">";
10587 0 : return oss.str();
10588 0 : }
10589 :
10590 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CalTypeMod::CalType> >& vv_e) {
10591 0 : ostringstream oss;
10592 : oss << "<" << elementName << ">"
10593 : << " 2"
10594 0 : << " " <<vv_e.size()
10595 0 : << " " <<vv_e.at(0).size();
10596 :
10597 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
10598 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
10599 0 : oss << " " << CCalType::name(vv_e.at(i).at(j));
10600 0 : oss << "</" << elementName << ">";
10601 0 : return oss.str();
10602 0 : }
10603 :
10604 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CalTypeMod::CalType> > >& vvv_e) {
10605 0 : ostringstream oss;
10606 : oss << "<" << elementName << ">"
10607 : << " 3"
10608 0 : << " " <<vvv_e.size()
10609 0 : << " " <<vvv_e.at(0).size()
10610 0 : << " " <<vvv_e.at(0).at(0).size();
10611 :
10612 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
10613 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
10614 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
10615 0 : oss << " " << CCalType::name(vvv_e.at(i).at(j).at(k));
10616 0 : oss << "</" << elementName << ">";
10617 0 : return oss.str();
10618 0 : }
10619 :
10620 47 : CalTypeMod::CalType EnumerationParser::getCalType(const string &name, const string &tableName, const string &xmlDoc) {
10621 47 : string s = getField(xmlDoc,name);
10622 47 : if (s.length() == 0)
10623 0 : throw ConversionException("Error: Missing field \"" +
10624 0 : name + "\" or invalid syntax",tableName);
10625 :
10626 : CalType result;
10627 : try {
10628 47 : result = CCalType::newCalType(s);
10629 : }
10630 0 : catch (...) {
10631 0 : throw ConversionException("Error: could not convert '"+s+"' into a CalType.", tableName);
10632 0 : }
10633 47 : return result;
10634 47 : }
10635 :
10636 0 : vector<CalTypeMod::CalType> EnumerationParser::getCalType1D(const string &name, const string &tableName, const string &xmlDoc) {
10637 0 : vector<CalTypeMod::CalType> result;
10638 :
10639 0 : string s = getField(xmlDoc,name);
10640 0 : if (s.length() == 0)
10641 0 : throw ConversionException("Error: Missing field \"" +
10642 0 : name + "\" or invalid syntax",tableName);
10643 :
10644 0 : istringstream iss;
10645 0 : iss.str(s);
10646 0 : vector<string> tokens;
10647 :
10648 : // Tokenize.
10649 0 : string buf;
10650 0 : while (iss >> buf) {
10651 0 : tokens.push_back(buf);
10652 : }
10653 :
10654 : // The length must be 2 at the minimum (there may be an empty array)
10655 0 : if (tokens.size() < 2)
10656 0 : throw ConversionException("Error: missing values in field \"" +
10657 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10658 :
10659 :
10660 :
10661 : // The number of dimension should be 1.
10662 0 : if (tokens.at(0) != "1")
10663 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
10664 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10665 :
10666 : // Then parse the size of the unique dimension
10667 0 : errno = 0;
10668 0 : int size1 = atoi(tokens.at(1).c_str());
10669 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10670 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10671 :
10672 0 : if (size1 < 0)
10673 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
10674 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10675 :
10676 0 : if (tokens.size() != (unsigned int) (size1 + 2))
10677 0 : throw ConversionException("Error: incorrect number of values in field \"" +
10678 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10679 :
10680 0 : int k = 2;
10681 : try {
10682 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
10683 0 : result.push_back(CCalType::newCalType(tokens.at(k).c_str()));
10684 0 : k++;
10685 : }
10686 : }
10687 0 : catch (...) {
10688 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalType.", tableName);
10689 0 : }
10690 :
10691 0 : return result;
10692 0 : }
10693 :
10694 0 : vector<vector<CalTypeMod::CalType> > EnumerationParser::getCalType2D(const string &name, const string &tableName, const string &xmlDoc) {
10695 0 : vector<vector<CalTypeMod::CalType> > result;
10696 :
10697 0 : string s = getField(xmlDoc,name);
10698 0 : if (s.length() == 0)
10699 0 : throw ConversionException("Error: Missing field \"" +
10700 0 : name + "\" or invalid syntax",tableName);
10701 :
10702 0 : istringstream iss;
10703 0 : iss.str(s);
10704 0 : vector<string> tokens;
10705 :
10706 : // Tokenize.
10707 0 : string buf;
10708 0 : while (iss >> buf) {
10709 0 : tokens.push_back(buf);
10710 : }
10711 :
10712 : // The length must be 3 at the minimum (there may be an empty array)
10713 0 : if (tokens.size() < 3)
10714 0 : throw ConversionException("Error: missing values in field \"" +
10715 0 : name + "\" or invalid syntax(" + s +"')",tableName);
10716 :
10717 :
10718 : // The number of dimension should be 2.
10719 0 : if (tokens.at(0) != "2")
10720 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
10721 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10722 :
10723 : // Then parse the size of the two dimensions
10724 0 : errno = 0;
10725 0 : int size1 = atoi(tokens.at(1).c_str());
10726 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10727 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10728 :
10729 0 : if (size1 <= 0)
10730 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
10731 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10732 0 : errno = 0;
10733 0 : int size2 = atoi(tokens.at(2).c_str());
10734 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10735 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10736 :
10737 0 : if (size2 < 0)
10738 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
10739 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10740 :
10741 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
10742 0 : throw ConversionException("Error: incorrect number of values in field \"" +
10743 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10744 :
10745 0 : int k = 3;
10746 : try {
10747 0 : vector<CalTypeMod::CalType> v_aux;
10748 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
10749 0 : v_aux.clear();
10750 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
10751 0 : v_aux.push_back(CCalType::newCalType(tokens.at(k).c_str()));
10752 0 : k++;
10753 : }
10754 0 : result.push_back(v_aux);
10755 : }
10756 0 : }
10757 0 : catch (...) {
10758 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalType.", tableName);
10759 0 : }
10760 0 : return result;
10761 0 : }
10762 :
10763 :
10764 0 : vector<vector<vector<CalTypeMod::CalType> > > EnumerationParser::getCalType3D(const string &name, const string &tableName, const string &xmlDoc) {
10765 0 : vector<vector<vector<CalTypeMod::CalType> > >result;
10766 :
10767 0 : string s = getField(xmlDoc,name);
10768 0 : if (s.length() == 0)
10769 0 : throw ConversionException("Error: Missing field \"" +
10770 0 : name + "\" or invalid syntax",tableName);
10771 :
10772 0 : istringstream iss;
10773 0 : iss.str(s);
10774 0 : vector<string> tokens;
10775 :
10776 : // Tokenize.
10777 0 : string buf;
10778 0 : while (iss >> buf) {
10779 0 : tokens.push_back(buf);
10780 : }
10781 :
10782 : // The length must be 4 at the minimum (there may be an empty array)
10783 0 : if (tokens.size() < 4)
10784 0 : throw ConversionException("Error: missing values in field \"" +
10785 0 : name + "\" or invalid syntax(" + s +"')",tableName);
10786 :
10787 :
10788 : // The number of dimension should be 3.
10789 0 : if (tokens.at(0) != "3")
10790 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
10791 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10792 :
10793 : // Then parse the size of the three dimensions
10794 0 : errno = 0;
10795 0 : int size1 = atoi(tokens.at(1).c_str());
10796 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10797 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10798 :
10799 0 : if (size1 <= 0)
10800 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
10801 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10802 :
10803 0 : errno = 0;
10804 0 : int size2 = atoi(tokens.at(2).c_str());
10805 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10806 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10807 :
10808 0 : if (size2 <= 0)
10809 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
10810 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10811 :
10812 0 : errno = 0;
10813 0 : int size3 = atoi(tokens.at(3).c_str());
10814 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10815 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10816 :
10817 :
10818 0 : if (size3 < 0)
10819 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
10820 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10821 :
10822 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
10823 0 : throw ConversionException("Error: incorrect number of values in field \"" +
10824 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10825 :
10826 0 : int k = 4;
10827 : try {
10828 0 : vector<CalTypeMod::CalType> v_aux;
10829 0 : vector<vector<CalTypeMod::CalType> > vv_aux;
10830 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
10831 0 : vv_aux.clear();
10832 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
10833 0 : v_aux.clear();
10834 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
10835 0 : v_aux.push_back(CCalType::newCalType(tokens.at(k).c_str()));
10836 0 : k++;
10837 : }
10838 0 : vv_aux.push_back(v_aux);
10839 : }
10840 0 : result.push_back(vv_aux);
10841 : }
10842 0 : }
10843 0 : catch (...) {
10844 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalType.", tableName);
10845 0 : }
10846 :
10847 0 : return result;
10848 0 : }
10849 :
10850 :
10851 :
10852 :
10853 :
10854 0 : string EnumerationParser::toXML(const string& elementName, AssociatedCalNatureMod::AssociatedCalNature e) {
10855 0 : return "<"+elementName+">"+CAssociatedCalNature::name(e)+"</"+elementName+">";
10856 : }
10857 :
10858 0 : string EnumerationParser::toXML(const string& elementName, const vector<AssociatedCalNatureMod::AssociatedCalNature>& v_e) {
10859 0 : ostringstream oss;
10860 : oss << "<" << elementName << ">"
10861 : << " 1"
10862 0 : << " " << v_e.size();
10863 :
10864 0 : for (unsigned int i = 0; i < v_e.size(); i++)
10865 0 : oss << " " << CAssociatedCalNature::name(v_e.at(i));
10866 0 : oss << "</" << elementName << ">";
10867 0 : return oss.str();
10868 0 : }
10869 :
10870 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<AssociatedCalNatureMod::AssociatedCalNature> >& vv_e) {
10871 0 : ostringstream oss;
10872 : oss << "<" << elementName << ">"
10873 : << " 2"
10874 0 : << " " <<vv_e.size()
10875 0 : << " " <<vv_e.at(0).size();
10876 :
10877 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
10878 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
10879 0 : oss << " " << CAssociatedCalNature::name(vv_e.at(i).at(j));
10880 0 : oss << "</" << elementName << ">";
10881 0 : return oss.str();
10882 0 : }
10883 :
10884 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<AssociatedCalNatureMod::AssociatedCalNature> > >& vvv_e) {
10885 0 : ostringstream oss;
10886 : oss << "<" << elementName << ">"
10887 : << " 3"
10888 0 : << " " <<vvv_e.size()
10889 0 : << " " <<vvv_e.at(0).size()
10890 0 : << " " <<vvv_e.at(0).at(0).size();
10891 :
10892 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
10893 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
10894 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
10895 0 : oss << " " << CAssociatedCalNature::name(vvv_e.at(i).at(j).at(k));
10896 0 : oss << "</" << elementName << ">";
10897 0 : return oss.str();
10898 0 : }
10899 :
10900 47 : AssociatedCalNatureMod::AssociatedCalNature EnumerationParser::getAssociatedCalNature(const string &name, const string &tableName, const string &xmlDoc) {
10901 47 : string s = getField(xmlDoc,name);
10902 47 : if (s.length() == 0)
10903 0 : throw ConversionException("Error: Missing field \"" +
10904 0 : name + "\" or invalid syntax",tableName);
10905 :
10906 : AssociatedCalNature result;
10907 : try {
10908 47 : result = CAssociatedCalNature::newAssociatedCalNature(s);
10909 : }
10910 0 : catch (...) {
10911 0 : throw ConversionException("Error: could not convert '"+s+"' into a AssociatedCalNature.", tableName);
10912 0 : }
10913 47 : return result;
10914 47 : }
10915 :
10916 0 : vector<AssociatedCalNatureMod::AssociatedCalNature> EnumerationParser::getAssociatedCalNature1D(const string &name, const string &tableName, const string &xmlDoc) {
10917 0 : vector<AssociatedCalNatureMod::AssociatedCalNature> result;
10918 :
10919 0 : string s = getField(xmlDoc,name);
10920 0 : if (s.length() == 0)
10921 0 : throw ConversionException("Error: Missing field \"" +
10922 0 : name + "\" or invalid syntax",tableName);
10923 :
10924 0 : istringstream iss;
10925 0 : iss.str(s);
10926 0 : vector<string> tokens;
10927 :
10928 : // Tokenize.
10929 0 : string buf;
10930 0 : while (iss >> buf) {
10931 0 : tokens.push_back(buf);
10932 : }
10933 :
10934 : // The length must be 2 at the minimum (there may be an empty array)
10935 0 : if (tokens.size() < 2)
10936 0 : throw ConversionException("Error: missing values in field \"" +
10937 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10938 :
10939 :
10940 :
10941 : // The number of dimension should be 1.
10942 0 : if (tokens.at(0) != "1")
10943 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
10944 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10945 :
10946 : // Then parse the size of the unique dimension
10947 0 : errno = 0;
10948 0 : int size1 = atoi(tokens.at(1).c_str());
10949 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
10950 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
10951 :
10952 0 : if (size1 < 0)
10953 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
10954 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10955 :
10956 0 : if (tokens.size() != (unsigned int) (size1 + 2))
10957 0 : throw ConversionException("Error: incorrect number of values in field \"" +
10958 0 : name + "\" or invalid syntax('" + s +"')",tableName);
10959 :
10960 0 : int k = 2;
10961 : try {
10962 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
10963 0 : result.push_back(CAssociatedCalNature::newAssociatedCalNature(tokens.at(k).c_str()));
10964 0 : k++;
10965 : }
10966 : }
10967 0 : catch (...) {
10968 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AssociatedCalNature.", tableName);
10969 0 : }
10970 :
10971 0 : return result;
10972 0 : }
10973 :
10974 0 : vector<vector<AssociatedCalNatureMod::AssociatedCalNature> > EnumerationParser::getAssociatedCalNature2D(const string &name, const string &tableName, const string &xmlDoc) {
10975 0 : vector<vector<AssociatedCalNatureMod::AssociatedCalNature> > result;
10976 :
10977 0 : string s = getField(xmlDoc,name);
10978 0 : if (s.length() == 0)
10979 0 : throw ConversionException("Error: Missing field \"" +
10980 0 : name + "\" or invalid syntax",tableName);
10981 :
10982 0 : istringstream iss;
10983 0 : iss.str(s);
10984 0 : vector<string> tokens;
10985 :
10986 : // Tokenize.
10987 0 : string buf;
10988 0 : while (iss >> buf) {
10989 0 : tokens.push_back(buf);
10990 : }
10991 :
10992 : // The length must be 3 at the minimum (there may be an empty array)
10993 0 : if (tokens.size() < 3)
10994 0 : throw ConversionException("Error: missing values in field \"" +
10995 0 : name + "\" or invalid syntax(" + s +"')",tableName);
10996 :
10997 :
10998 : // The number of dimension should be 2.
10999 0 : if (tokens.at(0) != "2")
11000 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
11001 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11002 :
11003 : // Then parse the size of the two dimensions
11004 0 : errno = 0;
11005 0 : int size1 = atoi(tokens.at(1).c_str());
11006 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11007 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11008 :
11009 0 : if (size1 <= 0)
11010 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11011 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11012 0 : errno = 0;
11013 0 : int size2 = atoi(tokens.at(2).c_str());
11014 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11015 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11016 :
11017 0 : if (size2 < 0)
11018 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
11019 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11020 :
11021 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
11022 0 : throw ConversionException("Error: incorrect number of values in field \"" +
11023 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11024 :
11025 0 : int k = 3;
11026 : try {
11027 0 : vector<AssociatedCalNatureMod::AssociatedCalNature> v_aux;
11028 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
11029 0 : v_aux.clear();
11030 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
11031 0 : v_aux.push_back(CAssociatedCalNature::newAssociatedCalNature(tokens.at(k).c_str()));
11032 0 : k++;
11033 : }
11034 0 : result.push_back(v_aux);
11035 : }
11036 0 : }
11037 0 : catch (...) {
11038 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AssociatedCalNature.", tableName);
11039 0 : }
11040 0 : return result;
11041 0 : }
11042 :
11043 :
11044 0 : vector<vector<vector<AssociatedCalNatureMod::AssociatedCalNature> > > EnumerationParser::getAssociatedCalNature3D(const string &name, const string &tableName, const string &xmlDoc) {
11045 0 : vector<vector<vector<AssociatedCalNatureMod::AssociatedCalNature> > >result;
11046 :
11047 0 : string s = getField(xmlDoc,name);
11048 0 : if (s.length() == 0)
11049 0 : throw ConversionException("Error: Missing field \"" +
11050 0 : name + "\" or invalid syntax",tableName);
11051 :
11052 0 : istringstream iss;
11053 0 : iss.str(s);
11054 0 : vector<string> tokens;
11055 :
11056 : // Tokenize.
11057 0 : string buf;
11058 0 : while (iss >> buf) {
11059 0 : tokens.push_back(buf);
11060 : }
11061 :
11062 : // The length must be 4 at the minimum (there may be an empty array)
11063 0 : if (tokens.size() < 4)
11064 0 : throw ConversionException("Error: missing values in field \"" +
11065 0 : name + "\" or invalid syntax(" + s +"')",tableName);
11066 :
11067 :
11068 : // The number of dimension should be 3.
11069 0 : if (tokens.at(0) != "3")
11070 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
11071 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11072 :
11073 : // Then parse the size of the three dimensions
11074 0 : errno = 0;
11075 0 : int size1 = atoi(tokens.at(1).c_str());
11076 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11077 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11078 :
11079 0 : if (size1 <= 0)
11080 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11081 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11082 :
11083 0 : errno = 0;
11084 0 : int size2 = atoi(tokens.at(2).c_str());
11085 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11086 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11087 :
11088 0 : if (size2 <= 0)
11089 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11090 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11091 :
11092 0 : errno = 0;
11093 0 : int size3 = atoi(tokens.at(3).c_str());
11094 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11095 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11096 :
11097 :
11098 0 : if (size3 < 0)
11099 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
11100 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11101 :
11102 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
11103 0 : throw ConversionException("Error: incorrect number of values in field \"" +
11104 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11105 :
11106 0 : int k = 4;
11107 : try {
11108 0 : vector<AssociatedCalNatureMod::AssociatedCalNature> v_aux;
11109 0 : vector<vector<AssociatedCalNatureMod::AssociatedCalNature> > vv_aux;
11110 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
11111 0 : vv_aux.clear();
11112 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
11113 0 : v_aux.clear();
11114 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
11115 0 : v_aux.push_back(CAssociatedCalNature::newAssociatedCalNature(tokens.at(k).c_str()));
11116 0 : k++;
11117 : }
11118 0 : vv_aux.push_back(v_aux);
11119 : }
11120 0 : result.push_back(vv_aux);
11121 : }
11122 0 : }
11123 0 : catch (...) {
11124 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a AssociatedCalNature.", tableName);
11125 0 : }
11126 :
11127 0 : return result;
11128 0 : }
11129 :
11130 :
11131 :
11132 :
11133 :
11134 0 : string EnumerationParser::toXML(const string& elementName, InvalidatingConditionMod::InvalidatingCondition e) {
11135 0 : return "<"+elementName+">"+CInvalidatingCondition::name(e)+"</"+elementName+">";
11136 : }
11137 :
11138 0 : string EnumerationParser::toXML(const string& elementName, const vector<InvalidatingConditionMod::InvalidatingCondition>& v_e) {
11139 0 : ostringstream oss;
11140 : oss << "<" << elementName << ">"
11141 : << " 1"
11142 0 : << " " << v_e.size();
11143 :
11144 0 : for (unsigned int i = 0; i < v_e.size(); i++)
11145 0 : oss << " " << CInvalidatingCondition::name(v_e.at(i));
11146 0 : oss << "</" << elementName << ">";
11147 0 : return oss.str();
11148 0 : }
11149 :
11150 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<InvalidatingConditionMod::InvalidatingCondition> >& vv_e) {
11151 0 : ostringstream oss;
11152 : oss << "<" << elementName << ">"
11153 : << " 2"
11154 0 : << " " <<vv_e.size()
11155 0 : << " " <<vv_e.at(0).size();
11156 :
11157 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
11158 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
11159 0 : oss << " " << CInvalidatingCondition::name(vv_e.at(i).at(j));
11160 0 : oss << "</" << elementName << ">";
11161 0 : return oss.str();
11162 0 : }
11163 :
11164 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<InvalidatingConditionMod::InvalidatingCondition> > >& vvv_e) {
11165 0 : ostringstream oss;
11166 : oss << "<" << elementName << ">"
11167 : << " 3"
11168 0 : << " " <<vvv_e.size()
11169 0 : << " " <<vvv_e.at(0).size()
11170 0 : << " " <<vvv_e.at(0).at(0).size();
11171 :
11172 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
11173 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
11174 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
11175 0 : oss << " " << CInvalidatingCondition::name(vvv_e.at(i).at(j).at(k));
11176 0 : oss << "</" << elementName << ">";
11177 0 : return oss.str();
11178 0 : }
11179 :
11180 0 : InvalidatingConditionMod::InvalidatingCondition EnumerationParser::getInvalidatingCondition(const string &name, const string &tableName, const string &xmlDoc) {
11181 0 : string s = getField(xmlDoc,name);
11182 0 : if (s.length() == 0)
11183 0 : throw ConversionException("Error: Missing field \"" +
11184 0 : name + "\" or invalid syntax",tableName);
11185 :
11186 : InvalidatingCondition result;
11187 : try {
11188 0 : result = CInvalidatingCondition::newInvalidatingCondition(s);
11189 : }
11190 0 : catch (...) {
11191 0 : throw ConversionException("Error: could not convert '"+s+"' into a InvalidatingCondition.", tableName);
11192 0 : }
11193 0 : return result;
11194 0 : }
11195 :
11196 0 : vector<InvalidatingConditionMod::InvalidatingCondition> EnumerationParser::getInvalidatingCondition1D(const string &name, const string &tableName, const string &xmlDoc) {
11197 0 : vector<InvalidatingConditionMod::InvalidatingCondition> result;
11198 :
11199 0 : string s = getField(xmlDoc,name);
11200 0 : if (s.length() == 0)
11201 0 : throw ConversionException("Error: Missing field \"" +
11202 0 : name + "\" or invalid syntax",tableName);
11203 :
11204 0 : istringstream iss;
11205 0 : iss.str(s);
11206 0 : vector<string> tokens;
11207 :
11208 : // Tokenize.
11209 0 : string buf;
11210 0 : while (iss >> buf) {
11211 0 : tokens.push_back(buf);
11212 : }
11213 :
11214 : // The length must be 2 at the minimum (there may be an empty array)
11215 0 : if (tokens.size() < 2)
11216 0 : throw ConversionException("Error: missing values in field \"" +
11217 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11218 :
11219 :
11220 :
11221 : // The number of dimension should be 1.
11222 0 : if (tokens.at(0) != "1")
11223 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
11224 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11225 :
11226 : // Then parse the size of the unique dimension
11227 0 : errno = 0;
11228 0 : int size1 = atoi(tokens.at(1).c_str());
11229 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11230 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11231 :
11232 0 : if (size1 < 0)
11233 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
11234 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11235 :
11236 0 : if (tokens.size() != (unsigned int) (size1 + 2))
11237 0 : throw ConversionException("Error: incorrect number of values in field \"" +
11238 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11239 :
11240 0 : int k = 2;
11241 : try {
11242 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
11243 0 : result.push_back(CInvalidatingCondition::newInvalidatingCondition(tokens.at(k).c_str()));
11244 0 : k++;
11245 : }
11246 : }
11247 0 : catch (...) {
11248 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a InvalidatingCondition.", tableName);
11249 0 : }
11250 :
11251 0 : return result;
11252 0 : }
11253 :
11254 0 : vector<vector<InvalidatingConditionMod::InvalidatingCondition> > EnumerationParser::getInvalidatingCondition2D(const string &name, const string &tableName, const string &xmlDoc) {
11255 0 : vector<vector<InvalidatingConditionMod::InvalidatingCondition> > result;
11256 :
11257 0 : string s = getField(xmlDoc,name);
11258 0 : if (s.length() == 0)
11259 0 : throw ConversionException("Error: Missing field \"" +
11260 0 : name + "\" or invalid syntax",tableName);
11261 :
11262 0 : istringstream iss;
11263 0 : iss.str(s);
11264 0 : vector<string> tokens;
11265 :
11266 : // Tokenize.
11267 0 : string buf;
11268 0 : while (iss >> buf) {
11269 0 : tokens.push_back(buf);
11270 : }
11271 :
11272 : // The length must be 3 at the minimum (there may be an empty array)
11273 0 : if (tokens.size() < 3)
11274 0 : throw ConversionException("Error: missing values in field \"" +
11275 0 : name + "\" or invalid syntax(" + s +"')",tableName);
11276 :
11277 :
11278 : // The number of dimension should be 2.
11279 0 : if (tokens.at(0) != "2")
11280 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
11281 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11282 :
11283 : // Then parse the size of the two dimensions
11284 0 : errno = 0;
11285 0 : int size1 = atoi(tokens.at(1).c_str());
11286 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11287 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11288 :
11289 0 : if (size1 <= 0)
11290 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11291 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11292 0 : errno = 0;
11293 0 : int size2 = atoi(tokens.at(2).c_str());
11294 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11295 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11296 :
11297 0 : if (size2 < 0)
11298 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
11299 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11300 :
11301 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
11302 0 : throw ConversionException("Error: incorrect number of values in field \"" +
11303 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11304 :
11305 0 : int k = 3;
11306 : try {
11307 0 : vector<InvalidatingConditionMod::InvalidatingCondition> v_aux;
11308 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
11309 0 : v_aux.clear();
11310 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
11311 0 : v_aux.push_back(CInvalidatingCondition::newInvalidatingCondition(tokens.at(k).c_str()));
11312 0 : k++;
11313 : }
11314 0 : result.push_back(v_aux);
11315 : }
11316 0 : }
11317 0 : catch (...) {
11318 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a InvalidatingCondition.", tableName);
11319 0 : }
11320 0 : return result;
11321 0 : }
11322 :
11323 :
11324 0 : vector<vector<vector<InvalidatingConditionMod::InvalidatingCondition> > > EnumerationParser::getInvalidatingCondition3D(const string &name, const string &tableName, const string &xmlDoc) {
11325 0 : vector<vector<vector<InvalidatingConditionMod::InvalidatingCondition> > >result;
11326 :
11327 0 : string s = getField(xmlDoc,name);
11328 0 : if (s.length() == 0)
11329 0 : throw ConversionException("Error: Missing field \"" +
11330 0 : name + "\" or invalid syntax",tableName);
11331 :
11332 0 : istringstream iss;
11333 0 : iss.str(s);
11334 0 : vector<string> tokens;
11335 :
11336 : // Tokenize.
11337 0 : string buf;
11338 0 : while (iss >> buf) {
11339 0 : tokens.push_back(buf);
11340 : }
11341 :
11342 : // The length must be 4 at the minimum (there may be an empty array)
11343 0 : if (tokens.size() < 4)
11344 0 : throw ConversionException("Error: missing values in field \"" +
11345 0 : name + "\" or invalid syntax(" + s +"')",tableName);
11346 :
11347 :
11348 : // The number of dimension should be 3.
11349 0 : if (tokens.at(0) != "3")
11350 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
11351 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11352 :
11353 : // Then parse the size of the three dimensions
11354 0 : errno = 0;
11355 0 : int size1 = atoi(tokens.at(1).c_str());
11356 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11357 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11358 :
11359 0 : if (size1 <= 0)
11360 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11361 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11362 :
11363 0 : errno = 0;
11364 0 : int size2 = atoi(tokens.at(2).c_str());
11365 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11366 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11367 :
11368 0 : if (size2 <= 0)
11369 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11370 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11371 :
11372 0 : errno = 0;
11373 0 : int size3 = atoi(tokens.at(3).c_str());
11374 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11375 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11376 :
11377 :
11378 0 : if (size3 < 0)
11379 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
11380 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11381 :
11382 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
11383 0 : throw ConversionException("Error: incorrect number of values in field \"" +
11384 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11385 :
11386 0 : int k = 4;
11387 : try {
11388 0 : vector<InvalidatingConditionMod::InvalidatingCondition> v_aux;
11389 0 : vector<vector<InvalidatingConditionMod::InvalidatingCondition> > vv_aux;
11390 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
11391 0 : vv_aux.clear();
11392 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
11393 0 : v_aux.clear();
11394 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
11395 0 : v_aux.push_back(CInvalidatingCondition::newInvalidatingCondition(tokens.at(k).c_str()));
11396 0 : k++;
11397 : }
11398 0 : vv_aux.push_back(v_aux);
11399 : }
11400 0 : result.push_back(vv_aux);
11401 : }
11402 0 : }
11403 0 : catch (...) {
11404 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a InvalidatingCondition.", tableName);
11405 0 : }
11406 :
11407 0 : return result;
11408 0 : }
11409 :
11410 :
11411 :
11412 :
11413 :
11414 0 : string EnumerationParser::toXML(const string& elementName, PositionMethodMod::PositionMethod e) {
11415 0 : return "<"+elementName+">"+CPositionMethod::name(e)+"</"+elementName+">";
11416 : }
11417 :
11418 0 : string EnumerationParser::toXML(const string& elementName, const vector<PositionMethodMod::PositionMethod>& v_e) {
11419 0 : ostringstream oss;
11420 : oss << "<" << elementName << ">"
11421 : << " 1"
11422 0 : << " " << v_e.size();
11423 :
11424 0 : for (unsigned int i = 0; i < v_e.size(); i++)
11425 0 : oss << " " << CPositionMethod::name(v_e.at(i));
11426 0 : oss << "</" << elementName << ">";
11427 0 : return oss.str();
11428 0 : }
11429 :
11430 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<PositionMethodMod::PositionMethod> >& vv_e) {
11431 0 : ostringstream oss;
11432 : oss << "<" << elementName << ">"
11433 : << " 2"
11434 0 : << " " <<vv_e.size()
11435 0 : << " " <<vv_e.at(0).size();
11436 :
11437 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
11438 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
11439 0 : oss << " " << CPositionMethod::name(vv_e.at(i).at(j));
11440 0 : oss << "</" << elementName << ">";
11441 0 : return oss.str();
11442 0 : }
11443 :
11444 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<PositionMethodMod::PositionMethod> > >& vvv_e) {
11445 0 : ostringstream oss;
11446 : oss << "<" << elementName << ">"
11447 : << " 3"
11448 0 : << " " <<vvv_e.size()
11449 0 : << " " <<vvv_e.at(0).size()
11450 0 : << " " <<vvv_e.at(0).at(0).size();
11451 :
11452 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
11453 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
11454 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
11455 0 : oss << " " << CPositionMethod::name(vvv_e.at(i).at(j).at(k));
11456 0 : oss << "</" << elementName << ">";
11457 0 : return oss.str();
11458 0 : }
11459 :
11460 0 : PositionMethodMod::PositionMethod EnumerationParser::getPositionMethod(const string &name, const string &tableName, const string &xmlDoc) {
11461 0 : string s = getField(xmlDoc,name);
11462 0 : if (s.length() == 0)
11463 0 : throw ConversionException("Error: Missing field \"" +
11464 0 : name + "\" or invalid syntax",tableName);
11465 :
11466 : PositionMethod result;
11467 : try {
11468 0 : result = CPositionMethod::newPositionMethod(s);
11469 : }
11470 0 : catch (...) {
11471 0 : throw ConversionException("Error: could not convert '"+s+"' into a PositionMethod.", tableName);
11472 0 : }
11473 0 : return result;
11474 0 : }
11475 :
11476 0 : vector<PositionMethodMod::PositionMethod> EnumerationParser::getPositionMethod1D(const string &name, const string &tableName, const string &xmlDoc) {
11477 0 : vector<PositionMethodMod::PositionMethod> result;
11478 :
11479 0 : string s = getField(xmlDoc,name);
11480 0 : if (s.length() == 0)
11481 0 : throw ConversionException("Error: Missing field \"" +
11482 0 : name + "\" or invalid syntax",tableName);
11483 :
11484 0 : istringstream iss;
11485 0 : iss.str(s);
11486 0 : vector<string> tokens;
11487 :
11488 : // Tokenize.
11489 0 : string buf;
11490 0 : while (iss >> buf) {
11491 0 : tokens.push_back(buf);
11492 : }
11493 :
11494 : // The length must be 2 at the minimum (there may be an empty array)
11495 0 : if (tokens.size() < 2)
11496 0 : throw ConversionException("Error: missing values in field \"" +
11497 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11498 :
11499 :
11500 :
11501 : // The number of dimension should be 1.
11502 0 : if (tokens.at(0) != "1")
11503 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
11504 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11505 :
11506 : // Then parse the size of the unique dimension
11507 0 : errno = 0;
11508 0 : int size1 = atoi(tokens.at(1).c_str());
11509 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11510 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11511 :
11512 0 : if (size1 < 0)
11513 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
11514 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11515 :
11516 0 : if (tokens.size() != (unsigned int) (size1 + 2))
11517 0 : throw ConversionException("Error: incorrect number of values in field \"" +
11518 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11519 :
11520 0 : int k = 2;
11521 : try {
11522 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
11523 0 : result.push_back(CPositionMethod::newPositionMethod(tokens.at(k).c_str()));
11524 0 : k++;
11525 : }
11526 : }
11527 0 : catch (...) {
11528 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PositionMethod.", tableName);
11529 0 : }
11530 :
11531 0 : return result;
11532 0 : }
11533 :
11534 0 : vector<vector<PositionMethodMod::PositionMethod> > EnumerationParser::getPositionMethod2D(const string &name, const string &tableName, const string &xmlDoc) {
11535 0 : vector<vector<PositionMethodMod::PositionMethod> > result;
11536 :
11537 0 : string s = getField(xmlDoc,name);
11538 0 : if (s.length() == 0)
11539 0 : throw ConversionException("Error: Missing field \"" +
11540 0 : name + "\" or invalid syntax",tableName);
11541 :
11542 0 : istringstream iss;
11543 0 : iss.str(s);
11544 0 : vector<string> tokens;
11545 :
11546 : // Tokenize.
11547 0 : string buf;
11548 0 : while (iss >> buf) {
11549 0 : tokens.push_back(buf);
11550 : }
11551 :
11552 : // The length must be 3 at the minimum (there may be an empty array)
11553 0 : if (tokens.size() < 3)
11554 0 : throw ConversionException("Error: missing values in field \"" +
11555 0 : name + "\" or invalid syntax(" + s +"')",tableName);
11556 :
11557 :
11558 : // The number of dimension should be 2.
11559 0 : if (tokens.at(0) != "2")
11560 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
11561 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11562 :
11563 : // Then parse the size of the two dimensions
11564 0 : errno = 0;
11565 0 : int size1 = atoi(tokens.at(1).c_str());
11566 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11567 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11568 :
11569 0 : if (size1 <= 0)
11570 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11571 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11572 0 : errno = 0;
11573 0 : int size2 = atoi(tokens.at(2).c_str());
11574 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11575 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11576 :
11577 0 : if (size2 < 0)
11578 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
11579 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11580 :
11581 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
11582 0 : throw ConversionException("Error: incorrect number of values in field \"" +
11583 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11584 :
11585 0 : int k = 3;
11586 : try {
11587 0 : vector<PositionMethodMod::PositionMethod> v_aux;
11588 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
11589 0 : v_aux.clear();
11590 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
11591 0 : v_aux.push_back(CPositionMethod::newPositionMethod(tokens.at(k).c_str()));
11592 0 : k++;
11593 : }
11594 0 : result.push_back(v_aux);
11595 : }
11596 0 : }
11597 0 : catch (...) {
11598 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PositionMethod.", tableName);
11599 0 : }
11600 0 : return result;
11601 0 : }
11602 :
11603 :
11604 0 : vector<vector<vector<PositionMethodMod::PositionMethod> > > EnumerationParser::getPositionMethod3D(const string &name, const string &tableName, const string &xmlDoc) {
11605 0 : vector<vector<vector<PositionMethodMod::PositionMethod> > >result;
11606 :
11607 0 : string s = getField(xmlDoc,name);
11608 0 : if (s.length() == 0)
11609 0 : throw ConversionException("Error: Missing field \"" +
11610 0 : name + "\" or invalid syntax",tableName);
11611 :
11612 0 : istringstream iss;
11613 0 : iss.str(s);
11614 0 : vector<string> tokens;
11615 :
11616 : // Tokenize.
11617 0 : string buf;
11618 0 : while (iss >> buf) {
11619 0 : tokens.push_back(buf);
11620 : }
11621 :
11622 : // The length must be 4 at the minimum (there may be an empty array)
11623 0 : if (tokens.size() < 4)
11624 0 : throw ConversionException("Error: missing values in field \"" +
11625 0 : name + "\" or invalid syntax(" + s +"')",tableName);
11626 :
11627 :
11628 : // The number of dimension should be 3.
11629 0 : if (tokens.at(0) != "3")
11630 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
11631 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11632 :
11633 : // Then parse the size of the three dimensions
11634 0 : errno = 0;
11635 0 : int size1 = atoi(tokens.at(1).c_str());
11636 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11637 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11638 :
11639 0 : if (size1 <= 0)
11640 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11641 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11642 :
11643 0 : errno = 0;
11644 0 : int size2 = atoi(tokens.at(2).c_str());
11645 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11646 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11647 :
11648 0 : if (size2 <= 0)
11649 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11650 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11651 :
11652 0 : errno = 0;
11653 0 : int size3 = atoi(tokens.at(3).c_str());
11654 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11655 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11656 :
11657 :
11658 0 : if (size3 < 0)
11659 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
11660 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11661 :
11662 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
11663 0 : throw ConversionException("Error: incorrect number of values in field \"" +
11664 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11665 :
11666 0 : int k = 4;
11667 : try {
11668 0 : vector<PositionMethodMod::PositionMethod> v_aux;
11669 0 : vector<vector<PositionMethodMod::PositionMethod> > vv_aux;
11670 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
11671 0 : vv_aux.clear();
11672 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
11673 0 : v_aux.clear();
11674 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
11675 0 : v_aux.push_back(CPositionMethod::newPositionMethod(tokens.at(k).c_str()));
11676 0 : k++;
11677 : }
11678 0 : vv_aux.push_back(v_aux);
11679 : }
11680 0 : result.push_back(vv_aux);
11681 : }
11682 0 : }
11683 0 : catch (...) {
11684 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a PositionMethod.", tableName);
11685 0 : }
11686 :
11687 0 : return result;
11688 0 : }
11689 :
11690 :
11691 :
11692 :
11693 :
11694 0 : string EnumerationParser::toXML(const string& elementName, PointingModelModeMod::PointingModelMode e) {
11695 0 : return "<"+elementName+">"+CPointingModelMode::name(e)+"</"+elementName+">";
11696 : }
11697 :
11698 0 : string EnumerationParser::toXML(const string& elementName, const vector<PointingModelModeMod::PointingModelMode>& v_e) {
11699 0 : ostringstream oss;
11700 : oss << "<" << elementName << ">"
11701 : << " 1"
11702 0 : << " " << v_e.size();
11703 :
11704 0 : for (unsigned int i = 0; i < v_e.size(); i++)
11705 0 : oss << " " << CPointingModelMode::name(v_e.at(i));
11706 0 : oss << "</" << elementName << ">";
11707 0 : return oss.str();
11708 0 : }
11709 :
11710 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<PointingModelModeMod::PointingModelMode> >& vv_e) {
11711 0 : ostringstream oss;
11712 : oss << "<" << elementName << ">"
11713 : << " 2"
11714 0 : << " " <<vv_e.size()
11715 0 : << " " <<vv_e.at(0).size();
11716 :
11717 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
11718 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
11719 0 : oss << " " << CPointingModelMode::name(vv_e.at(i).at(j));
11720 0 : oss << "</" << elementName << ">";
11721 0 : return oss.str();
11722 0 : }
11723 :
11724 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<PointingModelModeMod::PointingModelMode> > >& vvv_e) {
11725 0 : ostringstream oss;
11726 : oss << "<" << elementName << ">"
11727 : << " 3"
11728 0 : << " " <<vvv_e.size()
11729 0 : << " " <<vvv_e.at(0).size()
11730 0 : << " " <<vvv_e.at(0).at(0).size();
11731 :
11732 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
11733 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
11734 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
11735 0 : oss << " " << CPointingModelMode::name(vvv_e.at(i).at(j).at(k));
11736 0 : oss << "</" << elementName << ">";
11737 0 : return oss.str();
11738 0 : }
11739 :
11740 60 : PointingModelModeMod::PointingModelMode EnumerationParser::getPointingModelMode(const string &name, const string &tableName, const string &xmlDoc) {
11741 60 : string s = getField(xmlDoc,name);
11742 60 : if (s.length() == 0)
11743 0 : throw ConversionException("Error: Missing field \"" +
11744 0 : name + "\" or invalid syntax",tableName);
11745 :
11746 : PointingModelMode result;
11747 : try {
11748 60 : result = CPointingModelMode::newPointingModelMode(s);
11749 : }
11750 0 : catch (...) {
11751 0 : throw ConversionException("Error: could not convert '"+s+"' into a PointingModelMode.", tableName);
11752 0 : }
11753 60 : return result;
11754 60 : }
11755 :
11756 0 : vector<PointingModelModeMod::PointingModelMode> EnumerationParser::getPointingModelMode1D(const string &name, const string &tableName, const string &xmlDoc) {
11757 0 : vector<PointingModelModeMod::PointingModelMode> result;
11758 :
11759 0 : string s = getField(xmlDoc,name);
11760 0 : if (s.length() == 0)
11761 0 : throw ConversionException("Error: Missing field \"" +
11762 0 : name + "\" or invalid syntax",tableName);
11763 :
11764 0 : istringstream iss;
11765 0 : iss.str(s);
11766 0 : vector<string> tokens;
11767 :
11768 : // Tokenize.
11769 0 : string buf;
11770 0 : while (iss >> buf) {
11771 0 : tokens.push_back(buf);
11772 : }
11773 :
11774 : // The length must be 2 at the minimum (there may be an empty array)
11775 0 : if (tokens.size() < 2)
11776 0 : throw ConversionException("Error: missing values in field \"" +
11777 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11778 :
11779 :
11780 :
11781 : // The number of dimension should be 1.
11782 0 : if (tokens.at(0) != "1")
11783 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
11784 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11785 :
11786 : // Then parse the size of the unique dimension
11787 0 : errno = 0;
11788 0 : int size1 = atoi(tokens.at(1).c_str());
11789 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11790 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11791 :
11792 0 : if (size1 < 0)
11793 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
11794 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11795 :
11796 0 : if (tokens.size() != (unsigned int) (size1 + 2))
11797 0 : throw ConversionException("Error: incorrect number of values in field \"" +
11798 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11799 :
11800 0 : int k = 2;
11801 : try {
11802 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
11803 0 : result.push_back(CPointingModelMode::newPointingModelMode(tokens.at(k).c_str()));
11804 0 : k++;
11805 : }
11806 : }
11807 0 : catch (...) {
11808 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PointingModelMode.", tableName);
11809 0 : }
11810 :
11811 0 : return result;
11812 0 : }
11813 :
11814 0 : vector<vector<PointingModelModeMod::PointingModelMode> > EnumerationParser::getPointingModelMode2D(const string &name, const string &tableName, const string &xmlDoc) {
11815 0 : vector<vector<PointingModelModeMod::PointingModelMode> > result;
11816 :
11817 0 : string s = getField(xmlDoc,name);
11818 0 : if (s.length() == 0)
11819 0 : throw ConversionException("Error: Missing field \"" +
11820 0 : name + "\" or invalid syntax",tableName);
11821 :
11822 0 : istringstream iss;
11823 0 : iss.str(s);
11824 0 : vector<string> tokens;
11825 :
11826 : // Tokenize.
11827 0 : string buf;
11828 0 : while (iss >> buf) {
11829 0 : tokens.push_back(buf);
11830 : }
11831 :
11832 : // The length must be 3 at the minimum (there may be an empty array)
11833 0 : if (tokens.size() < 3)
11834 0 : throw ConversionException("Error: missing values in field \"" +
11835 0 : name + "\" or invalid syntax(" + s +"')",tableName);
11836 :
11837 :
11838 : // The number of dimension should be 2.
11839 0 : if (tokens.at(0) != "2")
11840 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
11841 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11842 :
11843 : // Then parse the size of the two dimensions
11844 0 : errno = 0;
11845 0 : int size1 = atoi(tokens.at(1).c_str());
11846 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11847 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11848 :
11849 0 : if (size1 <= 0)
11850 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11851 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11852 0 : errno = 0;
11853 0 : int size2 = atoi(tokens.at(2).c_str());
11854 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11855 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11856 :
11857 0 : if (size2 < 0)
11858 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
11859 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11860 :
11861 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
11862 0 : throw ConversionException("Error: incorrect number of values in field \"" +
11863 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11864 :
11865 0 : int k = 3;
11866 : try {
11867 0 : vector<PointingModelModeMod::PointingModelMode> v_aux;
11868 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
11869 0 : v_aux.clear();
11870 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
11871 0 : v_aux.push_back(CPointingModelMode::newPointingModelMode(tokens.at(k).c_str()));
11872 0 : k++;
11873 : }
11874 0 : result.push_back(v_aux);
11875 : }
11876 0 : }
11877 0 : catch (...) {
11878 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PointingModelMode.", tableName);
11879 0 : }
11880 0 : return result;
11881 0 : }
11882 :
11883 :
11884 0 : vector<vector<vector<PointingModelModeMod::PointingModelMode> > > EnumerationParser::getPointingModelMode3D(const string &name, const string &tableName, const string &xmlDoc) {
11885 0 : vector<vector<vector<PointingModelModeMod::PointingModelMode> > >result;
11886 :
11887 0 : string s = getField(xmlDoc,name);
11888 0 : if (s.length() == 0)
11889 0 : throw ConversionException("Error: Missing field \"" +
11890 0 : name + "\" or invalid syntax",tableName);
11891 :
11892 0 : istringstream iss;
11893 0 : iss.str(s);
11894 0 : vector<string> tokens;
11895 :
11896 : // Tokenize.
11897 0 : string buf;
11898 0 : while (iss >> buf) {
11899 0 : tokens.push_back(buf);
11900 : }
11901 :
11902 : // The length must be 4 at the minimum (there may be an empty array)
11903 0 : if (tokens.size() < 4)
11904 0 : throw ConversionException("Error: missing values in field \"" +
11905 0 : name + "\" or invalid syntax(" + s +"')",tableName);
11906 :
11907 :
11908 : // The number of dimension should be 3.
11909 0 : if (tokens.at(0) != "3")
11910 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
11911 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11912 :
11913 : // Then parse the size of the three dimensions
11914 0 : errno = 0;
11915 0 : int size1 = atoi(tokens.at(1).c_str());
11916 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11917 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11918 :
11919 0 : if (size1 <= 0)
11920 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11921 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11922 :
11923 0 : errno = 0;
11924 0 : int size2 = atoi(tokens.at(2).c_str());
11925 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11926 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11927 :
11928 0 : if (size2 <= 0)
11929 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
11930 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11931 :
11932 0 : errno = 0;
11933 0 : int size3 = atoi(tokens.at(3).c_str());
11934 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
11935 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
11936 :
11937 :
11938 0 : if (size3 < 0)
11939 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
11940 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11941 :
11942 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
11943 0 : throw ConversionException("Error: incorrect number of values in field \"" +
11944 0 : name + "\" or invalid syntax('" + s +"')",tableName);
11945 :
11946 0 : int k = 4;
11947 : try {
11948 0 : vector<PointingModelModeMod::PointingModelMode> v_aux;
11949 0 : vector<vector<PointingModelModeMod::PointingModelMode> > vv_aux;
11950 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
11951 0 : vv_aux.clear();
11952 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
11953 0 : v_aux.clear();
11954 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
11955 0 : v_aux.push_back(CPointingModelMode::newPointingModelMode(tokens.at(k).c_str()));
11956 0 : k++;
11957 : }
11958 0 : vv_aux.push_back(v_aux);
11959 : }
11960 0 : result.push_back(vv_aux);
11961 : }
11962 0 : }
11963 0 : catch (...) {
11964 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a PointingModelMode.", tableName);
11965 0 : }
11966 :
11967 0 : return result;
11968 0 : }
11969 :
11970 :
11971 :
11972 :
11973 :
11974 0 : string EnumerationParser::toXML(const string& elementName, PointingMethodMod::PointingMethod e) {
11975 0 : return "<"+elementName+">"+CPointingMethod::name(e)+"</"+elementName+">";
11976 : }
11977 :
11978 0 : string EnumerationParser::toXML(const string& elementName, const vector<PointingMethodMod::PointingMethod>& v_e) {
11979 0 : ostringstream oss;
11980 : oss << "<" << elementName << ">"
11981 : << " 1"
11982 0 : << " " << v_e.size();
11983 :
11984 0 : for (unsigned int i = 0; i < v_e.size(); i++)
11985 0 : oss << " " << CPointingMethod::name(v_e.at(i));
11986 0 : oss << "</" << elementName << ">";
11987 0 : return oss.str();
11988 0 : }
11989 :
11990 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<PointingMethodMod::PointingMethod> >& vv_e) {
11991 0 : ostringstream oss;
11992 : oss << "<" << elementName << ">"
11993 : << " 2"
11994 0 : << " " <<vv_e.size()
11995 0 : << " " <<vv_e.at(0).size();
11996 :
11997 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
11998 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
11999 0 : oss << " " << CPointingMethod::name(vv_e.at(i).at(j));
12000 0 : oss << "</" << elementName << ">";
12001 0 : return oss.str();
12002 0 : }
12003 :
12004 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<PointingMethodMod::PointingMethod> > >& vvv_e) {
12005 0 : ostringstream oss;
12006 : oss << "<" << elementName << ">"
12007 : << " 3"
12008 0 : << " " <<vvv_e.size()
12009 0 : << " " <<vvv_e.at(0).size()
12010 0 : << " " <<vvv_e.at(0).at(0).size();
12011 :
12012 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
12013 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
12014 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
12015 0 : oss << " " << CPointingMethod::name(vvv_e.at(i).at(j).at(k));
12016 0 : oss << "</" << elementName << ">";
12017 0 : return oss.str();
12018 0 : }
12019 :
12020 60 : PointingMethodMod::PointingMethod EnumerationParser::getPointingMethod(const string &name, const string &tableName, const string &xmlDoc) {
12021 60 : string s = getField(xmlDoc,name);
12022 60 : if (s.length() == 0)
12023 0 : throw ConversionException("Error: Missing field \"" +
12024 0 : name + "\" or invalid syntax",tableName);
12025 :
12026 : PointingMethod result;
12027 : try {
12028 60 : result = CPointingMethod::newPointingMethod(s);
12029 : }
12030 0 : catch (...) {
12031 0 : throw ConversionException("Error: could not convert '"+s+"' into a PointingMethod.", tableName);
12032 0 : }
12033 60 : return result;
12034 60 : }
12035 :
12036 0 : vector<PointingMethodMod::PointingMethod> EnumerationParser::getPointingMethod1D(const string &name, const string &tableName, const string &xmlDoc) {
12037 0 : vector<PointingMethodMod::PointingMethod> result;
12038 :
12039 0 : string s = getField(xmlDoc,name);
12040 0 : if (s.length() == 0)
12041 0 : throw ConversionException("Error: Missing field \"" +
12042 0 : name + "\" or invalid syntax",tableName);
12043 :
12044 0 : istringstream iss;
12045 0 : iss.str(s);
12046 0 : vector<string> tokens;
12047 :
12048 : // Tokenize.
12049 0 : string buf;
12050 0 : while (iss >> buf) {
12051 0 : tokens.push_back(buf);
12052 : }
12053 :
12054 : // The length must be 2 at the minimum (there may be an empty array)
12055 0 : if (tokens.size() < 2)
12056 0 : throw ConversionException("Error: missing values in field \"" +
12057 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12058 :
12059 :
12060 :
12061 : // The number of dimension should be 1.
12062 0 : if (tokens.at(0) != "1")
12063 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
12064 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12065 :
12066 : // Then parse the size of the unique dimension
12067 0 : errno = 0;
12068 0 : int size1 = atoi(tokens.at(1).c_str());
12069 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12070 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12071 :
12072 0 : if (size1 < 0)
12073 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
12074 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12075 :
12076 0 : if (tokens.size() != (unsigned int) (size1 + 2))
12077 0 : throw ConversionException("Error: incorrect number of values in field \"" +
12078 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12079 :
12080 0 : int k = 2;
12081 : try {
12082 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
12083 0 : result.push_back(CPointingMethod::newPointingMethod(tokens.at(k).c_str()));
12084 0 : k++;
12085 : }
12086 : }
12087 0 : catch (...) {
12088 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PointingMethod.", tableName);
12089 0 : }
12090 :
12091 0 : return result;
12092 0 : }
12093 :
12094 0 : vector<vector<PointingMethodMod::PointingMethod> > EnumerationParser::getPointingMethod2D(const string &name, const string &tableName, const string &xmlDoc) {
12095 0 : vector<vector<PointingMethodMod::PointingMethod> > result;
12096 :
12097 0 : string s = getField(xmlDoc,name);
12098 0 : if (s.length() == 0)
12099 0 : throw ConversionException("Error: Missing field \"" +
12100 0 : name + "\" or invalid syntax",tableName);
12101 :
12102 0 : istringstream iss;
12103 0 : iss.str(s);
12104 0 : vector<string> tokens;
12105 :
12106 : // Tokenize.
12107 0 : string buf;
12108 0 : while (iss >> buf) {
12109 0 : tokens.push_back(buf);
12110 : }
12111 :
12112 : // The length must be 3 at the minimum (there may be an empty array)
12113 0 : if (tokens.size() < 3)
12114 0 : throw ConversionException("Error: missing values in field \"" +
12115 0 : name + "\" or invalid syntax(" + s +"')",tableName);
12116 :
12117 :
12118 : // The number of dimension should be 2.
12119 0 : if (tokens.at(0) != "2")
12120 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
12121 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12122 :
12123 : // Then parse the size of the two dimensions
12124 0 : errno = 0;
12125 0 : int size1 = atoi(tokens.at(1).c_str());
12126 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12127 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12128 :
12129 0 : if (size1 <= 0)
12130 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
12131 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12132 0 : errno = 0;
12133 0 : int size2 = atoi(tokens.at(2).c_str());
12134 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12135 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12136 :
12137 0 : if (size2 < 0)
12138 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
12139 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12140 :
12141 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
12142 0 : throw ConversionException("Error: incorrect number of values in field \"" +
12143 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12144 :
12145 0 : int k = 3;
12146 : try {
12147 0 : vector<PointingMethodMod::PointingMethod> v_aux;
12148 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
12149 0 : v_aux.clear();
12150 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
12151 0 : v_aux.push_back(CPointingMethod::newPointingMethod(tokens.at(k).c_str()));
12152 0 : k++;
12153 : }
12154 0 : result.push_back(v_aux);
12155 : }
12156 0 : }
12157 0 : catch (...) {
12158 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PointingMethod.", tableName);
12159 0 : }
12160 0 : return result;
12161 0 : }
12162 :
12163 :
12164 0 : vector<vector<vector<PointingMethodMod::PointingMethod> > > EnumerationParser::getPointingMethod3D(const string &name, const string &tableName, const string &xmlDoc) {
12165 0 : vector<vector<vector<PointingMethodMod::PointingMethod> > >result;
12166 :
12167 0 : string s = getField(xmlDoc,name);
12168 0 : if (s.length() == 0)
12169 0 : throw ConversionException("Error: Missing field \"" +
12170 0 : name + "\" or invalid syntax",tableName);
12171 :
12172 0 : istringstream iss;
12173 0 : iss.str(s);
12174 0 : vector<string> tokens;
12175 :
12176 : // Tokenize.
12177 0 : string buf;
12178 0 : while (iss >> buf) {
12179 0 : tokens.push_back(buf);
12180 : }
12181 :
12182 : // The length must be 4 at the minimum (there may be an empty array)
12183 0 : if (tokens.size() < 4)
12184 0 : throw ConversionException("Error: missing values in field \"" +
12185 0 : name + "\" or invalid syntax(" + s +"')",tableName);
12186 :
12187 :
12188 : // The number of dimension should be 3.
12189 0 : if (tokens.at(0) != "3")
12190 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
12191 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12192 :
12193 : // Then parse the size of the three dimensions
12194 0 : errno = 0;
12195 0 : int size1 = atoi(tokens.at(1).c_str());
12196 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12197 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12198 :
12199 0 : if (size1 <= 0)
12200 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
12201 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12202 :
12203 0 : errno = 0;
12204 0 : int size2 = atoi(tokens.at(2).c_str());
12205 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12206 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12207 :
12208 0 : if (size2 <= 0)
12209 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
12210 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12211 :
12212 0 : errno = 0;
12213 0 : int size3 = atoi(tokens.at(3).c_str());
12214 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12215 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12216 :
12217 :
12218 0 : if (size3 < 0)
12219 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
12220 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12221 :
12222 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
12223 0 : throw ConversionException("Error: incorrect number of values in field \"" +
12224 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12225 :
12226 0 : int k = 4;
12227 : try {
12228 0 : vector<PointingMethodMod::PointingMethod> v_aux;
12229 0 : vector<vector<PointingMethodMod::PointingMethod> > vv_aux;
12230 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
12231 0 : vv_aux.clear();
12232 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
12233 0 : v_aux.clear();
12234 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
12235 0 : v_aux.push_back(CPointingMethod::newPointingMethod(tokens.at(k).c_str()));
12236 0 : k++;
12237 : }
12238 0 : vv_aux.push_back(v_aux);
12239 : }
12240 0 : result.push_back(vv_aux);
12241 : }
12242 0 : }
12243 0 : catch (...) {
12244 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a PointingMethod.", tableName);
12245 0 : }
12246 :
12247 0 : return result;
12248 0 : }
12249 :
12250 :
12251 :
12252 :
12253 :
12254 0 : string EnumerationParser::toXML(const string& elementName, SyscalMethodMod::SyscalMethod e) {
12255 0 : return "<"+elementName+">"+CSyscalMethod::name(e)+"</"+elementName+">";
12256 : }
12257 :
12258 0 : string EnumerationParser::toXML(const string& elementName, const vector<SyscalMethodMod::SyscalMethod>& v_e) {
12259 0 : ostringstream oss;
12260 : oss << "<" << elementName << ">"
12261 : << " 1"
12262 0 : << " " << v_e.size();
12263 :
12264 0 : for (unsigned int i = 0; i < v_e.size(); i++)
12265 0 : oss << " " << CSyscalMethod::name(v_e.at(i));
12266 0 : oss << "</" << elementName << ">";
12267 0 : return oss.str();
12268 0 : }
12269 :
12270 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<SyscalMethodMod::SyscalMethod> >& vv_e) {
12271 0 : ostringstream oss;
12272 : oss << "<" << elementName << ">"
12273 : << " 2"
12274 0 : << " " <<vv_e.size()
12275 0 : << " " <<vv_e.at(0).size();
12276 :
12277 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
12278 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
12279 0 : oss << " " << CSyscalMethod::name(vv_e.at(i).at(j));
12280 0 : oss << "</" << elementName << ">";
12281 0 : return oss.str();
12282 0 : }
12283 :
12284 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<SyscalMethodMod::SyscalMethod> > >& vvv_e) {
12285 0 : ostringstream oss;
12286 : oss << "<" << elementName << ">"
12287 : << " 3"
12288 0 : << " " <<vvv_e.size()
12289 0 : << " " <<vvv_e.at(0).size()
12290 0 : << " " <<vvv_e.at(0).at(0).size();
12291 :
12292 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
12293 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
12294 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
12295 0 : oss << " " << CSyscalMethod::name(vvv_e.at(i).at(j).at(k));
12296 0 : oss << "</" << elementName << ">";
12297 0 : return oss.str();
12298 0 : }
12299 :
12300 0 : SyscalMethodMod::SyscalMethod EnumerationParser::getSyscalMethod(const string &name, const string &tableName, const string &xmlDoc) {
12301 0 : string s = getField(xmlDoc,name);
12302 0 : if (s.length() == 0)
12303 0 : throw ConversionException("Error: Missing field \"" +
12304 0 : name + "\" or invalid syntax",tableName);
12305 :
12306 : SyscalMethod result;
12307 : try {
12308 0 : result = CSyscalMethod::newSyscalMethod(s);
12309 : }
12310 0 : catch (...) {
12311 0 : throw ConversionException("Error: could not convert '"+s+"' into a SyscalMethod.", tableName);
12312 0 : }
12313 0 : return result;
12314 0 : }
12315 :
12316 0 : vector<SyscalMethodMod::SyscalMethod> EnumerationParser::getSyscalMethod1D(const string &name, const string &tableName, const string &xmlDoc) {
12317 0 : vector<SyscalMethodMod::SyscalMethod> result;
12318 :
12319 0 : string s = getField(xmlDoc,name);
12320 0 : if (s.length() == 0)
12321 0 : throw ConversionException("Error: Missing field \"" +
12322 0 : name + "\" or invalid syntax",tableName);
12323 :
12324 0 : istringstream iss;
12325 0 : iss.str(s);
12326 0 : vector<string> tokens;
12327 :
12328 : // Tokenize.
12329 0 : string buf;
12330 0 : while (iss >> buf) {
12331 0 : tokens.push_back(buf);
12332 : }
12333 :
12334 : // The length must be 2 at the minimum (there may be an empty array)
12335 0 : if (tokens.size() < 2)
12336 0 : throw ConversionException("Error: missing values in field \"" +
12337 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12338 :
12339 :
12340 :
12341 : // The number of dimension should be 1.
12342 0 : if (tokens.at(0) != "1")
12343 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
12344 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12345 :
12346 : // Then parse the size of the unique dimension
12347 0 : errno = 0;
12348 0 : int size1 = atoi(tokens.at(1).c_str());
12349 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12350 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12351 :
12352 0 : if (size1 < 0)
12353 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
12354 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12355 :
12356 0 : if (tokens.size() != (unsigned int) (size1 + 2))
12357 0 : throw ConversionException("Error: incorrect number of values in field \"" +
12358 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12359 :
12360 0 : int k = 2;
12361 : try {
12362 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
12363 0 : result.push_back(CSyscalMethod::newSyscalMethod(tokens.at(k).c_str()));
12364 0 : k++;
12365 : }
12366 : }
12367 0 : catch (...) {
12368 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SyscalMethod.", tableName);
12369 0 : }
12370 :
12371 0 : return result;
12372 0 : }
12373 :
12374 0 : vector<vector<SyscalMethodMod::SyscalMethod> > EnumerationParser::getSyscalMethod2D(const string &name, const string &tableName, const string &xmlDoc) {
12375 0 : vector<vector<SyscalMethodMod::SyscalMethod> > result;
12376 :
12377 0 : string s = getField(xmlDoc,name);
12378 0 : if (s.length() == 0)
12379 0 : throw ConversionException("Error: Missing field \"" +
12380 0 : name + "\" or invalid syntax",tableName);
12381 :
12382 0 : istringstream iss;
12383 0 : iss.str(s);
12384 0 : vector<string> tokens;
12385 :
12386 : // Tokenize.
12387 0 : string buf;
12388 0 : while (iss >> buf) {
12389 0 : tokens.push_back(buf);
12390 : }
12391 :
12392 : // The length must be 3 at the minimum (there may be an empty array)
12393 0 : if (tokens.size() < 3)
12394 0 : throw ConversionException("Error: missing values in field \"" +
12395 0 : name + "\" or invalid syntax(" + s +"')",tableName);
12396 :
12397 :
12398 : // The number of dimension should be 2.
12399 0 : if (tokens.at(0) != "2")
12400 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
12401 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12402 :
12403 : // Then parse the size of the two dimensions
12404 0 : errno = 0;
12405 0 : int size1 = atoi(tokens.at(1).c_str());
12406 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12407 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12408 :
12409 0 : if (size1 <= 0)
12410 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
12411 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12412 0 : errno = 0;
12413 0 : int size2 = atoi(tokens.at(2).c_str());
12414 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12415 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12416 :
12417 0 : if (size2 < 0)
12418 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
12419 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12420 :
12421 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
12422 0 : throw ConversionException("Error: incorrect number of values in field \"" +
12423 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12424 :
12425 0 : int k = 3;
12426 : try {
12427 0 : vector<SyscalMethodMod::SyscalMethod> v_aux;
12428 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
12429 0 : v_aux.clear();
12430 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
12431 0 : v_aux.push_back(CSyscalMethod::newSyscalMethod(tokens.at(k).c_str()));
12432 0 : k++;
12433 : }
12434 0 : result.push_back(v_aux);
12435 : }
12436 0 : }
12437 0 : catch (...) {
12438 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SyscalMethod.", tableName);
12439 0 : }
12440 0 : return result;
12441 0 : }
12442 :
12443 :
12444 0 : vector<vector<vector<SyscalMethodMod::SyscalMethod> > > EnumerationParser::getSyscalMethod3D(const string &name, const string &tableName, const string &xmlDoc) {
12445 0 : vector<vector<vector<SyscalMethodMod::SyscalMethod> > >result;
12446 :
12447 0 : string s = getField(xmlDoc,name);
12448 0 : if (s.length() == 0)
12449 0 : throw ConversionException("Error: Missing field \"" +
12450 0 : name + "\" or invalid syntax",tableName);
12451 :
12452 0 : istringstream iss;
12453 0 : iss.str(s);
12454 0 : vector<string> tokens;
12455 :
12456 : // Tokenize.
12457 0 : string buf;
12458 0 : while (iss >> buf) {
12459 0 : tokens.push_back(buf);
12460 : }
12461 :
12462 : // The length must be 4 at the minimum (there may be an empty array)
12463 0 : if (tokens.size() < 4)
12464 0 : throw ConversionException("Error: missing values in field \"" +
12465 0 : name + "\" or invalid syntax(" + s +"')",tableName);
12466 :
12467 :
12468 : // The number of dimension should be 3.
12469 0 : if (tokens.at(0) != "3")
12470 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
12471 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12472 :
12473 : // Then parse the size of the three dimensions
12474 0 : errno = 0;
12475 0 : int size1 = atoi(tokens.at(1).c_str());
12476 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12477 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12478 :
12479 0 : if (size1 <= 0)
12480 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
12481 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12482 :
12483 0 : errno = 0;
12484 0 : int size2 = atoi(tokens.at(2).c_str());
12485 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12486 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12487 :
12488 0 : if (size2 <= 0)
12489 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
12490 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12491 :
12492 0 : errno = 0;
12493 0 : int size3 = atoi(tokens.at(3).c_str());
12494 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12495 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12496 :
12497 :
12498 0 : if (size3 < 0)
12499 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
12500 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12501 :
12502 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
12503 0 : throw ConversionException("Error: incorrect number of values in field \"" +
12504 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12505 :
12506 0 : int k = 4;
12507 : try {
12508 0 : vector<SyscalMethodMod::SyscalMethod> v_aux;
12509 0 : vector<vector<SyscalMethodMod::SyscalMethod> > vv_aux;
12510 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
12511 0 : vv_aux.clear();
12512 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
12513 0 : v_aux.clear();
12514 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
12515 0 : v_aux.push_back(CSyscalMethod::newSyscalMethod(tokens.at(k).c_str()));
12516 0 : k++;
12517 : }
12518 0 : vv_aux.push_back(v_aux);
12519 : }
12520 0 : result.push_back(vv_aux);
12521 : }
12522 0 : }
12523 0 : catch (...) {
12524 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a SyscalMethod.", tableName);
12525 0 : }
12526 :
12527 0 : return result;
12528 0 : }
12529 :
12530 :
12531 :
12532 :
12533 :
12534 0 : string EnumerationParser::toXML(const string& elementName, CalCurveTypeMod::CalCurveType e) {
12535 0 : return "<"+elementName+">"+CCalCurveType::name(e)+"</"+elementName+">";
12536 : }
12537 :
12538 0 : string EnumerationParser::toXML(const string& elementName, const vector<CalCurveTypeMod::CalCurveType>& v_e) {
12539 0 : ostringstream oss;
12540 : oss << "<" << elementName << ">"
12541 : << " 1"
12542 0 : << " " << v_e.size();
12543 :
12544 0 : for (unsigned int i = 0; i < v_e.size(); i++)
12545 0 : oss << " " << CCalCurveType::name(v_e.at(i));
12546 0 : oss << "</" << elementName << ">";
12547 0 : return oss.str();
12548 0 : }
12549 :
12550 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CalCurveTypeMod::CalCurveType> >& vv_e) {
12551 0 : ostringstream oss;
12552 : oss << "<" << elementName << ">"
12553 : << " 2"
12554 0 : << " " <<vv_e.size()
12555 0 : << " " <<vv_e.at(0).size();
12556 :
12557 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
12558 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
12559 0 : oss << " " << CCalCurveType::name(vv_e.at(i).at(j));
12560 0 : oss << "</" << elementName << ">";
12561 0 : return oss.str();
12562 0 : }
12563 :
12564 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CalCurveTypeMod::CalCurveType> > >& vvv_e) {
12565 0 : ostringstream oss;
12566 : oss << "<" << elementName << ">"
12567 : << " 3"
12568 0 : << " " <<vvv_e.size()
12569 0 : << " " <<vvv_e.at(0).size()
12570 0 : << " " <<vvv_e.at(0).at(0).size();
12571 :
12572 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
12573 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
12574 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
12575 0 : oss << " " << CCalCurveType::name(vvv_e.at(i).at(j).at(k));
12576 0 : oss << "</" << elementName << ">";
12577 0 : return oss.str();
12578 0 : }
12579 :
12580 0 : CalCurveTypeMod::CalCurveType EnumerationParser::getCalCurveType(const string &name, const string &tableName, const string &xmlDoc) {
12581 0 : string s = getField(xmlDoc,name);
12582 0 : if (s.length() == 0)
12583 0 : throw ConversionException("Error: Missing field \"" +
12584 0 : name + "\" or invalid syntax",tableName);
12585 :
12586 : CalCurveType result;
12587 : try {
12588 0 : result = CCalCurveType::newCalCurveType(s);
12589 : }
12590 0 : catch (...) {
12591 0 : throw ConversionException("Error: could not convert '"+s+"' into a CalCurveType.", tableName);
12592 0 : }
12593 0 : return result;
12594 0 : }
12595 :
12596 0 : vector<CalCurveTypeMod::CalCurveType> EnumerationParser::getCalCurveType1D(const string &name, const string &tableName, const string &xmlDoc) {
12597 0 : vector<CalCurveTypeMod::CalCurveType> result;
12598 :
12599 0 : string s = getField(xmlDoc,name);
12600 0 : if (s.length() == 0)
12601 0 : throw ConversionException("Error: Missing field \"" +
12602 0 : name + "\" or invalid syntax",tableName);
12603 :
12604 0 : istringstream iss;
12605 0 : iss.str(s);
12606 0 : vector<string> tokens;
12607 :
12608 : // Tokenize.
12609 0 : string buf;
12610 0 : while (iss >> buf) {
12611 0 : tokens.push_back(buf);
12612 : }
12613 :
12614 : // The length must be 2 at the minimum (there may be an empty array)
12615 0 : if (tokens.size() < 2)
12616 0 : throw ConversionException("Error: missing values in field \"" +
12617 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12618 :
12619 :
12620 :
12621 : // The number of dimension should be 1.
12622 0 : if (tokens.at(0) != "1")
12623 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
12624 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12625 :
12626 : // Then parse the size of the unique dimension
12627 0 : errno = 0;
12628 0 : int size1 = atoi(tokens.at(1).c_str());
12629 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12630 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12631 :
12632 0 : if (size1 < 0)
12633 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
12634 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12635 :
12636 0 : if (tokens.size() != (unsigned int) (size1 + 2))
12637 0 : throw ConversionException("Error: incorrect number of values in field \"" +
12638 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12639 :
12640 0 : int k = 2;
12641 : try {
12642 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
12643 0 : result.push_back(CCalCurveType::newCalCurveType(tokens.at(k).c_str()));
12644 0 : k++;
12645 : }
12646 : }
12647 0 : catch (...) {
12648 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalCurveType.", tableName);
12649 0 : }
12650 :
12651 0 : return result;
12652 0 : }
12653 :
12654 0 : vector<vector<CalCurveTypeMod::CalCurveType> > EnumerationParser::getCalCurveType2D(const string &name, const string &tableName, const string &xmlDoc) {
12655 0 : vector<vector<CalCurveTypeMod::CalCurveType> > result;
12656 :
12657 0 : string s = getField(xmlDoc,name);
12658 0 : if (s.length() == 0)
12659 0 : throw ConversionException("Error: Missing field \"" +
12660 0 : name + "\" or invalid syntax",tableName);
12661 :
12662 0 : istringstream iss;
12663 0 : iss.str(s);
12664 0 : vector<string> tokens;
12665 :
12666 : // Tokenize.
12667 0 : string buf;
12668 0 : while (iss >> buf) {
12669 0 : tokens.push_back(buf);
12670 : }
12671 :
12672 : // The length must be 3 at the minimum (there may be an empty array)
12673 0 : if (tokens.size() < 3)
12674 0 : throw ConversionException("Error: missing values in field \"" +
12675 0 : name + "\" or invalid syntax(" + s +"')",tableName);
12676 :
12677 :
12678 : // The number of dimension should be 2.
12679 0 : if (tokens.at(0) != "2")
12680 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
12681 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12682 :
12683 : // Then parse the size of the two dimensions
12684 0 : errno = 0;
12685 0 : int size1 = atoi(tokens.at(1).c_str());
12686 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12687 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12688 :
12689 0 : if (size1 <= 0)
12690 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
12691 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12692 0 : errno = 0;
12693 0 : int size2 = atoi(tokens.at(2).c_str());
12694 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12695 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12696 :
12697 0 : if (size2 < 0)
12698 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
12699 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12700 :
12701 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
12702 0 : throw ConversionException("Error: incorrect number of values in field \"" +
12703 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12704 :
12705 0 : int k = 3;
12706 : try {
12707 0 : vector<CalCurveTypeMod::CalCurveType> v_aux;
12708 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
12709 0 : v_aux.clear();
12710 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
12711 0 : v_aux.push_back(CCalCurveType::newCalCurveType(tokens.at(k).c_str()));
12712 0 : k++;
12713 : }
12714 0 : result.push_back(v_aux);
12715 : }
12716 0 : }
12717 0 : catch (...) {
12718 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalCurveType.", tableName);
12719 0 : }
12720 0 : return result;
12721 0 : }
12722 :
12723 :
12724 0 : vector<vector<vector<CalCurveTypeMod::CalCurveType> > > EnumerationParser::getCalCurveType3D(const string &name, const string &tableName, const string &xmlDoc) {
12725 0 : vector<vector<vector<CalCurveTypeMod::CalCurveType> > >result;
12726 :
12727 0 : string s = getField(xmlDoc,name);
12728 0 : if (s.length() == 0)
12729 0 : throw ConversionException("Error: Missing field \"" +
12730 0 : name + "\" or invalid syntax",tableName);
12731 :
12732 0 : istringstream iss;
12733 0 : iss.str(s);
12734 0 : vector<string> tokens;
12735 :
12736 : // Tokenize.
12737 0 : string buf;
12738 0 : while (iss >> buf) {
12739 0 : tokens.push_back(buf);
12740 : }
12741 :
12742 : // The length must be 4 at the minimum (there may be an empty array)
12743 0 : if (tokens.size() < 4)
12744 0 : throw ConversionException("Error: missing values in field \"" +
12745 0 : name + "\" or invalid syntax(" + s +"')",tableName);
12746 :
12747 :
12748 : // The number of dimension should be 3.
12749 0 : if (tokens.at(0) != "3")
12750 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
12751 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12752 :
12753 : // Then parse the size of the three dimensions
12754 0 : errno = 0;
12755 0 : int size1 = atoi(tokens.at(1).c_str());
12756 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12757 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12758 :
12759 0 : if (size1 <= 0)
12760 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
12761 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12762 :
12763 0 : errno = 0;
12764 0 : int size2 = atoi(tokens.at(2).c_str());
12765 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12766 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12767 :
12768 0 : if (size2 <= 0)
12769 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
12770 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12771 :
12772 0 : errno = 0;
12773 0 : int size3 = atoi(tokens.at(3).c_str());
12774 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12775 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12776 :
12777 :
12778 0 : if (size3 < 0)
12779 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
12780 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12781 :
12782 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
12783 0 : throw ConversionException("Error: incorrect number of values in field \"" +
12784 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12785 :
12786 0 : int k = 4;
12787 : try {
12788 0 : vector<CalCurveTypeMod::CalCurveType> v_aux;
12789 0 : vector<vector<CalCurveTypeMod::CalCurveType> > vv_aux;
12790 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
12791 0 : vv_aux.clear();
12792 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
12793 0 : v_aux.clear();
12794 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
12795 0 : v_aux.push_back(CCalCurveType::newCalCurveType(tokens.at(k).c_str()));
12796 0 : k++;
12797 : }
12798 0 : vv_aux.push_back(v_aux);
12799 : }
12800 0 : result.push_back(vv_aux);
12801 : }
12802 0 : }
12803 0 : catch (...) {
12804 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalCurveType.", tableName);
12805 0 : }
12806 :
12807 0 : return result;
12808 0 : }
12809 :
12810 :
12811 :
12812 :
12813 :
12814 251 : string EnumerationParser::toXML(const string& elementName, StationTypeMod::StationType e) {
12815 502 : return "<"+elementName+">"+CStationType::name(e)+"</"+elementName+">";
12816 : }
12817 :
12818 0 : string EnumerationParser::toXML(const string& elementName, const vector<StationTypeMod::StationType>& v_e) {
12819 0 : ostringstream oss;
12820 : oss << "<" << elementName << ">"
12821 : << " 1"
12822 0 : << " " << v_e.size();
12823 :
12824 0 : for (unsigned int i = 0; i < v_e.size(); i++)
12825 0 : oss << " " << CStationType::name(v_e.at(i));
12826 0 : oss << "</" << elementName << ">";
12827 0 : return oss.str();
12828 0 : }
12829 :
12830 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<StationTypeMod::StationType> >& vv_e) {
12831 0 : ostringstream oss;
12832 : oss << "<" << elementName << ">"
12833 : << " 2"
12834 0 : << " " <<vv_e.size()
12835 0 : << " " <<vv_e.at(0).size();
12836 :
12837 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
12838 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
12839 0 : oss << " " << CStationType::name(vv_e.at(i).at(j));
12840 0 : oss << "</" << elementName << ">";
12841 0 : return oss.str();
12842 0 : }
12843 :
12844 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<StationTypeMod::StationType> > >& vvv_e) {
12845 0 : ostringstream oss;
12846 : oss << "<" << elementName << ">"
12847 : << " 3"
12848 0 : << " " <<vvv_e.size()
12849 0 : << " " <<vvv_e.at(0).size()
12850 0 : << " " <<vvv_e.at(0).at(0).size();
12851 :
12852 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
12853 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
12854 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
12855 0 : oss << " " << CStationType::name(vvv_e.at(i).at(j).at(k));
12856 0 : oss << "</" << elementName << ">";
12857 0 : return oss.str();
12858 0 : }
12859 :
12860 1946 : StationTypeMod::StationType EnumerationParser::getStationType(const string &name, const string &tableName, const string &xmlDoc) {
12861 1946 : string s = getField(xmlDoc,name);
12862 1946 : if (s.length() == 0)
12863 0 : throw ConversionException("Error: Missing field \"" +
12864 0 : name + "\" or invalid syntax",tableName);
12865 :
12866 : StationType result;
12867 : try {
12868 1946 : result = CStationType::newStationType(s);
12869 : }
12870 0 : catch (...) {
12871 0 : throw ConversionException("Error: could not convert '"+s+"' into a StationType.", tableName);
12872 0 : }
12873 1946 : return result;
12874 1946 : }
12875 :
12876 0 : vector<StationTypeMod::StationType> EnumerationParser::getStationType1D(const string &name, const string &tableName, const string &xmlDoc) {
12877 0 : vector<StationTypeMod::StationType> result;
12878 :
12879 0 : string s = getField(xmlDoc,name);
12880 0 : if (s.length() == 0)
12881 0 : throw ConversionException("Error: Missing field \"" +
12882 0 : name + "\" or invalid syntax",tableName);
12883 :
12884 0 : istringstream iss;
12885 0 : iss.str(s);
12886 0 : vector<string> tokens;
12887 :
12888 : // Tokenize.
12889 0 : string buf;
12890 0 : while (iss >> buf) {
12891 0 : tokens.push_back(buf);
12892 : }
12893 :
12894 : // The length must be 2 at the minimum (there may be an empty array)
12895 0 : if (tokens.size() < 2)
12896 0 : throw ConversionException("Error: missing values in field \"" +
12897 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12898 :
12899 :
12900 :
12901 : // The number of dimension should be 1.
12902 0 : if (tokens.at(0) != "1")
12903 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
12904 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12905 :
12906 : // Then parse the size of the unique dimension
12907 0 : errno = 0;
12908 0 : int size1 = atoi(tokens.at(1).c_str());
12909 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12910 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12911 :
12912 0 : if (size1 < 0)
12913 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
12914 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12915 :
12916 0 : if (tokens.size() != (unsigned int) (size1 + 2))
12917 0 : throw ConversionException("Error: incorrect number of values in field \"" +
12918 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12919 :
12920 0 : int k = 2;
12921 : try {
12922 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
12923 0 : result.push_back(CStationType::newStationType(tokens.at(k).c_str()));
12924 0 : k++;
12925 : }
12926 : }
12927 0 : catch (...) {
12928 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a StationType.", tableName);
12929 0 : }
12930 :
12931 0 : return result;
12932 0 : }
12933 :
12934 0 : vector<vector<StationTypeMod::StationType> > EnumerationParser::getStationType2D(const string &name, const string &tableName, const string &xmlDoc) {
12935 0 : vector<vector<StationTypeMod::StationType> > result;
12936 :
12937 0 : string s = getField(xmlDoc,name);
12938 0 : if (s.length() == 0)
12939 0 : throw ConversionException("Error: Missing field \"" +
12940 0 : name + "\" or invalid syntax",tableName);
12941 :
12942 0 : istringstream iss;
12943 0 : iss.str(s);
12944 0 : vector<string> tokens;
12945 :
12946 : // Tokenize.
12947 0 : string buf;
12948 0 : while (iss >> buf) {
12949 0 : tokens.push_back(buf);
12950 : }
12951 :
12952 : // The length must be 3 at the minimum (there may be an empty array)
12953 0 : if (tokens.size() < 3)
12954 0 : throw ConversionException("Error: missing values in field \"" +
12955 0 : name + "\" or invalid syntax(" + s +"')",tableName);
12956 :
12957 :
12958 : // The number of dimension should be 2.
12959 0 : if (tokens.at(0) != "2")
12960 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
12961 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12962 :
12963 : // Then parse the size of the two dimensions
12964 0 : errno = 0;
12965 0 : int size1 = atoi(tokens.at(1).c_str());
12966 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12967 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12968 :
12969 0 : if (size1 <= 0)
12970 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
12971 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12972 0 : errno = 0;
12973 0 : int size2 = atoi(tokens.at(2).c_str());
12974 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
12975 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
12976 :
12977 0 : if (size2 < 0)
12978 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
12979 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12980 :
12981 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
12982 0 : throw ConversionException("Error: incorrect number of values in field \"" +
12983 0 : name + "\" or invalid syntax('" + s +"')",tableName);
12984 :
12985 0 : int k = 3;
12986 : try {
12987 0 : vector<StationTypeMod::StationType> v_aux;
12988 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
12989 0 : v_aux.clear();
12990 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
12991 0 : v_aux.push_back(CStationType::newStationType(tokens.at(k).c_str()));
12992 0 : k++;
12993 : }
12994 0 : result.push_back(v_aux);
12995 : }
12996 0 : }
12997 0 : catch (...) {
12998 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a StationType.", tableName);
12999 0 : }
13000 0 : return result;
13001 0 : }
13002 :
13003 :
13004 0 : vector<vector<vector<StationTypeMod::StationType> > > EnumerationParser::getStationType3D(const string &name, const string &tableName, const string &xmlDoc) {
13005 0 : vector<vector<vector<StationTypeMod::StationType> > >result;
13006 :
13007 0 : string s = getField(xmlDoc,name);
13008 0 : if (s.length() == 0)
13009 0 : throw ConversionException("Error: Missing field \"" +
13010 0 : name + "\" or invalid syntax",tableName);
13011 :
13012 0 : istringstream iss;
13013 0 : iss.str(s);
13014 0 : vector<string> tokens;
13015 :
13016 : // Tokenize.
13017 0 : string buf;
13018 0 : while (iss >> buf) {
13019 0 : tokens.push_back(buf);
13020 : }
13021 :
13022 : // The length must be 4 at the minimum (there may be an empty array)
13023 0 : if (tokens.size() < 4)
13024 0 : throw ConversionException("Error: missing values in field \"" +
13025 0 : name + "\" or invalid syntax(" + s +"')",tableName);
13026 :
13027 :
13028 : // The number of dimension should be 3.
13029 0 : if (tokens.at(0) != "3")
13030 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
13031 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13032 :
13033 : // Then parse the size of the three dimensions
13034 0 : errno = 0;
13035 0 : int size1 = atoi(tokens.at(1).c_str());
13036 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13037 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13038 :
13039 0 : if (size1 <= 0)
13040 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
13041 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13042 :
13043 0 : errno = 0;
13044 0 : int size2 = atoi(tokens.at(2).c_str());
13045 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13046 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13047 :
13048 0 : if (size2 <= 0)
13049 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
13050 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13051 :
13052 0 : errno = 0;
13053 0 : int size3 = atoi(tokens.at(3).c_str());
13054 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13055 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13056 :
13057 :
13058 0 : if (size3 < 0)
13059 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
13060 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13061 :
13062 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
13063 0 : throw ConversionException("Error: incorrect number of values in field \"" +
13064 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13065 :
13066 0 : int k = 4;
13067 : try {
13068 0 : vector<StationTypeMod::StationType> v_aux;
13069 0 : vector<vector<StationTypeMod::StationType> > vv_aux;
13070 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
13071 0 : vv_aux.clear();
13072 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
13073 0 : v_aux.clear();
13074 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
13075 0 : v_aux.push_back(CStationType::newStationType(tokens.at(k).c_str()));
13076 0 : k++;
13077 : }
13078 0 : vv_aux.push_back(v_aux);
13079 : }
13080 0 : result.push_back(vv_aux);
13081 : }
13082 0 : }
13083 0 : catch (...) {
13084 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a StationType.", tableName);
13085 0 : }
13086 :
13087 0 : return result;
13088 0 : }
13089 :
13090 :
13091 :
13092 :
13093 :
13094 0 : string EnumerationParser::toXML(const string& elementName, DetectorBandTypeMod::DetectorBandType e) {
13095 0 : return "<"+elementName+">"+CDetectorBandType::name(e)+"</"+elementName+">";
13096 : }
13097 :
13098 0 : string EnumerationParser::toXML(const string& elementName, const vector<DetectorBandTypeMod::DetectorBandType>& v_e) {
13099 0 : ostringstream oss;
13100 : oss << "<" << elementName << ">"
13101 : << " 1"
13102 0 : << " " << v_e.size();
13103 :
13104 0 : for (unsigned int i = 0; i < v_e.size(); i++)
13105 0 : oss << " " << CDetectorBandType::name(v_e.at(i));
13106 0 : oss << "</" << elementName << ">";
13107 0 : return oss.str();
13108 0 : }
13109 :
13110 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<DetectorBandTypeMod::DetectorBandType> >& vv_e) {
13111 0 : ostringstream oss;
13112 : oss << "<" << elementName << ">"
13113 : << " 2"
13114 0 : << " " <<vv_e.size()
13115 0 : << " " <<vv_e.at(0).size();
13116 :
13117 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
13118 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
13119 0 : oss << " " << CDetectorBandType::name(vv_e.at(i).at(j));
13120 0 : oss << "</" << elementName << ">";
13121 0 : return oss.str();
13122 0 : }
13123 :
13124 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<DetectorBandTypeMod::DetectorBandType> > >& vvv_e) {
13125 0 : ostringstream oss;
13126 : oss << "<" << elementName << ">"
13127 : << " 3"
13128 0 : << " " <<vvv_e.size()
13129 0 : << " " <<vvv_e.at(0).size()
13130 0 : << " " <<vvv_e.at(0).at(0).size();
13131 :
13132 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
13133 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
13134 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
13135 0 : oss << " " << CDetectorBandType::name(vvv_e.at(i).at(j).at(k));
13136 0 : oss << "</" << elementName << ">";
13137 0 : return oss.str();
13138 0 : }
13139 :
13140 0 : DetectorBandTypeMod::DetectorBandType EnumerationParser::getDetectorBandType(const string &name, const string &tableName, const string &xmlDoc) {
13141 0 : string s = getField(xmlDoc,name);
13142 0 : if (s.length() == 0)
13143 0 : throw ConversionException("Error: Missing field \"" +
13144 0 : name + "\" or invalid syntax",tableName);
13145 :
13146 : DetectorBandType result;
13147 : try {
13148 0 : result = CDetectorBandType::newDetectorBandType(s);
13149 : }
13150 0 : catch (...) {
13151 0 : throw ConversionException("Error: could not convert '"+s+"' into a DetectorBandType.", tableName);
13152 0 : }
13153 0 : return result;
13154 0 : }
13155 :
13156 0 : vector<DetectorBandTypeMod::DetectorBandType> EnumerationParser::getDetectorBandType1D(const string &name, const string &tableName, const string &xmlDoc) {
13157 0 : vector<DetectorBandTypeMod::DetectorBandType> result;
13158 :
13159 0 : string s = getField(xmlDoc,name);
13160 0 : if (s.length() == 0)
13161 0 : throw ConversionException("Error: Missing field \"" +
13162 0 : name + "\" or invalid syntax",tableName);
13163 :
13164 0 : istringstream iss;
13165 0 : iss.str(s);
13166 0 : vector<string> tokens;
13167 :
13168 : // Tokenize.
13169 0 : string buf;
13170 0 : while (iss >> buf) {
13171 0 : tokens.push_back(buf);
13172 : }
13173 :
13174 : // The length must be 2 at the minimum (there may be an empty array)
13175 0 : if (tokens.size() < 2)
13176 0 : throw ConversionException("Error: missing values in field \"" +
13177 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13178 :
13179 :
13180 :
13181 : // The number of dimension should be 1.
13182 0 : if (tokens.at(0) != "1")
13183 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
13184 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13185 :
13186 : // Then parse the size of the unique dimension
13187 0 : errno = 0;
13188 0 : int size1 = atoi(tokens.at(1).c_str());
13189 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13190 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13191 :
13192 0 : if (size1 < 0)
13193 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
13194 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13195 :
13196 0 : if (tokens.size() != (unsigned int) (size1 + 2))
13197 0 : throw ConversionException("Error: incorrect number of values in field \"" +
13198 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13199 :
13200 0 : int k = 2;
13201 : try {
13202 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
13203 0 : result.push_back(CDetectorBandType::newDetectorBandType(tokens.at(k).c_str()));
13204 0 : k++;
13205 : }
13206 : }
13207 0 : catch (...) {
13208 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DetectorBandType.", tableName);
13209 0 : }
13210 :
13211 0 : return result;
13212 0 : }
13213 :
13214 0 : vector<vector<DetectorBandTypeMod::DetectorBandType> > EnumerationParser::getDetectorBandType2D(const string &name, const string &tableName, const string &xmlDoc) {
13215 0 : vector<vector<DetectorBandTypeMod::DetectorBandType> > result;
13216 :
13217 0 : string s = getField(xmlDoc,name);
13218 0 : if (s.length() == 0)
13219 0 : throw ConversionException("Error: Missing field \"" +
13220 0 : name + "\" or invalid syntax",tableName);
13221 :
13222 0 : istringstream iss;
13223 0 : iss.str(s);
13224 0 : vector<string> tokens;
13225 :
13226 : // Tokenize.
13227 0 : string buf;
13228 0 : while (iss >> buf) {
13229 0 : tokens.push_back(buf);
13230 : }
13231 :
13232 : // The length must be 3 at the minimum (there may be an empty array)
13233 0 : if (tokens.size() < 3)
13234 0 : throw ConversionException("Error: missing values in field \"" +
13235 0 : name + "\" or invalid syntax(" + s +"')",tableName);
13236 :
13237 :
13238 : // The number of dimension should be 2.
13239 0 : if (tokens.at(0) != "2")
13240 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
13241 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13242 :
13243 : // Then parse the size of the two dimensions
13244 0 : errno = 0;
13245 0 : int size1 = atoi(tokens.at(1).c_str());
13246 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13247 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13248 :
13249 0 : if (size1 <= 0)
13250 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
13251 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13252 0 : errno = 0;
13253 0 : int size2 = atoi(tokens.at(2).c_str());
13254 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13255 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13256 :
13257 0 : if (size2 < 0)
13258 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
13259 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13260 :
13261 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
13262 0 : throw ConversionException("Error: incorrect number of values in field \"" +
13263 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13264 :
13265 0 : int k = 3;
13266 : try {
13267 0 : vector<DetectorBandTypeMod::DetectorBandType> v_aux;
13268 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
13269 0 : v_aux.clear();
13270 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
13271 0 : v_aux.push_back(CDetectorBandType::newDetectorBandType(tokens.at(k).c_str()));
13272 0 : k++;
13273 : }
13274 0 : result.push_back(v_aux);
13275 : }
13276 0 : }
13277 0 : catch (...) {
13278 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DetectorBandType.", tableName);
13279 0 : }
13280 0 : return result;
13281 0 : }
13282 :
13283 :
13284 0 : vector<vector<vector<DetectorBandTypeMod::DetectorBandType> > > EnumerationParser::getDetectorBandType3D(const string &name, const string &tableName, const string &xmlDoc) {
13285 0 : vector<vector<vector<DetectorBandTypeMod::DetectorBandType> > >result;
13286 :
13287 0 : string s = getField(xmlDoc,name);
13288 0 : if (s.length() == 0)
13289 0 : throw ConversionException("Error: Missing field \"" +
13290 0 : name + "\" or invalid syntax",tableName);
13291 :
13292 0 : istringstream iss;
13293 0 : iss.str(s);
13294 0 : vector<string> tokens;
13295 :
13296 : // Tokenize.
13297 0 : string buf;
13298 0 : while (iss >> buf) {
13299 0 : tokens.push_back(buf);
13300 : }
13301 :
13302 : // The length must be 4 at the minimum (there may be an empty array)
13303 0 : if (tokens.size() < 4)
13304 0 : throw ConversionException("Error: missing values in field \"" +
13305 0 : name + "\" or invalid syntax(" + s +"')",tableName);
13306 :
13307 :
13308 : // The number of dimension should be 3.
13309 0 : if (tokens.at(0) != "3")
13310 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
13311 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13312 :
13313 : // Then parse the size of the three dimensions
13314 0 : errno = 0;
13315 0 : int size1 = atoi(tokens.at(1).c_str());
13316 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13317 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13318 :
13319 0 : if (size1 <= 0)
13320 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
13321 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13322 :
13323 0 : errno = 0;
13324 0 : int size2 = atoi(tokens.at(2).c_str());
13325 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13326 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13327 :
13328 0 : if (size2 <= 0)
13329 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
13330 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13331 :
13332 0 : errno = 0;
13333 0 : int size3 = atoi(tokens.at(3).c_str());
13334 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13335 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13336 :
13337 :
13338 0 : if (size3 < 0)
13339 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
13340 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13341 :
13342 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
13343 0 : throw ConversionException("Error: incorrect number of values in field \"" +
13344 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13345 :
13346 0 : int k = 4;
13347 : try {
13348 0 : vector<DetectorBandTypeMod::DetectorBandType> v_aux;
13349 0 : vector<vector<DetectorBandTypeMod::DetectorBandType> > vv_aux;
13350 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
13351 0 : vv_aux.clear();
13352 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
13353 0 : v_aux.clear();
13354 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
13355 0 : v_aux.push_back(CDetectorBandType::newDetectorBandType(tokens.at(k).c_str()));
13356 0 : k++;
13357 : }
13358 0 : vv_aux.push_back(v_aux);
13359 : }
13360 0 : result.push_back(vv_aux);
13361 : }
13362 0 : }
13363 0 : catch (...) {
13364 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a DetectorBandType.", tableName);
13365 0 : }
13366 :
13367 0 : return result;
13368 0 : }
13369 :
13370 :
13371 :
13372 :
13373 :
13374 0 : string EnumerationParser::toXML(const string& elementName, FocusMethodMod::FocusMethod e) {
13375 0 : return "<"+elementName+">"+CFocusMethod::name(e)+"</"+elementName+">";
13376 : }
13377 :
13378 0 : string EnumerationParser::toXML(const string& elementName, const vector<FocusMethodMod::FocusMethod>& v_e) {
13379 0 : ostringstream oss;
13380 : oss << "<" << elementName << ">"
13381 : << " 1"
13382 0 : << " " << v_e.size();
13383 :
13384 0 : for (unsigned int i = 0; i < v_e.size(); i++)
13385 0 : oss << " " << CFocusMethod::name(v_e.at(i));
13386 0 : oss << "</" << elementName << ">";
13387 0 : return oss.str();
13388 0 : }
13389 :
13390 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<FocusMethodMod::FocusMethod> >& vv_e) {
13391 0 : ostringstream oss;
13392 : oss << "<" << elementName << ">"
13393 : << " 2"
13394 0 : << " " <<vv_e.size()
13395 0 : << " " <<vv_e.at(0).size();
13396 :
13397 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
13398 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
13399 0 : oss << " " << CFocusMethod::name(vv_e.at(i).at(j));
13400 0 : oss << "</" << elementName << ">";
13401 0 : return oss.str();
13402 0 : }
13403 :
13404 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<FocusMethodMod::FocusMethod> > >& vvv_e) {
13405 0 : ostringstream oss;
13406 : oss << "<" << elementName << ">"
13407 : << " 3"
13408 0 : << " " <<vvv_e.size()
13409 0 : << " " <<vvv_e.at(0).size()
13410 0 : << " " <<vvv_e.at(0).at(0).size();
13411 :
13412 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
13413 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
13414 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
13415 0 : oss << " " << CFocusMethod::name(vvv_e.at(i).at(j).at(k));
13416 0 : oss << "</" << elementName << ">";
13417 0 : return oss.str();
13418 0 : }
13419 :
13420 0 : FocusMethodMod::FocusMethod EnumerationParser::getFocusMethod(const string &name, const string &tableName, const string &xmlDoc) {
13421 0 : string s = getField(xmlDoc,name);
13422 0 : if (s.length() == 0)
13423 0 : throw ConversionException("Error: Missing field \"" +
13424 0 : name + "\" or invalid syntax",tableName);
13425 :
13426 : FocusMethod result;
13427 : try {
13428 0 : result = CFocusMethod::newFocusMethod(s);
13429 : }
13430 0 : catch (...) {
13431 0 : throw ConversionException("Error: could not convert '"+s+"' into a FocusMethod.", tableName);
13432 0 : }
13433 0 : return result;
13434 0 : }
13435 :
13436 0 : vector<FocusMethodMod::FocusMethod> EnumerationParser::getFocusMethod1D(const string &name, const string &tableName, const string &xmlDoc) {
13437 0 : vector<FocusMethodMod::FocusMethod> result;
13438 :
13439 0 : string s = getField(xmlDoc,name);
13440 0 : if (s.length() == 0)
13441 0 : throw ConversionException("Error: Missing field \"" +
13442 0 : name + "\" or invalid syntax",tableName);
13443 :
13444 0 : istringstream iss;
13445 0 : iss.str(s);
13446 0 : vector<string> tokens;
13447 :
13448 : // Tokenize.
13449 0 : string buf;
13450 0 : while (iss >> buf) {
13451 0 : tokens.push_back(buf);
13452 : }
13453 :
13454 : // The length must be 2 at the minimum (there may be an empty array)
13455 0 : if (tokens.size() < 2)
13456 0 : throw ConversionException("Error: missing values in field \"" +
13457 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13458 :
13459 :
13460 :
13461 : // The number of dimension should be 1.
13462 0 : if (tokens.at(0) != "1")
13463 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
13464 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13465 :
13466 : // Then parse the size of the unique dimension
13467 0 : errno = 0;
13468 0 : int size1 = atoi(tokens.at(1).c_str());
13469 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13470 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13471 :
13472 0 : if (size1 < 0)
13473 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
13474 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13475 :
13476 0 : if (tokens.size() != (unsigned int) (size1 + 2))
13477 0 : throw ConversionException("Error: incorrect number of values in field \"" +
13478 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13479 :
13480 0 : int k = 2;
13481 : try {
13482 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
13483 0 : result.push_back(CFocusMethod::newFocusMethod(tokens.at(k).c_str()));
13484 0 : k++;
13485 : }
13486 : }
13487 0 : catch (...) {
13488 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a FocusMethod.", tableName);
13489 0 : }
13490 :
13491 0 : return result;
13492 0 : }
13493 :
13494 0 : vector<vector<FocusMethodMod::FocusMethod> > EnumerationParser::getFocusMethod2D(const string &name, const string &tableName, const string &xmlDoc) {
13495 0 : vector<vector<FocusMethodMod::FocusMethod> > result;
13496 :
13497 0 : string s = getField(xmlDoc,name);
13498 0 : if (s.length() == 0)
13499 0 : throw ConversionException("Error: Missing field \"" +
13500 0 : name + "\" or invalid syntax",tableName);
13501 :
13502 0 : istringstream iss;
13503 0 : iss.str(s);
13504 0 : vector<string> tokens;
13505 :
13506 : // Tokenize.
13507 0 : string buf;
13508 0 : while (iss >> buf) {
13509 0 : tokens.push_back(buf);
13510 : }
13511 :
13512 : // The length must be 3 at the minimum (there may be an empty array)
13513 0 : if (tokens.size() < 3)
13514 0 : throw ConversionException("Error: missing values in field \"" +
13515 0 : name + "\" or invalid syntax(" + s +"')",tableName);
13516 :
13517 :
13518 : // The number of dimension should be 2.
13519 0 : if (tokens.at(0) != "2")
13520 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
13521 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13522 :
13523 : // Then parse the size of the two dimensions
13524 0 : errno = 0;
13525 0 : int size1 = atoi(tokens.at(1).c_str());
13526 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13527 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13528 :
13529 0 : if (size1 <= 0)
13530 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
13531 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13532 0 : errno = 0;
13533 0 : int size2 = atoi(tokens.at(2).c_str());
13534 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13535 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13536 :
13537 0 : if (size2 < 0)
13538 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
13539 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13540 :
13541 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
13542 0 : throw ConversionException("Error: incorrect number of values in field \"" +
13543 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13544 :
13545 0 : int k = 3;
13546 : try {
13547 0 : vector<FocusMethodMod::FocusMethod> v_aux;
13548 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
13549 0 : v_aux.clear();
13550 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
13551 0 : v_aux.push_back(CFocusMethod::newFocusMethod(tokens.at(k).c_str()));
13552 0 : k++;
13553 : }
13554 0 : result.push_back(v_aux);
13555 : }
13556 0 : }
13557 0 : catch (...) {
13558 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a FocusMethod.", tableName);
13559 0 : }
13560 0 : return result;
13561 0 : }
13562 :
13563 :
13564 0 : vector<vector<vector<FocusMethodMod::FocusMethod> > > EnumerationParser::getFocusMethod3D(const string &name, const string &tableName, const string &xmlDoc) {
13565 0 : vector<vector<vector<FocusMethodMod::FocusMethod> > >result;
13566 :
13567 0 : string s = getField(xmlDoc,name);
13568 0 : if (s.length() == 0)
13569 0 : throw ConversionException("Error: Missing field \"" +
13570 0 : name + "\" or invalid syntax",tableName);
13571 :
13572 0 : istringstream iss;
13573 0 : iss.str(s);
13574 0 : vector<string> tokens;
13575 :
13576 : // Tokenize.
13577 0 : string buf;
13578 0 : while (iss >> buf) {
13579 0 : tokens.push_back(buf);
13580 : }
13581 :
13582 : // The length must be 4 at the minimum (there may be an empty array)
13583 0 : if (tokens.size() < 4)
13584 0 : throw ConversionException("Error: missing values in field \"" +
13585 0 : name + "\" or invalid syntax(" + s +"')",tableName);
13586 :
13587 :
13588 : // The number of dimension should be 3.
13589 0 : if (tokens.at(0) != "3")
13590 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
13591 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13592 :
13593 : // Then parse the size of the three dimensions
13594 0 : errno = 0;
13595 0 : int size1 = atoi(tokens.at(1).c_str());
13596 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13597 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13598 :
13599 0 : if (size1 <= 0)
13600 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
13601 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13602 :
13603 0 : errno = 0;
13604 0 : int size2 = atoi(tokens.at(2).c_str());
13605 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13606 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13607 :
13608 0 : if (size2 <= 0)
13609 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
13610 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13611 :
13612 0 : errno = 0;
13613 0 : int size3 = atoi(tokens.at(3).c_str());
13614 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13615 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13616 :
13617 :
13618 0 : if (size3 < 0)
13619 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
13620 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13621 :
13622 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
13623 0 : throw ConversionException("Error: incorrect number of values in field \"" +
13624 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13625 :
13626 0 : int k = 4;
13627 : try {
13628 0 : vector<FocusMethodMod::FocusMethod> v_aux;
13629 0 : vector<vector<FocusMethodMod::FocusMethod> > vv_aux;
13630 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
13631 0 : vv_aux.clear();
13632 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
13633 0 : v_aux.clear();
13634 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
13635 0 : v_aux.push_back(CFocusMethod::newFocusMethod(tokens.at(k).c_str()));
13636 0 : k++;
13637 : }
13638 0 : vv_aux.push_back(v_aux);
13639 : }
13640 0 : result.push_back(vv_aux);
13641 : }
13642 0 : }
13643 0 : catch (...) {
13644 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a FocusMethod.", tableName);
13645 0 : }
13646 :
13647 0 : return result;
13648 0 : }
13649 :
13650 :
13651 :
13652 :
13653 :
13654 0 : string EnumerationParser::toXML(const string& elementName, HolographyChannelTypeMod::HolographyChannelType e) {
13655 0 : return "<"+elementName+">"+CHolographyChannelType::name(e)+"</"+elementName+">";
13656 : }
13657 :
13658 0 : string EnumerationParser::toXML(const string& elementName, const vector<HolographyChannelTypeMod::HolographyChannelType>& v_e) {
13659 0 : ostringstream oss;
13660 : oss << "<" << elementName << ">"
13661 : << " 1"
13662 0 : << " " << v_e.size();
13663 :
13664 0 : for (unsigned int i = 0; i < v_e.size(); i++)
13665 0 : oss << " " << CHolographyChannelType::name(v_e.at(i));
13666 0 : oss << "</" << elementName << ">";
13667 0 : return oss.str();
13668 0 : }
13669 :
13670 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<HolographyChannelTypeMod::HolographyChannelType> >& vv_e) {
13671 0 : ostringstream oss;
13672 : oss << "<" << elementName << ">"
13673 : << " 2"
13674 0 : << " " <<vv_e.size()
13675 0 : << " " <<vv_e.at(0).size();
13676 :
13677 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
13678 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
13679 0 : oss << " " << CHolographyChannelType::name(vv_e.at(i).at(j));
13680 0 : oss << "</" << elementName << ">";
13681 0 : return oss.str();
13682 0 : }
13683 :
13684 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<HolographyChannelTypeMod::HolographyChannelType> > >& vvv_e) {
13685 0 : ostringstream oss;
13686 : oss << "<" << elementName << ">"
13687 : << " 3"
13688 0 : << " " <<vvv_e.size()
13689 0 : << " " <<vvv_e.at(0).size()
13690 0 : << " " <<vvv_e.at(0).at(0).size();
13691 :
13692 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
13693 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
13694 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
13695 0 : oss << " " << CHolographyChannelType::name(vvv_e.at(i).at(j).at(k));
13696 0 : oss << "</" << elementName << ">";
13697 0 : return oss.str();
13698 0 : }
13699 :
13700 0 : HolographyChannelTypeMod::HolographyChannelType EnumerationParser::getHolographyChannelType(const string &name, const string &tableName, const string &xmlDoc) {
13701 0 : string s = getField(xmlDoc,name);
13702 0 : if (s.length() == 0)
13703 0 : throw ConversionException("Error: Missing field \"" +
13704 0 : name + "\" or invalid syntax",tableName);
13705 :
13706 : HolographyChannelType result;
13707 : try {
13708 0 : result = CHolographyChannelType::newHolographyChannelType(s);
13709 : }
13710 0 : catch (...) {
13711 0 : throw ConversionException("Error: could not convert '"+s+"' into a HolographyChannelType.", tableName);
13712 0 : }
13713 0 : return result;
13714 0 : }
13715 :
13716 0 : vector<HolographyChannelTypeMod::HolographyChannelType> EnumerationParser::getHolographyChannelType1D(const string &name, const string &tableName, const string &xmlDoc) {
13717 0 : vector<HolographyChannelTypeMod::HolographyChannelType> result;
13718 :
13719 0 : string s = getField(xmlDoc,name);
13720 0 : if (s.length() == 0)
13721 0 : throw ConversionException("Error: Missing field \"" +
13722 0 : name + "\" or invalid syntax",tableName);
13723 :
13724 0 : istringstream iss;
13725 0 : iss.str(s);
13726 0 : vector<string> tokens;
13727 :
13728 : // Tokenize.
13729 0 : string buf;
13730 0 : while (iss >> buf) {
13731 0 : tokens.push_back(buf);
13732 : }
13733 :
13734 : // The length must be 2 at the minimum (there may be an empty array)
13735 0 : if (tokens.size() < 2)
13736 0 : throw ConversionException("Error: missing values in field \"" +
13737 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13738 :
13739 :
13740 :
13741 : // The number of dimension should be 1.
13742 0 : if (tokens.at(0) != "1")
13743 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
13744 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13745 :
13746 : // Then parse the size of the unique dimension
13747 0 : errno = 0;
13748 0 : int size1 = atoi(tokens.at(1).c_str());
13749 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13750 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13751 :
13752 0 : if (size1 < 0)
13753 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
13754 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13755 :
13756 0 : if (tokens.size() != (unsigned int) (size1 + 2))
13757 0 : throw ConversionException("Error: incorrect number of values in field \"" +
13758 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13759 :
13760 0 : int k = 2;
13761 : try {
13762 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
13763 0 : result.push_back(CHolographyChannelType::newHolographyChannelType(tokens.at(k).c_str()));
13764 0 : k++;
13765 : }
13766 : }
13767 0 : catch (...) {
13768 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a HolographyChannelType.", tableName);
13769 0 : }
13770 :
13771 0 : return result;
13772 0 : }
13773 :
13774 0 : vector<vector<HolographyChannelTypeMod::HolographyChannelType> > EnumerationParser::getHolographyChannelType2D(const string &name, const string &tableName, const string &xmlDoc) {
13775 0 : vector<vector<HolographyChannelTypeMod::HolographyChannelType> > result;
13776 :
13777 0 : string s = getField(xmlDoc,name);
13778 0 : if (s.length() == 0)
13779 0 : throw ConversionException("Error: Missing field \"" +
13780 0 : name + "\" or invalid syntax",tableName);
13781 :
13782 0 : istringstream iss;
13783 0 : iss.str(s);
13784 0 : vector<string> tokens;
13785 :
13786 : // Tokenize.
13787 0 : string buf;
13788 0 : while (iss >> buf) {
13789 0 : tokens.push_back(buf);
13790 : }
13791 :
13792 : // The length must be 3 at the minimum (there may be an empty array)
13793 0 : if (tokens.size() < 3)
13794 0 : throw ConversionException("Error: missing values in field \"" +
13795 0 : name + "\" or invalid syntax(" + s +"')",tableName);
13796 :
13797 :
13798 : // The number of dimension should be 2.
13799 0 : if (tokens.at(0) != "2")
13800 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
13801 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13802 :
13803 : // Then parse the size of the two dimensions
13804 0 : errno = 0;
13805 0 : int size1 = atoi(tokens.at(1).c_str());
13806 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13807 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13808 :
13809 0 : if (size1 <= 0)
13810 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
13811 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13812 0 : errno = 0;
13813 0 : int size2 = atoi(tokens.at(2).c_str());
13814 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13815 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13816 :
13817 0 : if (size2 < 0)
13818 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
13819 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13820 :
13821 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
13822 0 : throw ConversionException("Error: incorrect number of values in field \"" +
13823 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13824 :
13825 0 : int k = 3;
13826 : try {
13827 0 : vector<HolographyChannelTypeMod::HolographyChannelType> v_aux;
13828 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
13829 0 : v_aux.clear();
13830 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
13831 0 : v_aux.push_back(CHolographyChannelType::newHolographyChannelType(tokens.at(k).c_str()));
13832 0 : k++;
13833 : }
13834 0 : result.push_back(v_aux);
13835 : }
13836 0 : }
13837 0 : catch (...) {
13838 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a HolographyChannelType.", tableName);
13839 0 : }
13840 0 : return result;
13841 0 : }
13842 :
13843 :
13844 0 : vector<vector<vector<HolographyChannelTypeMod::HolographyChannelType> > > EnumerationParser::getHolographyChannelType3D(const string &name, const string &tableName, const string &xmlDoc) {
13845 0 : vector<vector<vector<HolographyChannelTypeMod::HolographyChannelType> > >result;
13846 :
13847 0 : string s = getField(xmlDoc,name);
13848 0 : if (s.length() == 0)
13849 0 : throw ConversionException("Error: Missing field \"" +
13850 0 : name + "\" or invalid syntax",tableName);
13851 :
13852 0 : istringstream iss;
13853 0 : iss.str(s);
13854 0 : vector<string> tokens;
13855 :
13856 : // Tokenize.
13857 0 : string buf;
13858 0 : while (iss >> buf) {
13859 0 : tokens.push_back(buf);
13860 : }
13861 :
13862 : // The length must be 4 at the minimum (there may be an empty array)
13863 0 : if (tokens.size() < 4)
13864 0 : throw ConversionException("Error: missing values in field \"" +
13865 0 : name + "\" or invalid syntax(" + s +"')",tableName);
13866 :
13867 :
13868 : // The number of dimension should be 3.
13869 0 : if (tokens.at(0) != "3")
13870 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
13871 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13872 :
13873 : // Then parse the size of the three dimensions
13874 0 : errno = 0;
13875 0 : int size1 = atoi(tokens.at(1).c_str());
13876 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13877 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13878 :
13879 0 : if (size1 <= 0)
13880 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
13881 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13882 :
13883 0 : errno = 0;
13884 0 : int size2 = atoi(tokens.at(2).c_str());
13885 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13886 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13887 :
13888 0 : if (size2 <= 0)
13889 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
13890 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13891 :
13892 0 : errno = 0;
13893 0 : int size3 = atoi(tokens.at(3).c_str());
13894 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
13895 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
13896 :
13897 :
13898 0 : if (size3 < 0)
13899 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
13900 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13901 :
13902 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
13903 0 : throw ConversionException("Error: incorrect number of values in field \"" +
13904 0 : name + "\" or invalid syntax('" + s +"')",tableName);
13905 :
13906 0 : int k = 4;
13907 : try {
13908 0 : vector<HolographyChannelTypeMod::HolographyChannelType> v_aux;
13909 0 : vector<vector<HolographyChannelTypeMod::HolographyChannelType> > vv_aux;
13910 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
13911 0 : vv_aux.clear();
13912 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
13913 0 : v_aux.clear();
13914 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
13915 0 : v_aux.push_back(CHolographyChannelType::newHolographyChannelType(tokens.at(k).c_str()));
13916 0 : k++;
13917 : }
13918 0 : vv_aux.push_back(v_aux);
13919 : }
13920 0 : result.push_back(vv_aux);
13921 : }
13922 0 : }
13923 0 : catch (...) {
13924 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a HolographyChannelType.", tableName);
13925 0 : }
13926 :
13927 0 : return result;
13928 0 : }
13929 :
13930 :
13931 :
13932 :
13933 :
13934 0 : string EnumerationParser::toXML(const string& elementName, FluxCalibrationMethodMod::FluxCalibrationMethod e) {
13935 0 : return "<"+elementName+">"+CFluxCalibrationMethod::name(e)+"</"+elementName+">";
13936 : }
13937 :
13938 0 : string EnumerationParser::toXML(const string& elementName, const vector<FluxCalibrationMethodMod::FluxCalibrationMethod>& v_e) {
13939 0 : ostringstream oss;
13940 : oss << "<" << elementName << ">"
13941 : << " 1"
13942 0 : << " " << v_e.size();
13943 :
13944 0 : for (unsigned int i = 0; i < v_e.size(); i++)
13945 0 : oss << " " << CFluxCalibrationMethod::name(v_e.at(i));
13946 0 : oss << "</" << elementName << ">";
13947 0 : return oss.str();
13948 0 : }
13949 :
13950 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<FluxCalibrationMethodMod::FluxCalibrationMethod> >& vv_e) {
13951 0 : ostringstream oss;
13952 : oss << "<" << elementName << ">"
13953 : << " 2"
13954 0 : << " " <<vv_e.size()
13955 0 : << " " <<vv_e.at(0).size();
13956 :
13957 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
13958 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
13959 0 : oss << " " << CFluxCalibrationMethod::name(vv_e.at(i).at(j));
13960 0 : oss << "</" << elementName << ">";
13961 0 : return oss.str();
13962 0 : }
13963 :
13964 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<FluxCalibrationMethodMod::FluxCalibrationMethod> > >& vvv_e) {
13965 0 : ostringstream oss;
13966 : oss << "<" << elementName << ">"
13967 : << " 3"
13968 0 : << " " <<vvv_e.size()
13969 0 : << " " <<vvv_e.at(0).size()
13970 0 : << " " <<vvv_e.at(0).at(0).size();
13971 :
13972 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
13973 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
13974 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
13975 0 : oss << " " << CFluxCalibrationMethod::name(vvv_e.at(i).at(j).at(k));
13976 0 : oss << "</" << elementName << ">";
13977 0 : return oss.str();
13978 0 : }
13979 :
13980 1 : FluxCalibrationMethodMod::FluxCalibrationMethod EnumerationParser::getFluxCalibrationMethod(const string &name, const string &tableName, const string &xmlDoc) {
13981 1 : string s = getField(xmlDoc,name);
13982 1 : if (s.length() == 0)
13983 0 : throw ConversionException("Error: Missing field \"" +
13984 0 : name + "\" or invalid syntax",tableName);
13985 :
13986 : FluxCalibrationMethod result;
13987 : try {
13988 1 : result = CFluxCalibrationMethod::newFluxCalibrationMethod(s);
13989 : }
13990 0 : catch (...) {
13991 0 : throw ConversionException("Error: could not convert '"+s+"' into a FluxCalibrationMethod.", tableName);
13992 0 : }
13993 1 : return result;
13994 1 : }
13995 :
13996 0 : vector<FluxCalibrationMethodMod::FluxCalibrationMethod> EnumerationParser::getFluxCalibrationMethod1D(const string &name, const string &tableName, const string &xmlDoc) {
13997 0 : vector<FluxCalibrationMethodMod::FluxCalibrationMethod> result;
13998 :
13999 0 : string s = getField(xmlDoc,name);
14000 0 : if (s.length() == 0)
14001 0 : throw ConversionException("Error: Missing field \"" +
14002 0 : name + "\" or invalid syntax",tableName);
14003 :
14004 0 : istringstream iss;
14005 0 : iss.str(s);
14006 0 : vector<string> tokens;
14007 :
14008 : // Tokenize.
14009 0 : string buf;
14010 0 : while (iss >> buf) {
14011 0 : tokens.push_back(buf);
14012 : }
14013 :
14014 : // The length must be 2 at the minimum (there may be an empty array)
14015 0 : if (tokens.size() < 2)
14016 0 : throw ConversionException("Error: missing values in field \"" +
14017 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14018 :
14019 :
14020 :
14021 : // The number of dimension should be 1.
14022 0 : if (tokens.at(0) != "1")
14023 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14024 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14025 :
14026 : // Then parse the size of the unique dimension
14027 0 : errno = 0;
14028 0 : int size1 = atoi(tokens.at(1).c_str());
14029 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14030 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14031 :
14032 0 : if (size1 < 0)
14033 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
14034 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14035 :
14036 0 : if (tokens.size() != (unsigned int) (size1 + 2))
14037 0 : throw ConversionException("Error: incorrect number of values in field \"" +
14038 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14039 :
14040 0 : int k = 2;
14041 : try {
14042 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
14043 0 : result.push_back(CFluxCalibrationMethod::newFluxCalibrationMethod(tokens.at(k).c_str()));
14044 0 : k++;
14045 : }
14046 : }
14047 0 : catch (...) {
14048 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a FluxCalibrationMethod.", tableName);
14049 0 : }
14050 :
14051 0 : return result;
14052 0 : }
14053 :
14054 0 : vector<vector<FluxCalibrationMethodMod::FluxCalibrationMethod> > EnumerationParser::getFluxCalibrationMethod2D(const string &name, const string &tableName, const string &xmlDoc) {
14055 0 : vector<vector<FluxCalibrationMethodMod::FluxCalibrationMethod> > result;
14056 :
14057 0 : string s = getField(xmlDoc,name);
14058 0 : if (s.length() == 0)
14059 0 : throw ConversionException("Error: Missing field \"" +
14060 0 : name + "\" or invalid syntax",tableName);
14061 :
14062 0 : istringstream iss;
14063 0 : iss.str(s);
14064 0 : vector<string> tokens;
14065 :
14066 : // Tokenize.
14067 0 : string buf;
14068 0 : while (iss >> buf) {
14069 0 : tokens.push_back(buf);
14070 : }
14071 :
14072 : // The length must be 3 at the minimum (there may be an empty array)
14073 0 : if (tokens.size() < 3)
14074 0 : throw ConversionException("Error: missing values in field \"" +
14075 0 : name + "\" or invalid syntax(" + s +"')",tableName);
14076 :
14077 :
14078 : // The number of dimension should be 2.
14079 0 : if (tokens.at(0) != "2")
14080 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14081 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14082 :
14083 : // Then parse the size of the two dimensions
14084 0 : errno = 0;
14085 0 : int size1 = atoi(tokens.at(1).c_str());
14086 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14087 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14088 :
14089 0 : if (size1 <= 0)
14090 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
14091 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14092 0 : errno = 0;
14093 0 : int size2 = atoi(tokens.at(2).c_str());
14094 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14095 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14096 :
14097 0 : if (size2 < 0)
14098 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
14099 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14100 :
14101 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
14102 0 : throw ConversionException("Error: incorrect number of values in field \"" +
14103 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14104 :
14105 0 : int k = 3;
14106 : try {
14107 0 : vector<FluxCalibrationMethodMod::FluxCalibrationMethod> v_aux;
14108 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
14109 0 : v_aux.clear();
14110 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
14111 0 : v_aux.push_back(CFluxCalibrationMethod::newFluxCalibrationMethod(tokens.at(k).c_str()));
14112 0 : k++;
14113 : }
14114 0 : result.push_back(v_aux);
14115 : }
14116 0 : }
14117 0 : catch (...) {
14118 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a FluxCalibrationMethod.", tableName);
14119 0 : }
14120 0 : return result;
14121 0 : }
14122 :
14123 :
14124 0 : vector<vector<vector<FluxCalibrationMethodMod::FluxCalibrationMethod> > > EnumerationParser::getFluxCalibrationMethod3D(const string &name, const string &tableName, const string &xmlDoc) {
14125 0 : vector<vector<vector<FluxCalibrationMethodMod::FluxCalibrationMethod> > >result;
14126 :
14127 0 : string s = getField(xmlDoc,name);
14128 0 : if (s.length() == 0)
14129 0 : throw ConversionException("Error: Missing field \"" +
14130 0 : name + "\" or invalid syntax",tableName);
14131 :
14132 0 : istringstream iss;
14133 0 : iss.str(s);
14134 0 : vector<string> tokens;
14135 :
14136 : // Tokenize.
14137 0 : string buf;
14138 0 : while (iss >> buf) {
14139 0 : tokens.push_back(buf);
14140 : }
14141 :
14142 : // The length must be 4 at the minimum (there may be an empty array)
14143 0 : if (tokens.size() < 4)
14144 0 : throw ConversionException("Error: missing values in field \"" +
14145 0 : name + "\" or invalid syntax(" + s +"')",tableName);
14146 :
14147 :
14148 : // The number of dimension should be 3.
14149 0 : if (tokens.at(0) != "3")
14150 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14151 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14152 :
14153 : // Then parse the size of the three dimensions
14154 0 : errno = 0;
14155 0 : int size1 = atoi(tokens.at(1).c_str());
14156 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14157 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14158 :
14159 0 : if (size1 <= 0)
14160 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
14161 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14162 :
14163 0 : errno = 0;
14164 0 : int size2 = atoi(tokens.at(2).c_str());
14165 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14166 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14167 :
14168 0 : if (size2 <= 0)
14169 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
14170 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14171 :
14172 0 : errno = 0;
14173 0 : int size3 = atoi(tokens.at(3).c_str());
14174 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14175 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14176 :
14177 :
14178 0 : if (size3 < 0)
14179 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
14180 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14181 :
14182 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
14183 0 : throw ConversionException("Error: incorrect number of values in field \"" +
14184 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14185 :
14186 0 : int k = 4;
14187 : try {
14188 0 : vector<FluxCalibrationMethodMod::FluxCalibrationMethod> v_aux;
14189 0 : vector<vector<FluxCalibrationMethodMod::FluxCalibrationMethod> > vv_aux;
14190 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
14191 0 : vv_aux.clear();
14192 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
14193 0 : v_aux.clear();
14194 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
14195 0 : v_aux.push_back(CFluxCalibrationMethod::newFluxCalibrationMethod(tokens.at(k).c_str()));
14196 0 : k++;
14197 : }
14198 0 : vv_aux.push_back(v_aux);
14199 : }
14200 0 : result.push_back(vv_aux);
14201 : }
14202 0 : }
14203 0 : catch (...) {
14204 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a FluxCalibrationMethod.", tableName);
14205 0 : }
14206 :
14207 0 : return result;
14208 0 : }
14209 :
14210 :
14211 :
14212 :
14213 :
14214 0 : string EnumerationParser::toXML(const string& elementName, PrimaryBeamDescriptionMod::PrimaryBeamDescription e) {
14215 0 : return "<"+elementName+">"+CPrimaryBeamDescription::name(e)+"</"+elementName+">";
14216 : }
14217 :
14218 0 : string EnumerationParser::toXML(const string& elementName, const vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription>& v_e) {
14219 0 : ostringstream oss;
14220 : oss << "<" << elementName << ">"
14221 : << " 1"
14222 0 : << " " << v_e.size();
14223 :
14224 0 : for (unsigned int i = 0; i < v_e.size(); i++)
14225 0 : oss << " " << CPrimaryBeamDescription::name(v_e.at(i));
14226 0 : oss << "</" << elementName << ">";
14227 0 : return oss.str();
14228 0 : }
14229 :
14230 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription> >& vv_e) {
14231 0 : ostringstream oss;
14232 : oss << "<" << elementName << ">"
14233 : << " 2"
14234 0 : << " " <<vv_e.size()
14235 0 : << " " <<vv_e.at(0).size();
14236 :
14237 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
14238 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
14239 0 : oss << " " << CPrimaryBeamDescription::name(vv_e.at(i).at(j));
14240 0 : oss << "</" << elementName << ">";
14241 0 : return oss.str();
14242 0 : }
14243 :
14244 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription> > >& vvv_e) {
14245 0 : ostringstream oss;
14246 : oss << "<" << elementName << ">"
14247 : << " 3"
14248 0 : << " " <<vvv_e.size()
14249 0 : << " " <<vvv_e.at(0).size()
14250 0 : << " " <<vvv_e.at(0).at(0).size();
14251 :
14252 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
14253 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
14254 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
14255 0 : oss << " " << CPrimaryBeamDescription::name(vvv_e.at(i).at(j).at(k));
14256 0 : oss << "</" << elementName << ">";
14257 0 : return oss.str();
14258 0 : }
14259 :
14260 0 : PrimaryBeamDescriptionMod::PrimaryBeamDescription EnumerationParser::getPrimaryBeamDescription(const string &name, const string &tableName, const string &xmlDoc) {
14261 0 : string s = getField(xmlDoc,name);
14262 0 : if (s.length() == 0)
14263 0 : throw ConversionException("Error: Missing field \"" +
14264 0 : name + "\" or invalid syntax",tableName);
14265 :
14266 : PrimaryBeamDescription result;
14267 : try {
14268 0 : result = CPrimaryBeamDescription::newPrimaryBeamDescription(s);
14269 : }
14270 0 : catch (...) {
14271 0 : throw ConversionException("Error: could not convert '"+s+"' into a PrimaryBeamDescription.", tableName);
14272 0 : }
14273 0 : return result;
14274 0 : }
14275 :
14276 0 : vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription> EnumerationParser::getPrimaryBeamDescription1D(const string &name, const string &tableName, const string &xmlDoc) {
14277 0 : vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription> result;
14278 :
14279 0 : string s = getField(xmlDoc,name);
14280 0 : if (s.length() == 0)
14281 0 : throw ConversionException("Error: Missing field \"" +
14282 0 : name + "\" or invalid syntax",tableName);
14283 :
14284 0 : istringstream iss;
14285 0 : iss.str(s);
14286 0 : vector<string> tokens;
14287 :
14288 : // Tokenize.
14289 0 : string buf;
14290 0 : while (iss >> buf) {
14291 0 : tokens.push_back(buf);
14292 : }
14293 :
14294 : // The length must be 2 at the minimum (there may be an empty array)
14295 0 : if (tokens.size() < 2)
14296 0 : throw ConversionException("Error: missing values in field \"" +
14297 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14298 :
14299 :
14300 :
14301 : // The number of dimension should be 1.
14302 0 : if (tokens.at(0) != "1")
14303 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14304 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14305 :
14306 : // Then parse the size of the unique dimension
14307 0 : errno = 0;
14308 0 : int size1 = atoi(tokens.at(1).c_str());
14309 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14310 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14311 :
14312 0 : if (size1 < 0)
14313 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
14314 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14315 :
14316 0 : if (tokens.size() != (unsigned int) (size1 + 2))
14317 0 : throw ConversionException("Error: incorrect number of values in field \"" +
14318 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14319 :
14320 0 : int k = 2;
14321 : try {
14322 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
14323 0 : result.push_back(CPrimaryBeamDescription::newPrimaryBeamDescription(tokens.at(k).c_str()));
14324 0 : k++;
14325 : }
14326 : }
14327 0 : catch (...) {
14328 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PrimaryBeamDescription.", tableName);
14329 0 : }
14330 :
14331 0 : return result;
14332 0 : }
14333 :
14334 0 : vector<vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription> > EnumerationParser::getPrimaryBeamDescription2D(const string &name, const string &tableName, const string &xmlDoc) {
14335 0 : vector<vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription> > result;
14336 :
14337 0 : string s = getField(xmlDoc,name);
14338 0 : if (s.length() == 0)
14339 0 : throw ConversionException("Error: Missing field \"" +
14340 0 : name + "\" or invalid syntax",tableName);
14341 :
14342 0 : istringstream iss;
14343 0 : iss.str(s);
14344 0 : vector<string> tokens;
14345 :
14346 : // Tokenize.
14347 0 : string buf;
14348 0 : while (iss >> buf) {
14349 0 : tokens.push_back(buf);
14350 : }
14351 :
14352 : // The length must be 3 at the minimum (there may be an empty array)
14353 0 : if (tokens.size() < 3)
14354 0 : throw ConversionException("Error: missing values in field \"" +
14355 0 : name + "\" or invalid syntax(" + s +"')",tableName);
14356 :
14357 :
14358 : // The number of dimension should be 2.
14359 0 : if (tokens.at(0) != "2")
14360 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14361 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14362 :
14363 : // Then parse the size of the two dimensions
14364 0 : errno = 0;
14365 0 : int size1 = atoi(tokens.at(1).c_str());
14366 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14367 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14368 :
14369 0 : if (size1 <= 0)
14370 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
14371 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14372 0 : errno = 0;
14373 0 : int size2 = atoi(tokens.at(2).c_str());
14374 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14375 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14376 :
14377 0 : if (size2 < 0)
14378 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
14379 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14380 :
14381 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
14382 0 : throw ConversionException("Error: incorrect number of values in field \"" +
14383 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14384 :
14385 0 : int k = 3;
14386 : try {
14387 0 : vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription> v_aux;
14388 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
14389 0 : v_aux.clear();
14390 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
14391 0 : v_aux.push_back(CPrimaryBeamDescription::newPrimaryBeamDescription(tokens.at(k).c_str()));
14392 0 : k++;
14393 : }
14394 0 : result.push_back(v_aux);
14395 : }
14396 0 : }
14397 0 : catch (...) {
14398 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PrimaryBeamDescription.", tableName);
14399 0 : }
14400 0 : return result;
14401 0 : }
14402 :
14403 :
14404 0 : vector<vector<vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription> > > EnumerationParser::getPrimaryBeamDescription3D(const string &name, const string &tableName, const string &xmlDoc) {
14405 0 : vector<vector<vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription> > >result;
14406 :
14407 0 : string s = getField(xmlDoc,name);
14408 0 : if (s.length() == 0)
14409 0 : throw ConversionException("Error: Missing field \"" +
14410 0 : name + "\" or invalid syntax",tableName);
14411 :
14412 0 : istringstream iss;
14413 0 : iss.str(s);
14414 0 : vector<string> tokens;
14415 :
14416 : // Tokenize.
14417 0 : string buf;
14418 0 : while (iss >> buf) {
14419 0 : tokens.push_back(buf);
14420 : }
14421 :
14422 : // The length must be 4 at the minimum (there may be an empty array)
14423 0 : if (tokens.size() < 4)
14424 0 : throw ConversionException("Error: missing values in field \"" +
14425 0 : name + "\" or invalid syntax(" + s +"')",tableName);
14426 :
14427 :
14428 : // The number of dimension should be 3.
14429 0 : if (tokens.at(0) != "3")
14430 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14431 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14432 :
14433 : // Then parse the size of the three dimensions
14434 0 : errno = 0;
14435 0 : int size1 = atoi(tokens.at(1).c_str());
14436 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14437 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14438 :
14439 0 : if (size1 <= 0)
14440 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
14441 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14442 :
14443 0 : errno = 0;
14444 0 : int size2 = atoi(tokens.at(2).c_str());
14445 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14446 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14447 :
14448 0 : if (size2 <= 0)
14449 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
14450 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14451 :
14452 0 : errno = 0;
14453 0 : int size3 = atoi(tokens.at(3).c_str());
14454 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14455 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14456 :
14457 :
14458 0 : if (size3 < 0)
14459 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
14460 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14461 :
14462 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
14463 0 : throw ConversionException("Error: incorrect number of values in field \"" +
14464 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14465 :
14466 0 : int k = 4;
14467 : try {
14468 0 : vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription> v_aux;
14469 0 : vector<vector<PrimaryBeamDescriptionMod::PrimaryBeamDescription> > vv_aux;
14470 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
14471 0 : vv_aux.clear();
14472 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
14473 0 : v_aux.clear();
14474 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
14475 0 : v_aux.push_back(CPrimaryBeamDescription::newPrimaryBeamDescription(tokens.at(k).c_str()));
14476 0 : k++;
14477 : }
14478 0 : vv_aux.push_back(v_aux);
14479 : }
14480 0 : result.push_back(vv_aux);
14481 : }
14482 0 : }
14483 0 : catch (...) {
14484 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a PrimaryBeamDescription.", tableName);
14485 0 : }
14486 :
14487 0 : return result;
14488 0 : }
14489 :
14490 :
14491 :
14492 :
14493 :
14494 0 : string EnumerationParser::toXML(const string& elementName, TimeScaleMod::TimeScale e) {
14495 0 : return "<"+elementName+">"+CTimeScale::name(e)+"</"+elementName+">";
14496 : }
14497 :
14498 0 : string EnumerationParser::toXML(const string& elementName, const vector<TimeScaleMod::TimeScale>& v_e) {
14499 0 : ostringstream oss;
14500 : oss << "<" << elementName << ">"
14501 : << " 1"
14502 0 : << " " << v_e.size();
14503 :
14504 0 : for (unsigned int i = 0; i < v_e.size(); i++)
14505 0 : oss << " " << CTimeScale::name(v_e.at(i));
14506 0 : oss << "</" << elementName << ">";
14507 0 : return oss.str();
14508 0 : }
14509 :
14510 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<TimeScaleMod::TimeScale> >& vv_e) {
14511 0 : ostringstream oss;
14512 : oss << "<" << elementName << ">"
14513 : << " 2"
14514 0 : << " " <<vv_e.size()
14515 0 : << " " <<vv_e.at(0).size();
14516 :
14517 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
14518 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
14519 0 : oss << " " << CTimeScale::name(vv_e.at(i).at(j));
14520 0 : oss << "</" << elementName << ">";
14521 0 : return oss.str();
14522 0 : }
14523 :
14524 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<TimeScaleMod::TimeScale> > >& vvv_e) {
14525 0 : ostringstream oss;
14526 : oss << "<" << elementName << ">"
14527 : << " 3"
14528 0 : << " " <<vvv_e.size()
14529 0 : << " " <<vvv_e.at(0).size()
14530 0 : << " " <<vvv_e.at(0).at(0).size();
14531 :
14532 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
14533 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
14534 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
14535 0 : oss << " " << CTimeScale::name(vvv_e.at(i).at(j).at(k));
14536 0 : oss << "</" << elementName << ">";
14537 0 : return oss.str();
14538 0 : }
14539 :
14540 0 : TimeScaleMod::TimeScale EnumerationParser::getTimeScale(const string &name, const string &tableName, const string &xmlDoc) {
14541 0 : string s = getField(xmlDoc,name);
14542 0 : if (s.length() == 0)
14543 0 : throw ConversionException("Error: Missing field \"" +
14544 0 : name + "\" or invalid syntax",tableName);
14545 :
14546 : TimeScale result;
14547 : try {
14548 0 : result = CTimeScale::newTimeScale(s);
14549 : }
14550 0 : catch (...) {
14551 0 : throw ConversionException("Error: could not convert '"+s+"' into a TimeScale.", tableName);
14552 0 : }
14553 0 : return result;
14554 0 : }
14555 :
14556 0 : vector<TimeScaleMod::TimeScale> EnumerationParser::getTimeScale1D(const string &name, const string &tableName, const string &xmlDoc) {
14557 0 : vector<TimeScaleMod::TimeScale> result;
14558 :
14559 0 : string s = getField(xmlDoc,name);
14560 0 : if (s.length() == 0)
14561 0 : throw ConversionException("Error: Missing field \"" +
14562 0 : name + "\" or invalid syntax",tableName);
14563 :
14564 0 : istringstream iss;
14565 0 : iss.str(s);
14566 0 : vector<string> tokens;
14567 :
14568 : // Tokenize.
14569 0 : string buf;
14570 0 : while (iss >> buf) {
14571 0 : tokens.push_back(buf);
14572 : }
14573 :
14574 : // The length must be 2 at the minimum (there may be an empty array)
14575 0 : if (tokens.size() < 2)
14576 0 : throw ConversionException("Error: missing values in field \"" +
14577 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14578 :
14579 :
14580 :
14581 : // The number of dimension should be 1.
14582 0 : if (tokens.at(0) != "1")
14583 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14584 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14585 :
14586 : // Then parse the size of the unique dimension
14587 0 : errno = 0;
14588 0 : int size1 = atoi(tokens.at(1).c_str());
14589 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14590 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14591 :
14592 0 : if (size1 < 0)
14593 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
14594 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14595 :
14596 0 : if (tokens.size() != (unsigned int) (size1 + 2))
14597 0 : throw ConversionException("Error: incorrect number of values in field \"" +
14598 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14599 :
14600 0 : int k = 2;
14601 : try {
14602 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
14603 0 : result.push_back(CTimeScale::newTimeScale(tokens.at(k).c_str()));
14604 0 : k++;
14605 : }
14606 : }
14607 0 : catch (...) {
14608 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a TimeScale.", tableName);
14609 0 : }
14610 :
14611 0 : return result;
14612 0 : }
14613 :
14614 0 : vector<vector<TimeScaleMod::TimeScale> > EnumerationParser::getTimeScale2D(const string &name, const string &tableName, const string &xmlDoc) {
14615 0 : vector<vector<TimeScaleMod::TimeScale> > result;
14616 :
14617 0 : string s = getField(xmlDoc,name);
14618 0 : if (s.length() == 0)
14619 0 : throw ConversionException("Error: Missing field \"" +
14620 0 : name + "\" or invalid syntax",tableName);
14621 :
14622 0 : istringstream iss;
14623 0 : iss.str(s);
14624 0 : vector<string> tokens;
14625 :
14626 : // Tokenize.
14627 0 : string buf;
14628 0 : while (iss >> buf) {
14629 0 : tokens.push_back(buf);
14630 : }
14631 :
14632 : // The length must be 3 at the minimum (there may be an empty array)
14633 0 : if (tokens.size() < 3)
14634 0 : throw ConversionException("Error: missing values in field \"" +
14635 0 : name + "\" or invalid syntax(" + s +"')",tableName);
14636 :
14637 :
14638 : // The number of dimension should be 2.
14639 0 : if (tokens.at(0) != "2")
14640 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14641 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14642 :
14643 : // Then parse the size of the two dimensions
14644 0 : errno = 0;
14645 0 : int size1 = atoi(tokens.at(1).c_str());
14646 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14647 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14648 :
14649 0 : if (size1 <= 0)
14650 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
14651 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14652 0 : errno = 0;
14653 0 : int size2 = atoi(tokens.at(2).c_str());
14654 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14655 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14656 :
14657 0 : if (size2 < 0)
14658 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
14659 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14660 :
14661 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
14662 0 : throw ConversionException("Error: incorrect number of values in field \"" +
14663 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14664 :
14665 0 : int k = 3;
14666 : try {
14667 0 : vector<TimeScaleMod::TimeScale> v_aux;
14668 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
14669 0 : v_aux.clear();
14670 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
14671 0 : v_aux.push_back(CTimeScale::newTimeScale(tokens.at(k).c_str()));
14672 0 : k++;
14673 : }
14674 0 : result.push_back(v_aux);
14675 : }
14676 0 : }
14677 0 : catch (...) {
14678 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a TimeScale.", tableName);
14679 0 : }
14680 0 : return result;
14681 0 : }
14682 :
14683 :
14684 0 : vector<vector<vector<TimeScaleMod::TimeScale> > > EnumerationParser::getTimeScale3D(const string &name, const string &tableName, const string &xmlDoc) {
14685 0 : vector<vector<vector<TimeScaleMod::TimeScale> > >result;
14686 :
14687 0 : string s = getField(xmlDoc,name);
14688 0 : if (s.length() == 0)
14689 0 : throw ConversionException("Error: Missing field \"" +
14690 0 : name + "\" or invalid syntax",tableName);
14691 :
14692 0 : istringstream iss;
14693 0 : iss.str(s);
14694 0 : vector<string> tokens;
14695 :
14696 : // Tokenize.
14697 0 : string buf;
14698 0 : while (iss >> buf) {
14699 0 : tokens.push_back(buf);
14700 : }
14701 :
14702 : // The length must be 4 at the minimum (there may be an empty array)
14703 0 : if (tokens.size() < 4)
14704 0 : throw ConversionException("Error: missing values in field \"" +
14705 0 : name + "\" or invalid syntax(" + s +"')",tableName);
14706 :
14707 :
14708 : // The number of dimension should be 3.
14709 0 : if (tokens.at(0) != "3")
14710 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14711 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14712 :
14713 : // Then parse the size of the three dimensions
14714 0 : errno = 0;
14715 0 : int size1 = atoi(tokens.at(1).c_str());
14716 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14717 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14718 :
14719 0 : if (size1 <= 0)
14720 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
14721 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14722 :
14723 0 : errno = 0;
14724 0 : int size2 = atoi(tokens.at(2).c_str());
14725 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14726 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14727 :
14728 0 : if (size2 <= 0)
14729 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
14730 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14731 :
14732 0 : errno = 0;
14733 0 : int size3 = atoi(tokens.at(3).c_str());
14734 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14735 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14736 :
14737 :
14738 0 : if (size3 < 0)
14739 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
14740 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14741 :
14742 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
14743 0 : throw ConversionException("Error: incorrect number of values in field \"" +
14744 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14745 :
14746 0 : int k = 4;
14747 : try {
14748 0 : vector<TimeScaleMod::TimeScale> v_aux;
14749 0 : vector<vector<TimeScaleMod::TimeScale> > vv_aux;
14750 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
14751 0 : vv_aux.clear();
14752 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
14753 0 : v_aux.clear();
14754 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
14755 0 : v_aux.push_back(CTimeScale::newTimeScale(tokens.at(k).c_str()));
14756 0 : k++;
14757 : }
14758 0 : vv_aux.push_back(v_aux);
14759 : }
14760 0 : result.push_back(vv_aux);
14761 : }
14762 0 : }
14763 0 : catch (...) {
14764 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a TimeScale.", tableName);
14765 0 : }
14766 :
14767 0 : return result;
14768 0 : }
14769 :
14770 :
14771 :
14772 :
14773 :
14774 0 : string EnumerationParser::toXML(const string& elementName, DataScaleMod::DataScale e) {
14775 0 : return "<"+elementName+">"+CDataScale::name(e)+"</"+elementName+">";
14776 : }
14777 :
14778 0 : string EnumerationParser::toXML(const string& elementName, const vector<DataScaleMod::DataScale>& v_e) {
14779 0 : ostringstream oss;
14780 : oss << "<" << elementName << ">"
14781 : << " 1"
14782 0 : << " " << v_e.size();
14783 :
14784 0 : for (unsigned int i = 0; i < v_e.size(); i++)
14785 0 : oss << " " << CDataScale::name(v_e.at(i));
14786 0 : oss << "</" << elementName << ">";
14787 0 : return oss.str();
14788 0 : }
14789 :
14790 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<DataScaleMod::DataScale> >& vv_e) {
14791 0 : ostringstream oss;
14792 : oss << "<" << elementName << ">"
14793 : << " 2"
14794 0 : << " " <<vv_e.size()
14795 0 : << " " <<vv_e.at(0).size();
14796 :
14797 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
14798 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
14799 0 : oss << " " << CDataScale::name(vv_e.at(i).at(j));
14800 0 : oss << "</" << elementName << ">";
14801 0 : return oss.str();
14802 0 : }
14803 :
14804 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<DataScaleMod::DataScale> > >& vvv_e) {
14805 0 : ostringstream oss;
14806 : oss << "<" << elementName << ">"
14807 : << " 3"
14808 0 : << " " <<vvv_e.size()
14809 0 : << " " <<vvv_e.at(0).size()
14810 0 : << " " <<vvv_e.at(0).at(0).size();
14811 :
14812 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
14813 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
14814 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
14815 0 : oss << " " << CDataScale::name(vvv_e.at(i).at(j).at(k));
14816 0 : oss << "</" << elementName << ">";
14817 0 : return oss.str();
14818 0 : }
14819 :
14820 0 : DataScaleMod::DataScale EnumerationParser::getDataScale(const string &name, const string &tableName, const string &xmlDoc) {
14821 0 : string s = getField(xmlDoc,name);
14822 0 : if (s.length() == 0)
14823 0 : throw ConversionException("Error: Missing field \"" +
14824 0 : name + "\" or invalid syntax",tableName);
14825 :
14826 : DataScale result;
14827 : try {
14828 0 : result = CDataScale::newDataScale(s);
14829 : }
14830 0 : catch (...) {
14831 0 : throw ConversionException("Error: could not convert '"+s+"' into a DataScale.", tableName);
14832 0 : }
14833 0 : return result;
14834 0 : }
14835 :
14836 0 : vector<DataScaleMod::DataScale> EnumerationParser::getDataScale1D(const string &name, const string &tableName, const string &xmlDoc) {
14837 0 : vector<DataScaleMod::DataScale> result;
14838 :
14839 0 : string s = getField(xmlDoc,name);
14840 0 : if (s.length() == 0)
14841 0 : throw ConversionException("Error: Missing field \"" +
14842 0 : name + "\" or invalid syntax",tableName);
14843 :
14844 0 : istringstream iss;
14845 0 : iss.str(s);
14846 0 : vector<string> tokens;
14847 :
14848 : // Tokenize.
14849 0 : string buf;
14850 0 : while (iss >> buf) {
14851 0 : tokens.push_back(buf);
14852 : }
14853 :
14854 : // The length must be 2 at the minimum (there may be an empty array)
14855 0 : if (tokens.size() < 2)
14856 0 : throw ConversionException("Error: missing values in field \"" +
14857 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14858 :
14859 :
14860 :
14861 : // The number of dimension should be 1.
14862 0 : if (tokens.at(0) != "1")
14863 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14864 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14865 :
14866 : // Then parse the size of the unique dimension
14867 0 : errno = 0;
14868 0 : int size1 = atoi(tokens.at(1).c_str());
14869 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14870 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14871 :
14872 0 : if (size1 < 0)
14873 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
14874 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14875 :
14876 0 : if (tokens.size() != (unsigned int) (size1 + 2))
14877 0 : throw ConversionException("Error: incorrect number of values in field \"" +
14878 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14879 :
14880 0 : int k = 2;
14881 : try {
14882 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
14883 0 : result.push_back(CDataScale::newDataScale(tokens.at(k).c_str()));
14884 0 : k++;
14885 : }
14886 : }
14887 0 : catch (...) {
14888 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DataScale.", tableName);
14889 0 : }
14890 :
14891 0 : return result;
14892 0 : }
14893 :
14894 0 : vector<vector<DataScaleMod::DataScale> > EnumerationParser::getDataScale2D(const string &name, const string &tableName, const string &xmlDoc) {
14895 0 : vector<vector<DataScaleMod::DataScale> > result;
14896 :
14897 0 : string s = getField(xmlDoc,name);
14898 0 : if (s.length() == 0)
14899 0 : throw ConversionException("Error: Missing field \"" +
14900 0 : name + "\" or invalid syntax",tableName);
14901 :
14902 0 : istringstream iss;
14903 0 : iss.str(s);
14904 0 : vector<string> tokens;
14905 :
14906 : // Tokenize.
14907 0 : string buf;
14908 0 : while (iss >> buf) {
14909 0 : tokens.push_back(buf);
14910 : }
14911 :
14912 : // The length must be 3 at the minimum (there may be an empty array)
14913 0 : if (tokens.size() < 3)
14914 0 : throw ConversionException("Error: missing values in field \"" +
14915 0 : name + "\" or invalid syntax(" + s +"')",tableName);
14916 :
14917 :
14918 : // The number of dimension should be 2.
14919 0 : if (tokens.at(0) != "2")
14920 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14921 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14922 :
14923 : // Then parse the size of the two dimensions
14924 0 : errno = 0;
14925 0 : int size1 = atoi(tokens.at(1).c_str());
14926 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14927 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14928 :
14929 0 : if (size1 <= 0)
14930 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
14931 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14932 0 : errno = 0;
14933 0 : int size2 = atoi(tokens.at(2).c_str());
14934 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14935 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14936 :
14937 0 : if (size2 < 0)
14938 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
14939 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14940 :
14941 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
14942 0 : throw ConversionException("Error: incorrect number of values in field \"" +
14943 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14944 :
14945 0 : int k = 3;
14946 : try {
14947 0 : vector<DataScaleMod::DataScale> v_aux;
14948 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
14949 0 : v_aux.clear();
14950 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
14951 0 : v_aux.push_back(CDataScale::newDataScale(tokens.at(k).c_str()));
14952 0 : k++;
14953 : }
14954 0 : result.push_back(v_aux);
14955 : }
14956 0 : }
14957 0 : catch (...) {
14958 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DataScale.", tableName);
14959 0 : }
14960 0 : return result;
14961 0 : }
14962 :
14963 :
14964 0 : vector<vector<vector<DataScaleMod::DataScale> > > EnumerationParser::getDataScale3D(const string &name, const string &tableName, const string &xmlDoc) {
14965 0 : vector<vector<vector<DataScaleMod::DataScale> > >result;
14966 :
14967 0 : string s = getField(xmlDoc,name);
14968 0 : if (s.length() == 0)
14969 0 : throw ConversionException("Error: Missing field \"" +
14970 0 : name + "\" or invalid syntax",tableName);
14971 :
14972 0 : istringstream iss;
14973 0 : iss.str(s);
14974 0 : vector<string> tokens;
14975 :
14976 : // Tokenize.
14977 0 : string buf;
14978 0 : while (iss >> buf) {
14979 0 : tokens.push_back(buf);
14980 : }
14981 :
14982 : // The length must be 4 at the minimum (there may be an empty array)
14983 0 : if (tokens.size() < 4)
14984 0 : throw ConversionException("Error: missing values in field \"" +
14985 0 : name + "\" or invalid syntax(" + s +"')",tableName);
14986 :
14987 :
14988 : // The number of dimension should be 3.
14989 0 : if (tokens.at(0) != "3")
14990 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
14991 0 : name + "\" or invalid syntax('" + s +"')",tableName);
14992 :
14993 : // Then parse the size of the three dimensions
14994 0 : errno = 0;
14995 0 : int size1 = atoi(tokens.at(1).c_str());
14996 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
14997 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
14998 :
14999 0 : if (size1 <= 0)
15000 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
15001 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15002 :
15003 0 : errno = 0;
15004 0 : int size2 = atoi(tokens.at(2).c_str());
15005 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15006 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15007 :
15008 0 : if (size2 <= 0)
15009 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
15010 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15011 :
15012 0 : errno = 0;
15013 0 : int size3 = atoi(tokens.at(3).c_str());
15014 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15015 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15016 :
15017 :
15018 0 : if (size3 < 0)
15019 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
15020 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15021 :
15022 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
15023 0 : throw ConversionException("Error: incorrect number of values in field \"" +
15024 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15025 :
15026 0 : int k = 4;
15027 : try {
15028 0 : vector<DataScaleMod::DataScale> v_aux;
15029 0 : vector<vector<DataScaleMod::DataScale> > vv_aux;
15030 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
15031 0 : vv_aux.clear();
15032 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
15033 0 : v_aux.clear();
15034 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
15035 0 : v_aux.push_back(CDataScale::newDataScale(tokens.at(k).c_str()));
15036 0 : k++;
15037 : }
15038 0 : vv_aux.push_back(v_aux);
15039 : }
15040 0 : result.push_back(vv_aux);
15041 : }
15042 0 : }
15043 0 : catch (...) {
15044 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a DataScale.", tableName);
15045 0 : }
15046 :
15047 0 : return result;
15048 0 : }
15049 :
15050 :
15051 :
15052 :
15053 :
15054 0 : string EnumerationParser::toXML(const string& elementName, WeightTypeMod::WeightType e) {
15055 0 : return "<"+elementName+">"+CWeightType::name(e)+"</"+elementName+">";
15056 : }
15057 :
15058 0 : string EnumerationParser::toXML(const string& elementName, const vector<WeightTypeMod::WeightType>& v_e) {
15059 0 : ostringstream oss;
15060 : oss << "<" << elementName << ">"
15061 : << " 1"
15062 0 : << " " << v_e.size();
15063 :
15064 0 : for (unsigned int i = 0; i < v_e.size(); i++)
15065 0 : oss << " " << CWeightType::name(v_e.at(i));
15066 0 : oss << "</" << elementName << ">";
15067 0 : return oss.str();
15068 0 : }
15069 :
15070 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<WeightTypeMod::WeightType> >& vv_e) {
15071 0 : ostringstream oss;
15072 : oss << "<" << elementName << ">"
15073 : << " 2"
15074 0 : << " " <<vv_e.size()
15075 0 : << " " <<vv_e.at(0).size();
15076 :
15077 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
15078 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
15079 0 : oss << " " << CWeightType::name(vv_e.at(i).at(j));
15080 0 : oss << "</" << elementName << ">";
15081 0 : return oss.str();
15082 0 : }
15083 :
15084 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<WeightTypeMod::WeightType> > >& vvv_e) {
15085 0 : ostringstream oss;
15086 : oss << "<" << elementName << ">"
15087 : << " 3"
15088 0 : << " " <<vvv_e.size()
15089 0 : << " " <<vvv_e.at(0).size()
15090 0 : << " " <<vvv_e.at(0).at(0).size();
15091 :
15092 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
15093 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
15094 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
15095 0 : oss << " " << CWeightType::name(vvv_e.at(i).at(j).at(k));
15096 0 : oss << "</" << elementName << ">";
15097 0 : return oss.str();
15098 0 : }
15099 :
15100 0 : WeightTypeMod::WeightType EnumerationParser::getWeightType(const string &name, const string &tableName, const string &xmlDoc) {
15101 0 : string s = getField(xmlDoc,name);
15102 0 : if (s.length() == 0)
15103 0 : throw ConversionException("Error: Missing field \"" +
15104 0 : name + "\" or invalid syntax",tableName);
15105 :
15106 : WeightType result;
15107 : try {
15108 0 : result = CWeightType::newWeightType(s);
15109 : }
15110 0 : catch (...) {
15111 0 : throw ConversionException("Error: could not convert '"+s+"' into a WeightType.", tableName);
15112 0 : }
15113 0 : return result;
15114 0 : }
15115 :
15116 0 : vector<WeightTypeMod::WeightType> EnumerationParser::getWeightType1D(const string &name, const string &tableName, const string &xmlDoc) {
15117 0 : vector<WeightTypeMod::WeightType> result;
15118 :
15119 0 : string s = getField(xmlDoc,name);
15120 0 : if (s.length() == 0)
15121 0 : throw ConversionException("Error: Missing field \"" +
15122 0 : name + "\" or invalid syntax",tableName);
15123 :
15124 0 : istringstream iss;
15125 0 : iss.str(s);
15126 0 : vector<string> tokens;
15127 :
15128 : // Tokenize.
15129 0 : string buf;
15130 0 : while (iss >> buf) {
15131 0 : tokens.push_back(buf);
15132 : }
15133 :
15134 : // The length must be 2 at the minimum (there may be an empty array)
15135 0 : if (tokens.size() < 2)
15136 0 : throw ConversionException("Error: missing values in field \"" +
15137 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15138 :
15139 :
15140 :
15141 : // The number of dimension should be 1.
15142 0 : if (tokens.at(0) != "1")
15143 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
15144 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15145 :
15146 : // Then parse the size of the unique dimension
15147 0 : errno = 0;
15148 0 : int size1 = atoi(tokens.at(1).c_str());
15149 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15150 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15151 :
15152 0 : if (size1 < 0)
15153 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
15154 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15155 :
15156 0 : if (tokens.size() != (unsigned int) (size1 + 2))
15157 0 : throw ConversionException("Error: incorrect number of values in field \"" +
15158 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15159 :
15160 0 : int k = 2;
15161 : try {
15162 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
15163 0 : result.push_back(CWeightType::newWeightType(tokens.at(k).c_str()));
15164 0 : k++;
15165 : }
15166 : }
15167 0 : catch (...) {
15168 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a WeightType.", tableName);
15169 0 : }
15170 :
15171 0 : return result;
15172 0 : }
15173 :
15174 0 : vector<vector<WeightTypeMod::WeightType> > EnumerationParser::getWeightType2D(const string &name, const string &tableName, const string &xmlDoc) {
15175 0 : vector<vector<WeightTypeMod::WeightType> > result;
15176 :
15177 0 : string s = getField(xmlDoc,name);
15178 0 : if (s.length() == 0)
15179 0 : throw ConversionException("Error: Missing field \"" +
15180 0 : name + "\" or invalid syntax",tableName);
15181 :
15182 0 : istringstream iss;
15183 0 : iss.str(s);
15184 0 : vector<string> tokens;
15185 :
15186 : // Tokenize.
15187 0 : string buf;
15188 0 : while (iss >> buf) {
15189 0 : tokens.push_back(buf);
15190 : }
15191 :
15192 : // The length must be 3 at the minimum (there may be an empty array)
15193 0 : if (tokens.size() < 3)
15194 0 : throw ConversionException("Error: missing values in field \"" +
15195 0 : name + "\" or invalid syntax(" + s +"')",tableName);
15196 :
15197 :
15198 : // The number of dimension should be 2.
15199 0 : if (tokens.at(0) != "2")
15200 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
15201 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15202 :
15203 : // Then parse the size of the two dimensions
15204 0 : errno = 0;
15205 0 : int size1 = atoi(tokens.at(1).c_str());
15206 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15207 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15208 :
15209 0 : if (size1 <= 0)
15210 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
15211 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15212 0 : errno = 0;
15213 0 : int size2 = atoi(tokens.at(2).c_str());
15214 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15215 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15216 :
15217 0 : if (size2 < 0)
15218 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
15219 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15220 :
15221 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
15222 0 : throw ConversionException("Error: incorrect number of values in field \"" +
15223 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15224 :
15225 0 : int k = 3;
15226 : try {
15227 0 : vector<WeightTypeMod::WeightType> v_aux;
15228 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
15229 0 : v_aux.clear();
15230 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
15231 0 : v_aux.push_back(CWeightType::newWeightType(tokens.at(k).c_str()));
15232 0 : k++;
15233 : }
15234 0 : result.push_back(v_aux);
15235 : }
15236 0 : }
15237 0 : catch (...) {
15238 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a WeightType.", tableName);
15239 0 : }
15240 0 : return result;
15241 0 : }
15242 :
15243 :
15244 0 : vector<vector<vector<WeightTypeMod::WeightType> > > EnumerationParser::getWeightType3D(const string &name, const string &tableName, const string &xmlDoc) {
15245 0 : vector<vector<vector<WeightTypeMod::WeightType> > >result;
15246 :
15247 0 : string s = getField(xmlDoc,name);
15248 0 : if (s.length() == 0)
15249 0 : throw ConversionException("Error: Missing field \"" +
15250 0 : name + "\" or invalid syntax",tableName);
15251 :
15252 0 : istringstream iss;
15253 0 : iss.str(s);
15254 0 : vector<string> tokens;
15255 :
15256 : // Tokenize.
15257 0 : string buf;
15258 0 : while (iss >> buf) {
15259 0 : tokens.push_back(buf);
15260 : }
15261 :
15262 : // The length must be 4 at the minimum (there may be an empty array)
15263 0 : if (tokens.size() < 4)
15264 0 : throw ConversionException("Error: missing values in field \"" +
15265 0 : name + "\" or invalid syntax(" + s +"')",tableName);
15266 :
15267 :
15268 : // The number of dimension should be 3.
15269 0 : if (tokens.at(0) != "3")
15270 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
15271 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15272 :
15273 : // Then parse the size of the three dimensions
15274 0 : errno = 0;
15275 0 : int size1 = atoi(tokens.at(1).c_str());
15276 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15277 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15278 :
15279 0 : if (size1 <= 0)
15280 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
15281 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15282 :
15283 0 : errno = 0;
15284 0 : int size2 = atoi(tokens.at(2).c_str());
15285 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15286 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15287 :
15288 0 : if (size2 <= 0)
15289 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
15290 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15291 :
15292 0 : errno = 0;
15293 0 : int size3 = atoi(tokens.at(3).c_str());
15294 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15295 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15296 :
15297 :
15298 0 : if (size3 < 0)
15299 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
15300 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15301 :
15302 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
15303 0 : throw ConversionException("Error: incorrect number of values in field \"" +
15304 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15305 :
15306 0 : int k = 4;
15307 : try {
15308 0 : vector<WeightTypeMod::WeightType> v_aux;
15309 0 : vector<vector<WeightTypeMod::WeightType> > vv_aux;
15310 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
15311 0 : vv_aux.clear();
15312 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
15313 0 : v_aux.clear();
15314 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
15315 0 : v_aux.push_back(CWeightType::newWeightType(tokens.at(k).c_str()));
15316 0 : k++;
15317 : }
15318 0 : vv_aux.push_back(v_aux);
15319 : }
15320 0 : result.push_back(vv_aux);
15321 : }
15322 0 : }
15323 0 : catch (...) {
15324 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a WeightType.", tableName);
15325 0 : }
15326 :
15327 0 : return result;
15328 0 : }
15329 :
15330 :
15331 :
15332 :
15333 :
15334 0 : string EnumerationParser::toXML(const string& elementName, DifferenceTypeMod::DifferenceType e) {
15335 0 : return "<"+elementName+">"+CDifferenceType::name(e)+"</"+elementName+">";
15336 : }
15337 :
15338 0 : string EnumerationParser::toXML(const string& elementName, const vector<DifferenceTypeMod::DifferenceType>& v_e) {
15339 0 : ostringstream oss;
15340 : oss << "<" << elementName << ">"
15341 : << " 1"
15342 0 : << " " << v_e.size();
15343 :
15344 0 : for (unsigned int i = 0; i < v_e.size(); i++)
15345 0 : oss << " " << CDifferenceType::name(v_e.at(i));
15346 0 : oss << "</" << elementName << ">";
15347 0 : return oss.str();
15348 0 : }
15349 :
15350 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<DifferenceTypeMod::DifferenceType> >& vv_e) {
15351 0 : ostringstream oss;
15352 : oss << "<" << elementName << ">"
15353 : << " 2"
15354 0 : << " " <<vv_e.size()
15355 0 : << " " <<vv_e.at(0).size();
15356 :
15357 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
15358 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
15359 0 : oss << " " << CDifferenceType::name(vv_e.at(i).at(j));
15360 0 : oss << "</" << elementName << ">";
15361 0 : return oss.str();
15362 0 : }
15363 :
15364 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<DifferenceTypeMod::DifferenceType> > >& vvv_e) {
15365 0 : ostringstream oss;
15366 : oss << "<" << elementName << ">"
15367 : << " 3"
15368 0 : << " " <<vvv_e.size()
15369 0 : << " " <<vvv_e.at(0).size()
15370 0 : << " " <<vvv_e.at(0).at(0).size();
15371 :
15372 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
15373 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
15374 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
15375 0 : oss << " " << CDifferenceType::name(vvv_e.at(i).at(j).at(k));
15376 0 : oss << "</" << elementName << ">";
15377 0 : return oss.str();
15378 0 : }
15379 :
15380 0 : DifferenceTypeMod::DifferenceType EnumerationParser::getDifferenceType(const string &name, const string &tableName, const string &xmlDoc) {
15381 0 : string s = getField(xmlDoc,name);
15382 0 : if (s.length() == 0)
15383 0 : throw ConversionException("Error: Missing field \"" +
15384 0 : name + "\" or invalid syntax",tableName);
15385 :
15386 : DifferenceType result;
15387 : try {
15388 0 : result = CDifferenceType::newDifferenceType(s);
15389 : }
15390 0 : catch (...) {
15391 0 : throw ConversionException("Error: could not convert '"+s+"' into a DifferenceType.", tableName);
15392 0 : }
15393 0 : return result;
15394 0 : }
15395 :
15396 0 : vector<DifferenceTypeMod::DifferenceType> EnumerationParser::getDifferenceType1D(const string &name, const string &tableName, const string &xmlDoc) {
15397 0 : vector<DifferenceTypeMod::DifferenceType> result;
15398 :
15399 0 : string s = getField(xmlDoc,name);
15400 0 : if (s.length() == 0)
15401 0 : throw ConversionException("Error: Missing field \"" +
15402 0 : name + "\" or invalid syntax",tableName);
15403 :
15404 0 : istringstream iss;
15405 0 : iss.str(s);
15406 0 : vector<string> tokens;
15407 :
15408 : // Tokenize.
15409 0 : string buf;
15410 0 : while (iss >> buf) {
15411 0 : tokens.push_back(buf);
15412 : }
15413 :
15414 : // The length must be 2 at the minimum (there may be an empty array)
15415 0 : if (tokens.size() < 2)
15416 0 : throw ConversionException("Error: missing values in field \"" +
15417 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15418 :
15419 :
15420 :
15421 : // The number of dimension should be 1.
15422 0 : if (tokens.at(0) != "1")
15423 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
15424 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15425 :
15426 : // Then parse the size of the unique dimension
15427 0 : errno = 0;
15428 0 : int size1 = atoi(tokens.at(1).c_str());
15429 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15430 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15431 :
15432 0 : if (size1 < 0)
15433 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
15434 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15435 :
15436 0 : if (tokens.size() != (unsigned int) (size1 + 2))
15437 0 : throw ConversionException("Error: incorrect number of values in field \"" +
15438 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15439 :
15440 0 : int k = 2;
15441 : try {
15442 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
15443 0 : result.push_back(CDifferenceType::newDifferenceType(tokens.at(k).c_str()));
15444 0 : k++;
15445 : }
15446 : }
15447 0 : catch (...) {
15448 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DifferenceType.", tableName);
15449 0 : }
15450 :
15451 0 : return result;
15452 0 : }
15453 :
15454 0 : vector<vector<DifferenceTypeMod::DifferenceType> > EnumerationParser::getDifferenceType2D(const string &name, const string &tableName, const string &xmlDoc) {
15455 0 : vector<vector<DifferenceTypeMod::DifferenceType> > result;
15456 :
15457 0 : string s = getField(xmlDoc,name);
15458 0 : if (s.length() == 0)
15459 0 : throw ConversionException("Error: Missing field \"" +
15460 0 : name + "\" or invalid syntax",tableName);
15461 :
15462 0 : istringstream iss;
15463 0 : iss.str(s);
15464 0 : vector<string> tokens;
15465 :
15466 : // Tokenize.
15467 0 : string buf;
15468 0 : while (iss >> buf) {
15469 0 : tokens.push_back(buf);
15470 : }
15471 :
15472 : // The length must be 3 at the minimum (there may be an empty array)
15473 0 : if (tokens.size() < 3)
15474 0 : throw ConversionException("Error: missing values in field \"" +
15475 0 : name + "\" or invalid syntax(" + s +"')",tableName);
15476 :
15477 :
15478 : // The number of dimension should be 2.
15479 0 : if (tokens.at(0) != "2")
15480 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
15481 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15482 :
15483 : // Then parse the size of the two dimensions
15484 0 : errno = 0;
15485 0 : int size1 = atoi(tokens.at(1).c_str());
15486 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15487 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15488 :
15489 0 : if (size1 <= 0)
15490 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
15491 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15492 0 : errno = 0;
15493 0 : int size2 = atoi(tokens.at(2).c_str());
15494 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15495 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15496 :
15497 0 : if (size2 < 0)
15498 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
15499 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15500 :
15501 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
15502 0 : throw ConversionException("Error: incorrect number of values in field \"" +
15503 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15504 :
15505 0 : int k = 3;
15506 : try {
15507 0 : vector<DifferenceTypeMod::DifferenceType> v_aux;
15508 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
15509 0 : v_aux.clear();
15510 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
15511 0 : v_aux.push_back(CDifferenceType::newDifferenceType(tokens.at(k).c_str()));
15512 0 : k++;
15513 : }
15514 0 : result.push_back(v_aux);
15515 : }
15516 0 : }
15517 0 : catch (...) {
15518 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DifferenceType.", tableName);
15519 0 : }
15520 0 : return result;
15521 0 : }
15522 :
15523 :
15524 0 : vector<vector<vector<DifferenceTypeMod::DifferenceType> > > EnumerationParser::getDifferenceType3D(const string &name, const string &tableName, const string &xmlDoc) {
15525 0 : vector<vector<vector<DifferenceTypeMod::DifferenceType> > >result;
15526 :
15527 0 : string s = getField(xmlDoc,name);
15528 0 : if (s.length() == 0)
15529 0 : throw ConversionException("Error: Missing field \"" +
15530 0 : name + "\" or invalid syntax",tableName);
15531 :
15532 0 : istringstream iss;
15533 0 : iss.str(s);
15534 0 : vector<string> tokens;
15535 :
15536 : // Tokenize.
15537 0 : string buf;
15538 0 : while (iss >> buf) {
15539 0 : tokens.push_back(buf);
15540 : }
15541 :
15542 : // The length must be 4 at the minimum (there may be an empty array)
15543 0 : if (tokens.size() < 4)
15544 0 : throw ConversionException("Error: missing values in field \"" +
15545 0 : name + "\" or invalid syntax(" + s +"')",tableName);
15546 :
15547 :
15548 : // The number of dimension should be 3.
15549 0 : if (tokens.at(0) != "3")
15550 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
15551 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15552 :
15553 : // Then parse the size of the three dimensions
15554 0 : errno = 0;
15555 0 : int size1 = atoi(tokens.at(1).c_str());
15556 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15557 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15558 :
15559 0 : if (size1 <= 0)
15560 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
15561 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15562 :
15563 0 : errno = 0;
15564 0 : int size2 = atoi(tokens.at(2).c_str());
15565 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15566 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15567 :
15568 0 : if (size2 <= 0)
15569 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
15570 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15571 :
15572 0 : errno = 0;
15573 0 : int size3 = atoi(tokens.at(3).c_str());
15574 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15575 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15576 :
15577 :
15578 0 : if (size3 < 0)
15579 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
15580 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15581 :
15582 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
15583 0 : throw ConversionException("Error: incorrect number of values in field \"" +
15584 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15585 :
15586 0 : int k = 4;
15587 : try {
15588 0 : vector<DifferenceTypeMod::DifferenceType> v_aux;
15589 0 : vector<vector<DifferenceTypeMod::DifferenceType> > vv_aux;
15590 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
15591 0 : vv_aux.clear();
15592 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
15593 0 : v_aux.clear();
15594 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
15595 0 : v_aux.push_back(CDifferenceType::newDifferenceType(tokens.at(k).c_str()));
15596 0 : k++;
15597 : }
15598 0 : vv_aux.push_back(v_aux);
15599 : }
15600 0 : result.push_back(vv_aux);
15601 : }
15602 0 : }
15603 0 : catch (...) {
15604 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a DifferenceType.", tableName);
15605 0 : }
15606 :
15607 0 : return result;
15608 0 : }
15609 :
15610 :
15611 :
15612 :
15613 :
15614 0 : string EnumerationParser::toXML(const string& elementName, CalibrationModeMod::CalibrationMode e) {
15615 0 : return "<"+elementName+">"+CCalibrationMode::name(e)+"</"+elementName+">";
15616 : }
15617 :
15618 0 : string EnumerationParser::toXML(const string& elementName, const vector<CalibrationModeMod::CalibrationMode>& v_e) {
15619 0 : ostringstream oss;
15620 : oss << "<" << elementName << ">"
15621 : << " 1"
15622 0 : << " " << v_e.size();
15623 :
15624 0 : for (unsigned int i = 0; i < v_e.size(); i++)
15625 0 : oss << " " << CCalibrationMode::name(v_e.at(i));
15626 0 : oss << "</" << elementName << ">";
15627 0 : return oss.str();
15628 0 : }
15629 :
15630 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CalibrationModeMod::CalibrationMode> >& vv_e) {
15631 0 : ostringstream oss;
15632 : oss << "<" << elementName << ">"
15633 : << " 2"
15634 0 : << " " <<vv_e.size()
15635 0 : << " " <<vv_e.at(0).size();
15636 :
15637 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
15638 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
15639 0 : oss << " " << CCalibrationMode::name(vv_e.at(i).at(j));
15640 0 : oss << "</" << elementName << ">";
15641 0 : return oss.str();
15642 0 : }
15643 :
15644 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CalibrationModeMod::CalibrationMode> > >& vvv_e) {
15645 0 : ostringstream oss;
15646 : oss << "<" << elementName << ">"
15647 : << " 3"
15648 0 : << " " <<vvv_e.size()
15649 0 : << " " <<vvv_e.at(0).size()
15650 0 : << " " <<vvv_e.at(0).at(0).size();
15651 :
15652 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
15653 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
15654 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
15655 0 : oss << " " << CCalibrationMode::name(vvv_e.at(i).at(j).at(k));
15656 0 : oss << "</" << elementName << ">";
15657 0 : return oss.str();
15658 0 : }
15659 :
15660 0 : CalibrationModeMod::CalibrationMode EnumerationParser::getCalibrationMode(const string &name, const string &tableName, const string &xmlDoc) {
15661 0 : string s = getField(xmlDoc,name);
15662 0 : if (s.length() == 0)
15663 0 : throw ConversionException("Error: Missing field \"" +
15664 0 : name + "\" or invalid syntax",tableName);
15665 :
15666 : CalibrationMode result;
15667 : try {
15668 0 : result = CCalibrationMode::newCalibrationMode(s);
15669 : }
15670 0 : catch (...) {
15671 0 : throw ConversionException("Error: could not convert '"+s+"' into a CalibrationMode.", tableName);
15672 0 : }
15673 0 : return result;
15674 0 : }
15675 :
15676 0 : vector<CalibrationModeMod::CalibrationMode> EnumerationParser::getCalibrationMode1D(const string &name, const string &tableName, const string &xmlDoc) {
15677 0 : vector<CalibrationModeMod::CalibrationMode> result;
15678 :
15679 0 : string s = getField(xmlDoc,name);
15680 0 : if (s.length() == 0)
15681 0 : throw ConversionException("Error: Missing field \"" +
15682 0 : name + "\" or invalid syntax",tableName);
15683 :
15684 0 : istringstream iss;
15685 0 : iss.str(s);
15686 0 : vector<string> tokens;
15687 :
15688 : // Tokenize.
15689 0 : string buf;
15690 0 : while (iss >> buf) {
15691 0 : tokens.push_back(buf);
15692 : }
15693 :
15694 : // The length must be 2 at the minimum (there may be an empty array)
15695 0 : if (tokens.size() < 2)
15696 0 : throw ConversionException("Error: missing values in field \"" +
15697 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15698 :
15699 :
15700 :
15701 : // The number of dimension should be 1.
15702 0 : if (tokens.at(0) != "1")
15703 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
15704 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15705 :
15706 : // Then parse the size of the unique dimension
15707 0 : errno = 0;
15708 0 : int size1 = atoi(tokens.at(1).c_str());
15709 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15710 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15711 :
15712 0 : if (size1 < 0)
15713 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
15714 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15715 :
15716 0 : if (tokens.size() != (unsigned int) (size1 + 2))
15717 0 : throw ConversionException("Error: incorrect number of values in field \"" +
15718 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15719 :
15720 0 : int k = 2;
15721 : try {
15722 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
15723 0 : result.push_back(CCalibrationMode::newCalibrationMode(tokens.at(k).c_str()));
15724 0 : k++;
15725 : }
15726 : }
15727 0 : catch (...) {
15728 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationMode.", tableName);
15729 0 : }
15730 :
15731 0 : return result;
15732 0 : }
15733 :
15734 0 : vector<vector<CalibrationModeMod::CalibrationMode> > EnumerationParser::getCalibrationMode2D(const string &name, const string &tableName, const string &xmlDoc) {
15735 0 : vector<vector<CalibrationModeMod::CalibrationMode> > result;
15736 :
15737 0 : string s = getField(xmlDoc,name);
15738 0 : if (s.length() == 0)
15739 0 : throw ConversionException("Error: Missing field \"" +
15740 0 : name + "\" or invalid syntax",tableName);
15741 :
15742 0 : istringstream iss;
15743 0 : iss.str(s);
15744 0 : vector<string> tokens;
15745 :
15746 : // Tokenize.
15747 0 : string buf;
15748 0 : while (iss >> buf) {
15749 0 : tokens.push_back(buf);
15750 : }
15751 :
15752 : // The length must be 3 at the minimum (there may be an empty array)
15753 0 : if (tokens.size() < 3)
15754 0 : throw ConversionException("Error: missing values in field \"" +
15755 0 : name + "\" or invalid syntax(" + s +"')",tableName);
15756 :
15757 :
15758 : // The number of dimension should be 2.
15759 0 : if (tokens.at(0) != "2")
15760 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
15761 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15762 :
15763 : // Then parse the size of the two dimensions
15764 0 : errno = 0;
15765 0 : int size1 = atoi(tokens.at(1).c_str());
15766 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15767 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15768 :
15769 0 : if (size1 <= 0)
15770 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
15771 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15772 0 : errno = 0;
15773 0 : int size2 = atoi(tokens.at(2).c_str());
15774 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15775 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15776 :
15777 0 : if (size2 < 0)
15778 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
15779 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15780 :
15781 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
15782 0 : throw ConversionException("Error: incorrect number of values in field \"" +
15783 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15784 :
15785 0 : int k = 3;
15786 : try {
15787 0 : vector<CalibrationModeMod::CalibrationMode> v_aux;
15788 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
15789 0 : v_aux.clear();
15790 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
15791 0 : v_aux.push_back(CCalibrationMode::newCalibrationMode(tokens.at(k).c_str()));
15792 0 : k++;
15793 : }
15794 0 : result.push_back(v_aux);
15795 : }
15796 0 : }
15797 0 : catch (...) {
15798 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationMode.", tableName);
15799 0 : }
15800 0 : return result;
15801 0 : }
15802 :
15803 :
15804 0 : vector<vector<vector<CalibrationModeMod::CalibrationMode> > > EnumerationParser::getCalibrationMode3D(const string &name, const string &tableName, const string &xmlDoc) {
15805 0 : vector<vector<vector<CalibrationModeMod::CalibrationMode> > >result;
15806 :
15807 0 : string s = getField(xmlDoc,name);
15808 0 : if (s.length() == 0)
15809 0 : throw ConversionException("Error: Missing field \"" +
15810 0 : name + "\" or invalid syntax",tableName);
15811 :
15812 0 : istringstream iss;
15813 0 : iss.str(s);
15814 0 : vector<string> tokens;
15815 :
15816 : // Tokenize.
15817 0 : string buf;
15818 0 : while (iss >> buf) {
15819 0 : tokens.push_back(buf);
15820 : }
15821 :
15822 : // The length must be 4 at the minimum (there may be an empty array)
15823 0 : if (tokens.size() < 4)
15824 0 : throw ConversionException("Error: missing values in field \"" +
15825 0 : name + "\" or invalid syntax(" + s +"')",tableName);
15826 :
15827 :
15828 : // The number of dimension should be 3.
15829 0 : if (tokens.at(0) != "3")
15830 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
15831 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15832 :
15833 : // Then parse the size of the three dimensions
15834 0 : errno = 0;
15835 0 : int size1 = atoi(tokens.at(1).c_str());
15836 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15837 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15838 :
15839 0 : if (size1 <= 0)
15840 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
15841 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15842 :
15843 0 : errno = 0;
15844 0 : int size2 = atoi(tokens.at(2).c_str());
15845 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15846 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15847 :
15848 0 : if (size2 <= 0)
15849 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
15850 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15851 :
15852 0 : errno = 0;
15853 0 : int size3 = atoi(tokens.at(3).c_str());
15854 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15855 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15856 :
15857 :
15858 0 : if (size3 < 0)
15859 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
15860 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15861 :
15862 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
15863 0 : throw ConversionException("Error: incorrect number of values in field \"" +
15864 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15865 :
15866 0 : int k = 4;
15867 : try {
15868 0 : vector<CalibrationModeMod::CalibrationMode> v_aux;
15869 0 : vector<vector<CalibrationModeMod::CalibrationMode> > vv_aux;
15870 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
15871 0 : vv_aux.clear();
15872 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
15873 0 : v_aux.clear();
15874 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
15875 0 : v_aux.push_back(CCalibrationMode::newCalibrationMode(tokens.at(k).c_str()));
15876 0 : k++;
15877 : }
15878 0 : vv_aux.push_back(v_aux);
15879 : }
15880 0 : result.push_back(vv_aux);
15881 : }
15882 0 : }
15883 0 : catch (...) {
15884 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CalibrationMode.", tableName);
15885 0 : }
15886 :
15887 0 : return result;
15888 0 : }
15889 :
15890 :
15891 :
15892 :
15893 :
15894 0 : string EnumerationParser::toXML(const string& elementName, AssociatedFieldNatureMod::AssociatedFieldNature e) {
15895 0 : return "<"+elementName+">"+CAssociatedFieldNature::name(e)+"</"+elementName+">";
15896 : }
15897 :
15898 0 : string EnumerationParser::toXML(const string& elementName, const vector<AssociatedFieldNatureMod::AssociatedFieldNature>& v_e) {
15899 0 : ostringstream oss;
15900 : oss << "<" << elementName << ">"
15901 : << " 1"
15902 0 : << " " << v_e.size();
15903 :
15904 0 : for (unsigned int i = 0; i < v_e.size(); i++)
15905 0 : oss << " " << CAssociatedFieldNature::name(v_e.at(i));
15906 0 : oss << "</" << elementName << ">";
15907 0 : return oss.str();
15908 0 : }
15909 :
15910 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<AssociatedFieldNatureMod::AssociatedFieldNature> >& vv_e) {
15911 0 : ostringstream oss;
15912 : oss << "<" << elementName << ">"
15913 : << " 2"
15914 0 : << " " <<vv_e.size()
15915 0 : << " " <<vv_e.at(0).size();
15916 :
15917 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
15918 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
15919 0 : oss << " " << CAssociatedFieldNature::name(vv_e.at(i).at(j));
15920 0 : oss << "</" << elementName << ">";
15921 0 : return oss.str();
15922 0 : }
15923 :
15924 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<AssociatedFieldNatureMod::AssociatedFieldNature> > >& vvv_e) {
15925 0 : ostringstream oss;
15926 : oss << "<" << elementName << ">"
15927 : << " 3"
15928 0 : << " " <<vvv_e.size()
15929 0 : << " " <<vvv_e.at(0).size()
15930 0 : << " " <<vvv_e.at(0).at(0).size();
15931 :
15932 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
15933 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
15934 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
15935 0 : oss << " " << CAssociatedFieldNature::name(vvv_e.at(i).at(j).at(k));
15936 0 : oss << "</" << elementName << ">";
15937 0 : return oss.str();
15938 0 : }
15939 :
15940 0 : AssociatedFieldNatureMod::AssociatedFieldNature EnumerationParser::getAssociatedFieldNature(const string &name, const string &tableName, const string &xmlDoc) {
15941 0 : string s = getField(xmlDoc,name);
15942 0 : if (s.length() == 0)
15943 0 : throw ConversionException("Error: Missing field \"" +
15944 0 : name + "\" or invalid syntax",tableName);
15945 :
15946 : AssociatedFieldNature result;
15947 : try {
15948 0 : result = CAssociatedFieldNature::newAssociatedFieldNature(s);
15949 : }
15950 0 : catch (...) {
15951 0 : throw ConversionException("Error: could not convert '"+s+"' into a AssociatedFieldNature.", tableName);
15952 0 : }
15953 0 : return result;
15954 0 : }
15955 :
15956 0 : vector<AssociatedFieldNatureMod::AssociatedFieldNature> EnumerationParser::getAssociatedFieldNature1D(const string &name, const string &tableName, const string &xmlDoc) {
15957 0 : vector<AssociatedFieldNatureMod::AssociatedFieldNature> result;
15958 :
15959 0 : string s = getField(xmlDoc,name);
15960 0 : if (s.length() == 0)
15961 0 : throw ConversionException("Error: Missing field \"" +
15962 0 : name + "\" or invalid syntax",tableName);
15963 :
15964 0 : istringstream iss;
15965 0 : iss.str(s);
15966 0 : vector<string> tokens;
15967 :
15968 : // Tokenize.
15969 0 : string buf;
15970 0 : while (iss >> buf) {
15971 0 : tokens.push_back(buf);
15972 : }
15973 :
15974 : // The length must be 2 at the minimum (there may be an empty array)
15975 0 : if (tokens.size() < 2)
15976 0 : throw ConversionException("Error: missing values in field \"" +
15977 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15978 :
15979 :
15980 :
15981 : // The number of dimension should be 1.
15982 0 : if (tokens.at(0) != "1")
15983 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
15984 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15985 :
15986 : // Then parse the size of the unique dimension
15987 0 : errno = 0;
15988 0 : int size1 = atoi(tokens.at(1).c_str());
15989 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
15990 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
15991 :
15992 0 : if (size1 < 0)
15993 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
15994 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15995 :
15996 0 : if (tokens.size() != (unsigned int) (size1 + 2))
15997 0 : throw ConversionException("Error: incorrect number of values in field \"" +
15998 0 : name + "\" or invalid syntax('" + s +"')",tableName);
15999 :
16000 0 : int k = 2;
16001 : try {
16002 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
16003 0 : result.push_back(CAssociatedFieldNature::newAssociatedFieldNature(tokens.at(k).c_str()));
16004 0 : k++;
16005 : }
16006 : }
16007 0 : catch (...) {
16008 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AssociatedFieldNature.", tableName);
16009 0 : }
16010 :
16011 0 : return result;
16012 0 : }
16013 :
16014 0 : vector<vector<AssociatedFieldNatureMod::AssociatedFieldNature> > EnumerationParser::getAssociatedFieldNature2D(const string &name, const string &tableName, const string &xmlDoc) {
16015 0 : vector<vector<AssociatedFieldNatureMod::AssociatedFieldNature> > result;
16016 :
16017 0 : string s = getField(xmlDoc,name);
16018 0 : if (s.length() == 0)
16019 0 : throw ConversionException("Error: Missing field \"" +
16020 0 : name + "\" or invalid syntax",tableName);
16021 :
16022 0 : istringstream iss;
16023 0 : iss.str(s);
16024 0 : vector<string> tokens;
16025 :
16026 : // Tokenize.
16027 0 : string buf;
16028 0 : while (iss >> buf) {
16029 0 : tokens.push_back(buf);
16030 : }
16031 :
16032 : // The length must be 3 at the minimum (there may be an empty array)
16033 0 : if (tokens.size() < 3)
16034 0 : throw ConversionException("Error: missing values in field \"" +
16035 0 : name + "\" or invalid syntax(" + s +"')",tableName);
16036 :
16037 :
16038 : // The number of dimension should be 2.
16039 0 : if (tokens.at(0) != "2")
16040 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
16041 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16042 :
16043 : // Then parse the size of the two dimensions
16044 0 : errno = 0;
16045 0 : int size1 = atoi(tokens.at(1).c_str());
16046 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16047 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16048 :
16049 0 : if (size1 <= 0)
16050 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16051 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16052 0 : errno = 0;
16053 0 : int size2 = atoi(tokens.at(2).c_str());
16054 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16055 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16056 :
16057 0 : if (size2 < 0)
16058 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
16059 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16060 :
16061 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
16062 0 : throw ConversionException("Error: incorrect number of values in field \"" +
16063 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16064 :
16065 0 : int k = 3;
16066 : try {
16067 0 : vector<AssociatedFieldNatureMod::AssociatedFieldNature> v_aux;
16068 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
16069 0 : v_aux.clear();
16070 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
16071 0 : v_aux.push_back(CAssociatedFieldNature::newAssociatedFieldNature(tokens.at(k).c_str()));
16072 0 : k++;
16073 : }
16074 0 : result.push_back(v_aux);
16075 : }
16076 0 : }
16077 0 : catch (...) {
16078 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a AssociatedFieldNature.", tableName);
16079 0 : }
16080 0 : return result;
16081 0 : }
16082 :
16083 :
16084 0 : vector<vector<vector<AssociatedFieldNatureMod::AssociatedFieldNature> > > EnumerationParser::getAssociatedFieldNature3D(const string &name, const string &tableName, const string &xmlDoc) {
16085 0 : vector<vector<vector<AssociatedFieldNatureMod::AssociatedFieldNature> > >result;
16086 :
16087 0 : string s = getField(xmlDoc,name);
16088 0 : if (s.length() == 0)
16089 0 : throw ConversionException("Error: Missing field \"" +
16090 0 : name + "\" or invalid syntax",tableName);
16091 :
16092 0 : istringstream iss;
16093 0 : iss.str(s);
16094 0 : vector<string> tokens;
16095 :
16096 : // Tokenize.
16097 0 : string buf;
16098 0 : while (iss >> buf) {
16099 0 : tokens.push_back(buf);
16100 : }
16101 :
16102 : // The length must be 4 at the minimum (there may be an empty array)
16103 0 : if (tokens.size() < 4)
16104 0 : throw ConversionException("Error: missing values in field \"" +
16105 0 : name + "\" or invalid syntax(" + s +"')",tableName);
16106 :
16107 :
16108 : // The number of dimension should be 3.
16109 0 : if (tokens.at(0) != "3")
16110 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
16111 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16112 :
16113 : // Then parse the size of the three dimensions
16114 0 : errno = 0;
16115 0 : int size1 = atoi(tokens.at(1).c_str());
16116 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16117 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16118 :
16119 0 : if (size1 <= 0)
16120 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16121 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16122 :
16123 0 : errno = 0;
16124 0 : int size2 = atoi(tokens.at(2).c_str());
16125 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16126 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16127 :
16128 0 : if (size2 <= 0)
16129 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16130 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16131 :
16132 0 : errno = 0;
16133 0 : int size3 = atoi(tokens.at(3).c_str());
16134 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16135 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16136 :
16137 :
16138 0 : if (size3 < 0)
16139 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
16140 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16141 :
16142 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
16143 0 : throw ConversionException("Error: incorrect number of values in field \"" +
16144 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16145 :
16146 0 : int k = 4;
16147 : try {
16148 0 : vector<AssociatedFieldNatureMod::AssociatedFieldNature> v_aux;
16149 0 : vector<vector<AssociatedFieldNatureMod::AssociatedFieldNature> > vv_aux;
16150 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
16151 0 : vv_aux.clear();
16152 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
16153 0 : v_aux.clear();
16154 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
16155 0 : v_aux.push_back(CAssociatedFieldNature::newAssociatedFieldNature(tokens.at(k).c_str()));
16156 0 : k++;
16157 : }
16158 0 : vv_aux.push_back(v_aux);
16159 : }
16160 0 : result.push_back(vv_aux);
16161 : }
16162 0 : }
16163 0 : catch (...) {
16164 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a AssociatedFieldNature.", tableName);
16165 0 : }
16166 :
16167 0 : return result;
16168 0 : }
16169 :
16170 :
16171 :
16172 :
16173 :
16174 0 : string EnumerationParser::toXML(const string& elementName, DataContentMod::DataContent e) {
16175 0 : return "<"+elementName+">"+CDataContent::name(e)+"</"+elementName+">";
16176 : }
16177 :
16178 0 : string EnumerationParser::toXML(const string& elementName, const vector<DataContentMod::DataContent>& v_e) {
16179 0 : ostringstream oss;
16180 : oss << "<" << elementName << ">"
16181 : << " 1"
16182 0 : << " " << v_e.size();
16183 :
16184 0 : for (unsigned int i = 0; i < v_e.size(); i++)
16185 0 : oss << " " << CDataContent::name(v_e.at(i));
16186 0 : oss << "</" << elementName << ">";
16187 0 : return oss.str();
16188 0 : }
16189 :
16190 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<DataContentMod::DataContent> >& vv_e) {
16191 0 : ostringstream oss;
16192 : oss << "<" << elementName << ">"
16193 : << " 2"
16194 0 : << " " <<vv_e.size()
16195 0 : << " " <<vv_e.at(0).size();
16196 :
16197 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
16198 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
16199 0 : oss << " " << CDataContent::name(vv_e.at(i).at(j));
16200 0 : oss << "</" << elementName << ">";
16201 0 : return oss.str();
16202 0 : }
16203 :
16204 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<DataContentMod::DataContent> > >& vvv_e) {
16205 0 : ostringstream oss;
16206 : oss << "<" << elementName << ">"
16207 : << " 3"
16208 0 : << " " <<vvv_e.size()
16209 0 : << " " <<vvv_e.at(0).size()
16210 0 : << " " <<vvv_e.at(0).at(0).size();
16211 :
16212 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
16213 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
16214 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
16215 0 : oss << " " << CDataContent::name(vvv_e.at(i).at(j).at(k));
16216 0 : oss << "</" << elementName << ">";
16217 0 : return oss.str();
16218 0 : }
16219 :
16220 0 : DataContentMod::DataContent EnumerationParser::getDataContent(const string &name, const string &tableName, const string &xmlDoc) {
16221 0 : string s = getField(xmlDoc,name);
16222 0 : if (s.length() == 0)
16223 0 : throw ConversionException("Error: Missing field \"" +
16224 0 : name + "\" or invalid syntax",tableName);
16225 :
16226 : DataContent result;
16227 : try {
16228 0 : result = CDataContent::newDataContent(s);
16229 : }
16230 0 : catch (...) {
16231 0 : throw ConversionException("Error: could not convert '"+s+"' into a DataContent.", tableName);
16232 0 : }
16233 0 : return result;
16234 0 : }
16235 :
16236 0 : vector<DataContentMod::DataContent> EnumerationParser::getDataContent1D(const string &name, const string &tableName, const string &xmlDoc) {
16237 0 : vector<DataContentMod::DataContent> result;
16238 :
16239 0 : string s = getField(xmlDoc,name);
16240 0 : if (s.length() == 0)
16241 0 : throw ConversionException("Error: Missing field \"" +
16242 0 : name + "\" or invalid syntax",tableName);
16243 :
16244 0 : istringstream iss;
16245 0 : iss.str(s);
16246 0 : vector<string> tokens;
16247 :
16248 : // Tokenize.
16249 0 : string buf;
16250 0 : while (iss >> buf) {
16251 0 : tokens.push_back(buf);
16252 : }
16253 :
16254 : // The length must be 2 at the minimum (there may be an empty array)
16255 0 : if (tokens.size() < 2)
16256 0 : throw ConversionException("Error: missing values in field \"" +
16257 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16258 :
16259 :
16260 :
16261 : // The number of dimension should be 1.
16262 0 : if (tokens.at(0) != "1")
16263 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
16264 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16265 :
16266 : // Then parse the size of the unique dimension
16267 0 : errno = 0;
16268 0 : int size1 = atoi(tokens.at(1).c_str());
16269 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16270 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16271 :
16272 0 : if (size1 < 0)
16273 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
16274 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16275 :
16276 0 : if (tokens.size() != (unsigned int) (size1 + 2))
16277 0 : throw ConversionException("Error: incorrect number of values in field \"" +
16278 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16279 :
16280 0 : int k = 2;
16281 : try {
16282 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
16283 0 : result.push_back(CDataContent::newDataContent(tokens.at(k).c_str()));
16284 0 : k++;
16285 : }
16286 : }
16287 0 : catch (...) {
16288 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DataContent.", tableName);
16289 0 : }
16290 :
16291 0 : return result;
16292 0 : }
16293 :
16294 0 : vector<vector<DataContentMod::DataContent> > EnumerationParser::getDataContent2D(const string &name, const string &tableName, const string &xmlDoc) {
16295 0 : vector<vector<DataContentMod::DataContent> > result;
16296 :
16297 0 : string s = getField(xmlDoc,name);
16298 0 : if (s.length() == 0)
16299 0 : throw ConversionException("Error: Missing field \"" +
16300 0 : name + "\" or invalid syntax",tableName);
16301 :
16302 0 : istringstream iss;
16303 0 : iss.str(s);
16304 0 : vector<string> tokens;
16305 :
16306 : // Tokenize.
16307 0 : string buf;
16308 0 : while (iss >> buf) {
16309 0 : tokens.push_back(buf);
16310 : }
16311 :
16312 : // The length must be 3 at the minimum (there may be an empty array)
16313 0 : if (tokens.size() < 3)
16314 0 : throw ConversionException("Error: missing values in field \"" +
16315 0 : name + "\" or invalid syntax(" + s +"')",tableName);
16316 :
16317 :
16318 : // The number of dimension should be 2.
16319 0 : if (tokens.at(0) != "2")
16320 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
16321 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16322 :
16323 : // Then parse the size of the two dimensions
16324 0 : errno = 0;
16325 0 : int size1 = atoi(tokens.at(1).c_str());
16326 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16327 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16328 :
16329 0 : if (size1 <= 0)
16330 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16331 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16332 0 : errno = 0;
16333 0 : int size2 = atoi(tokens.at(2).c_str());
16334 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16335 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16336 :
16337 0 : if (size2 < 0)
16338 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
16339 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16340 :
16341 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
16342 0 : throw ConversionException("Error: incorrect number of values in field \"" +
16343 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16344 :
16345 0 : int k = 3;
16346 : try {
16347 0 : vector<DataContentMod::DataContent> v_aux;
16348 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
16349 0 : v_aux.clear();
16350 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
16351 0 : v_aux.push_back(CDataContent::newDataContent(tokens.at(k).c_str()));
16352 0 : k++;
16353 : }
16354 0 : result.push_back(v_aux);
16355 : }
16356 0 : }
16357 0 : catch (...) {
16358 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DataContent.", tableName);
16359 0 : }
16360 0 : return result;
16361 0 : }
16362 :
16363 :
16364 0 : vector<vector<vector<DataContentMod::DataContent> > > EnumerationParser::getDataContent3D(const string &name, const string &tableName, const string &xmlDoc) {
16365 0 : vector<vector<vector<DataContentMod::DataContent> > >result;
16366 :
16367 0 : string s = getField(xmlDoc,name);
16368 0 : if (s.length() == 0)
16369 0 : throw ConversionException("Error: Missing field \"" +
16370 0 : name + "\" or invalid syntax",tableName);
16371 :
16372 0 : istringstream iss;
16373 0 : iss.str(s);
16374 0 : vector<string> tokens;
16375 :
16376 : // Tokenize.
16377 0 : string buf;
16378 0 : while (iss >> buf) {
16379 0 : tokens.push_back(buf);
16380 : }
16381 :
16382 : // The length must be 4 at the minimum (there may be an empty array)
16383 0 : if (tokens.size() < 4)
16384 0 : throw ConversionException("Error: missing values in field \"" +
16385 0 : name + "\" or invalid syntax(" + s +"')",tableName);
16386 :
16387 :
16388 : // The number of dimension should be 3.
16389 0 : if (tokens.at(0) != "3")
16390 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
16391 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16392 :
16393 : // Then parse the size of the three dimensions
16394 0 : errno = 0;
16395 0 : int size1 = atoi(tokens.at(1).c_str());
16396 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16397 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16398 :
16399 0 : if (size1 <= 0)
16400 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16401 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16402 :
16403 0 : errno = 0;
16404 0 : int size2 = atoi(tokens.at(2).c_str());
16405 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16406 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16407 :
16408 0 : if (size2 <= 0)
16409 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16410 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16411 :
16412 0 : errno = 0;
16413 0 : int size3 = atoi(tokens.at(3).c_str());
16414 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16415 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16416 :
16417 :
16418 0 : if (size3 < 0)
16419 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
16420 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16421 :
16422 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
16423 0 : throw ConversionException("Error: incorrect number of values in field \"" +
16424 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16425 :
16426 0 : int k = 4;
16427 : try {
16428 0 : vector<DataContentMod::DataContent> v_aux;
16429 0 : vector<vector<DataContentMod::DataContent> > vv_aux;
16430 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
16431 0 : vv_aux.clear();
16432 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
16433 0 : v_aux.clear();
16434 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
16435 0 : v_aux.push_back(CDataContent::newDataContent(tokens.at(k).c_str()));
16436 0 : k++;
16437 : }
16438 0 : vv_aux.push_back(v_aux);
16439 : }
16440 0 : result.push_back(vv_aux);
16441 : }
16442 0 : }
16443 0 : catch (...) {
16444 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a DataContent.", tableName);
16445 0 : }
16446 :
16447 0 : return result;
16448 0 : }
16449 :
16450 :
16451 :
16452 :
16453 :
16454 0 : string EnumerationParser::toXML(const string& elementName, PrimitiveDataTypeMod::PrimitiveDataType e) {
16455 0 : return "<"+elementName+">"+CPrimitiveDataType::name(e)+"</"+elementName+">";
16456 : }
16457 :
16458 0 : string EnumerationParser::toXML(const string& elementName, const vector<PrimitiveDataTypeMod::PrimitiveDataType>& v_e) {
16459 0 : ostringstream oss;
16460 : oss << "<" << elementName << ">"
16461 : << " 1"
16462 0 : << " " << v_e.size();
16463 :
16464 0 : for (unsigned int i = 0; i < v_e.size(); i++)
16465 0 : oss << " " << CPrimitiveDataType::name(v_e.at(i));
16466 0 : oss << "</" << elementName << ">";
16467 0 : return oss.str();
16468 0 : }
16469 :
16470 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<PrimitiveDataTypeMod::PrimitiveDataType> >& vv_e) {
16471 0 : ostringstream oss;
16472 : oss << "<" << elementName << ">"
16473 : << " 2"
16474 0 : << " " <<vv_e.size()
16475 0 : << " " <<vv_e.at(0).size();
16476 :
16477 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
16478 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
16479 0 : oss << " " << CPrimitiveDataType::name(vv_e.at(i).at(j));
16480 0 : oss << "</" << elementName << ">";
16481 0 : return oss.str();
16482 0 : }
16483 :
16484 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<PrimitiveDataTypeMod::PrimitiveDataType> > >& vvv_e) {
16485 0 : ostringstream oss;
16486 : oss << "<" << elementName << ">"
16487 : << " 3"
16488 0 : << " " <<vvv_e.size()
16489 0 : << " " <<vvv_e.at(0).size()
16490 0 : << " " <<vvv_e.at(0).at(0).size();
16491 :
16492 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
16493 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
16494 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
16495 0 : oss << " " << CPrimitiveDataType::name(vvv_e.at(i).at(j).at(k));
16496 0 : oss << "</" << elementName << ">";
16497 0 : return oss.str();
16498 0 : }
16499 :
16500 0 : PrimitiveDataTypeMod::PrimitiveDataType EnumerationParser::getPrimitiveDataType(const string &name, const string &tableName, const string &xmlDoc) {
16501 0 : string s = getField(xmlDoc,name);
16502 0 : if (s.length() == 0)
16503 0 : throw ConversionException("Error: Missing field \"" +
16504 0 : name + "\" or invalid syntax",tableName);
16505 :
16506 : PrimitiveDataType result;
16507 : try {
16508 0 : result = CPrimitiveDataType::newPrimitiveDataType(s);
16509 : }
16510 0 : catch (...) {
16511 0 : throw ConversionException("Error: could not convert '"+s+"' into a PrimitiveDataType.", tableName);
16512 0 : }
16513 0 : return result;
16514 0 : }
16515 :
16516 0 : vector<PrimitiveDataTypeMod::PrimitiveDataType> EnumerationParser::getPrimitiveDataType1D(const string &name, const string &tableName, const string &xmlDoc) {
16517 0 : vector<PrimitiveDataTypeMod::PrimitiveDataType> result;
16518 :
16519 0 : string s = getField(xmlDoc,name);
16520 0 : if (s.length() == 0)
16521 0 : throw ConversionException("Error: Missing field \"" +
16522 0 : name + "\" or invalid syntax",tableName);
16523 :
16524 0 : istringstream iss;
16525 0 : iss.str(s);
16526 0 : vector<string> tokens;
16527 :
16528 : // Tokenize.
16529 0 : string buf;
16530 0 : while (iss >> buf) {
16531 0 : tokens.push_back(buf);
16532 : }
16533 :
16534 : // The length must be 2 at the minimum (there may be an empty array)
16535 0 : if (tokens.size() < 2)
16536 0 : throw ConversionException("Error: missing values in field \"" +
16537 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16538 :
16539 :
16540 :
16541 : // The number of dimension should be 1.
16542 0 : if (tokens.at(0) != "1")
16543 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
16544 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16545 :
16546 : // Then parse the size of the unique dimension
16547 0 : errno = 0;
16548 0 : int size1 = atoi(tokens.at(1).c_str());
16549 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16550 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16551 :
16552 0 : if (size1 < 0)
16553 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
16554 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16555 :
16556 0 : if (tokens.size() != (unsigned int) (size1 + 2))
16557 0 : throw ConversionException("Error: incorrect number of values in field \"" +
16558 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16559 :
16560 0 : int k = 2;
16561 : try {
16562 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
16563 0 : result.push_back(CPrimitiveDataType::newPrimitiveDataType(tokens.at(k).c_str()));
16564 0 : k++;
16565 : }
16566 : }
16567 0 : catch (...) {
16568 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PrimitiveDataType.", tableName);
16569 0 : }
16570 :
16571 0 : return result;
16572 0 : }
16573 :
16574 0 : vector<vector<PrimitiveDataTypeMod::PrimitiveDataType> > EnumerationParser::getPrimitiveDataType2D(const string &name, const string &tableName, const string &xmlDoc) {
16575 0 : vector<vector<PrimitiveDataTypeMod::PrimitiveDataType> > result;
16576 :
16577 0 : string s = getField(xmlDoc,name);
16578 0 : if (s.length() == 0)
16579 0 : throw ConversionException("Error: Missing field \"" +
16580 0 : name + "\" or invalid syntax",tableName);
16581 :
16582 0 : istringstream iss;
16583 0 : iss.str(s);
16584 0 : vector<string> tokens;
16585 :
16586 : // Tokenize.
16587 0 : string buf;
16588 0 : while (iss >> buf) {
16589 0 : tokens.push_back(buf);
16590 : }
16591 :
16592 : // The length must be 3 at the minimum (there may be an empty array)
16593 0 : if (tokens.size() < 3)
16594 0 : throw ConversionException("Error: missing values in field \"" +
16595 0 : name + "\" or invalid syntax(" + s +"')",tableName);
16596 :
16597 :
16598 : // The number of dimension should be 2.
16599 0 : if (tokens.at(0) != "2")
16600 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
16601 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16602 :
16603 : // Then parse the size of the two dimensions
16604 0 : errno = 0;
16605 0 : int size1 = atoi(tokens.at(1).c_str());
16606 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16607 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16608 :
16609 0 : if (size1 <= 0)
16610 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16611 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16612 0 : errno = 0;
16613 0 : int size2 = atoi(tokens.at(2).c_str());
16614 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16615 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16616 :
16617 0 : if (size2 < 0)
16618 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
16619 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16620 :
16621 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
16622 0 : throw ConversionException("Error: incorrect number of values in field \"" +
16623 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16624 :
16625 0 : int k = 3;
16626 : try {
16627 0 : vector<PrimitiveDataTypeMod::PrimitiveDataType> v_aux;
16628 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
16629 0 : v_aux.clear();
16630 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
16631 0 : v_aux.push_back(CPrimitiveDataType::newPrimitiveDataType(tokens.at(k).c_str()));
16632 0 : k++;
16633 : }
16634 0 : result.push_back(v_aux);
16635 : }
16636 0 : }
16637 0 : catch (...) {
16638 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PrimitiveDataType.", tableName);
16639 0 : }
16640 0 : return result;
16641 0 : }
16642 :
16643 :
16644 0 : vector<vector<vector<PrimitiveDataTypeMod::PrimitiveDataType> > > EnumerationParser::getPrimitiveDataType3D(const string &name, const string &tableName, const string &xmlDoc) {
16645 0 : vector<vector<vector<PrimitiveDataTypeMod::PrimitiveDataType> > >result;
16646 :
16647 0 : string s = getField(xmlDoc,name);
16648 0 : if (s.length() == 0)
16649 0 : throw ConversionException("Error: Missing field \"" +
16650 0 : name + "\" or invalid syntax",tableName);
16651 :
16652 0 : istringstream iss;
16653 0 : iss.str(s);
16654 0 : vector<string> tokens;
16655 :
16656 : // Tokenize.
16657 0 : string buf;
16658 0 : while (iss >> buf) {
16659 0 : tokens.push_back(buf);
16660 : }
16661 :
16662 : // The length must be 4 at the minimum (there may be an empty array)
16663 0 : if (tokens.size() < 4)
16664 0 : throw ConversionException("Error: missing values in field \"" +
16665 0 : name + "\" or invalid syntax(" + s +"')",tableName);
16666 :
16667 :
16668 : // The number of dimension should be 3.
16669 0 : if (tokens.at(0) != "3")
16670 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
16671 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16672 :
16673 : // Then parse the size of the three dimensions
16674 0 : errno = 0;
16675 0 : int size1 = atoi(tokens.at(1).c_str());
16676 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16677 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16678 :
16679 0 : if (size1 <= 0)
16680 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16681 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16682 :
16683 0 : errno = 0;
16684 0 : int size2 = atoi(tokens.at(2).c_str());
16685 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16686 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16687 :
16688 0 : if (size2 <= 0)
16689 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16690 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16691 :
16692 0 : errno = 0;
16693 0 : int size3 = atoi(tokens.at(3).c_str());
16694 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16695 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16696 :
16697 :
16698 0 : if (size3 < 0)
16699 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
16700 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16701 :
16702 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
16703 0 : throw ConversionException("Error: incorrect number of values in field \"" +
16704 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16705 :
16706 0 : int k = 4;
16707 : try {
16708 0 : vector<PrimitiveDataTypeMod::PrimitiveDataType> v_aux;
16709 0 : vector<vector<PrimitiveDataTypeMod::PrimitiveDataType> > vv_aux;
16710 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
16711 0 : vv_aux.clear();
16712 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
16713 0 : v_aux.clear();
16714 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
16715 0 : v_aux.push_back(CPrimitiveDataType::newPrimitiveDataType(tokens.at(k).c_str()));
16716 0 : k++;
16717 : }
16718 0 : vv_aux.push_back(v_aux);
16719 : }
16720 0 : result.push_back(vv_aux);
16721 : }
16722 0 : }
16723 0 : catch (...) {
16724 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a PrimitiveDataType.", tableName);
16725 0 : }
16726 :
16727 0 : return result;
16728 0 : }
16729 :
16730 :
16731 :
16732 :
16733 :
16734 0 : string EnumerationParser::toXML(const string& elementName, SchedulerModeMod::SchedulerMode e) {
16735 0 : return "<"+elementName+">"+CSchedulerMode::name(e)+"</"+elementName+">";
16736 : }
16737 :
16738 0 : string EnumerationParser::toXML(const string& elementName, const vector<SchedulerModeMod::SchedulerMode>& v_e) {
16739 0 : ostringstream oss;
16740 : oss << "<" << elementName << ">"
16741 : << " 1"
16742 0 : << " " << v_e.size();
16743 :
16744 0 : for (unsigned int i = 0; i < v_e.size(); i++)
16745 0 : oss << " " << CSchedulerMode::name(v_e.at(i));
16746 0 : oss << "</" << elementName << ">";
16747 0 : return oss.str();
16748 0 : }
16749 :
16750 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<SchedulerModeMod::SchedulerMode> >& vv_e) {
16751 0 : ostringstream oss;
16752 : oss << "<" << elementName << ">"
16753 : << " 2"
16754 0 : << " " <<vv_e.size()
16755 0 : << " " <<vv_e.at(0).size();
16756 :
16757 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
16758 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
16759 0 : oss << " " << CSchedulerMode::name(vv_e.at(i).at(j));
16760 0 : oss << "</" << elementName << ">";
16761 0 : return oss.str();
16762 0 : }
16763 :
16764 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<SchedulerModeMod::SchedulerMode> > >& vvv_e) {
16765 0 : ostringstream oss;
16766 : oss << "<" << elementName << ">"
16767 : << " 3"
16768 0 : << " " <<vvv_e.size()
16769 0 : << " " <<vvv_e.at(0).size()
16770 0 : << " " <<vvv_e.at(0).at(0).size();
16771 :
16772 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
16773 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
16774 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
16775 0 : oss << " " << CSchedulerMode::name(vvv_e.at(i).at(j).at(k));
16776 0 : oss << "</" << elementName << ">";
16777 0 : return oss.str();
16778 0 : }
16779 :
16780 0 : SchedulerModeMod::SchedulerMode EnumerationParser::getSchedulerMode(const string &name, const string &tableName, const string &xmlDoc) {
16781 0 : string s = getField(xmlDoc,name);
16782 0 : if (s.length() == 0)
16783 0 : throw ConversionException("Error: Missing field \"" +
16784 0 : name + "\" or invalid syntax",tableName);
16785 :
16786 : SchedulerMode result;
16787 : try {
16788 0 : result = CSchedulerMode::newSchedulerMode(s);
16789 : }
16790 0 : catch (...) {
16791 0 : throw ConversionException("Error: could not convert '"+s+"' into a SchedulerMode.", tableName);
16792 0 : }
16793 0 : return result;
16794 0 : }
16795 :
16796 0 : vector<SchedulerModeMod::SchedulerMode> EnumerationParser::getSchedulerMode1D(const string &name, const string &tableName, const string &xmlDoc) {
16797 0 : vector<SchedulerModeMod::SchedulerMode> result;
16798 :
16799 0 : string s = getField(xmlDoc,name);
16800 0 : if (s.length() == 0)
16801 0 : throw ConversionException("Error: Missing field \"" +
16802 0 : name + "\" or invalid syntax",tableName);
16803 :
16804 0 : istringstream iss;
16805 0 : iss.str(s);
16806 0 : vector<string> tokens;
16807 :
16808 : // Tokenize.
16809 0 : string buf;
16810 0 : while (iss >> buf) {
16811 0 : tokens.push_back(buf);
16812 : }
16813 :
16814 : // The length must be 2 at the minimum (there may be an empty array)
16815 0 : if (tokens.size() < 2)
16816 0 : throw ConversionException("Error: missing values in field \"" +
16817 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16818 :
16819 :
16820 :
16821 : // The number of dimension should be 1.
16822 0 : if (tokens.at(0) != "1")
16823 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
16824 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16825 :
16826 : // Then parse the size of the unique dimension
16827 0 : errno = 0;
16828 0 : int size1 = atoi(tokens.at(1).c_str());
16829 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16830 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16831 :
16832 0 : if (size1 < 0)
16833 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
16834 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16835 :
16836 0 : if (tokens.size() != (unsigned int) (size1 + 2))
16837 0 : throw ConversionException("Error: incorrect number of values in field \"" +
16838 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16839 :
16840 0 : int k = 2;
16841 : try {
16842 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
16843 0 : result.push_back(CSchedulerMode::newSchedulerMode(tokens.at(k).c_str()));
16844 0 : k++;
16845 : }
16846 : }
16847 0 : catch (...) {
16848 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SchedulerMode.", tableName);
16849 0 : }
16850 :
16851 0 : return result;
16852 0 : }
16853 :
16854 0 : vector<vector<SchedulerModeMod::SchedulerMode> > EnumerationParser::getSchedulerMode2D(const string &name, const string &tableName, const string &xmlDoc) {
16855 0 : vector<vector<SchedulerModeMod::SchedulerMode> > result;
16856 :
16857 0 : string s = getField(xmlDoc,name);
16858 0 : if (s.length() == 0)
16859 0 : throw ConversionException("Error: Missing field \"" +
16860 0 : name + "\" or invalid syntax",tableName);
16861 :
16862 0 : istringstream iss;
16863 0 : iss.str(s);
16864 0 : vector<string> tokens;
16865 :
16866 : // Tokenize.
16867 0 : string buf;
16868 0 : while (iss >> buf) {
16869 0 : tokens.push_back(buf);
16870 : }
16871 :
16872 : // The length must be 3 at the minimum (there may be an empty array)
16873 0 : if (tokens.size() < 3)
16874 0 : throw ConversionException("Error: missing values in field \"" +
16875 0 : name + "\" or invalid syntax(" + s +"')",tableName);
16876 :
16877 :
16878 : // The number of dimension should be 2.
16879 0 : if (tokens.at(0) != "2")
16880 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
16881 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16882 :
16883 : // Then parse the size of the two dimensions
16884 0 : errno = 0;
16885 0 : int size1 = atoi(tokens.at(1).c_str());
16886 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16887 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16888 :
16889 0 : if (size1 <= 0)
16890 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16891 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16892 0 : errno = 0;
16893 0 : int size2 = atoi(tokens.at(2).c_str());
16894 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16895 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16896 :
16897 0 : if (size2 < 0)
16898 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
16899 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16900 :
16901 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
16902 0 : throw ConversionException("Error: incorrect number of values in field \"" +
16903 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16904 :
16905 0 : int k = 3;
16906 : try {
16907 0 : vector<SchedulerModeMod::SchedulerMode> v_aux;
16908 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
16909 0 : v_aux.clear();
16910 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
16911 0 : v_aux.push_back(CSchedulerMode::newSchedulerMode(tokens.at(k).c_str()));
16912 0 : k++;
16913 : }
16914 0 : result.push_back(v_aux);
16915 : }
16916 0 : }
16917 0 : catch (...) {
16918 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SchedulerMode.", tableName);
16919 0 : }
16920 0 : return result;
16921 0 : }
16922 :
16923 :
16924 0 : vector<vector<vector<SchedulerModeMod::SchedulerMode> > > EnumerationParser::getSchedulerMode3D(const string &name, const string &tableName, const string &xmlDoc) {
16925 0 : vector<vector<vector<SchedulerModeMod::SchedulerMode> > >result;
16926 :
16927 0 : string s = getField(xmlDoc,name);
16928 0 : if (s.length() == 0)
16929 0 : throw ConversionException("Error: Missing field \"" +
16930 0 : name + "\" or invalid syntax",tableName);
16931 :
16932 0 : istringstream iss;
16933 0 : iss.str(s);
16934 0 : vector<string> tokens;
16935 :
16936 : // Tokenize.
16937 0 : string buf;
16938 0 : while (iss >> buf) {
16939 0 : tokens.push_back(buf);
16940 : }
16941 :
16942 : // The length must be 4 at the minimum (there may be an empty array)
16943 0 : if (tokens.size() < 4)
16944 0 : throw ConversionException("Error: missing values in field \"" +
16945 0 : name + "\" or invalid syntax(" + s +"')",tableName);
16946 :
16947 :
16948 : // The number of dimension should be 3.
16949 0 : if (tokens.at(0) != "3")
16950 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
16951 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16952 :
16953 : // Then parse the size of the three dimensions
16954 0 : errno = 0;
16955 0 : int size1 = atoi(tokens.at(1).c_str());
16956 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16957 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16958 :
16959 0 : if (size1 <= 0)
16960 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16961 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16962 :
16963 0 : errno = 0;
16964 0 : int size2 = atoi(tokens.at(2).c_str());
16965 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16966 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16967 :
16968 0 : if (size2 <= 0)
16969 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
16970 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16971 :
16972 0 : errno = 0;
16973 0 : int size3 = atoi(tokens.at(3).c_str());
16974 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
16975 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
16976 :
16977 :
16978 0 : if (size3 < 0)
16979 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
16980 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16981 :
16982 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
16983 0 : throw ConversionException("Error: incorrect number of values in field \"" +
16984 0 : name + "\" or invalid syntax('" + s +"')",tableName);
16985 :
16986 0 : int k = 4;
16987 : try {
16988 0 : vector<SchedulerModeMod::SchedulerMode> v_aux;
16989 0 : vector<vector<SchedulerModeMod::SchedulerMode> > vv_aux;
16990 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
16991 0 : vv_aux.clear();
16992 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
16993 0 : v_aux.clear();
16994 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
16995 0 : v_aux.push_back(CSchedulerMode::newSchedulerMode(tokens.at(k).c_str()));
16996 0 : k++;
16997 : }
16998 0 : vv_aux.push_back(v_aux);
16999 : }
17000 0 : result.push_back(vv_aux);
17001 : }
17002 0 : }
17003 0 : catch (...) {
17004 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a SchedulerMode.", tableName);
17005 0 : }
17006 :
17007 0 : return result;
17008 0 : }
17009 :
17010 :
17011 :
17012 :
17013 :
17014 0 : string EnumerationParser::toXML(const string& elementName, FieldCodeMod::FieldCode e) {
17015 0 : return "<"+elementName+">"+CFieldCode::name(e)+"</"+elementName+">";
17016 : }
17017 :
17018 0 : string EnumerationParser::toXML(const string& elementName, const vector<FieldCodeMod::FieldCode>& v_e) {
17019 0 : ostringstream oss;
17020 : oss << "<" << elementName << ">"
17021 : << " 1"
17022 0 : << " " << v_e.size();
17023 :
17024 0 : for (unsigned int i = 0; i < v_e.size(); i++)
17025 0 : oss << " " << CFieldCode::name(v_e.at(i));
17026 0 : oss << "</" << elementName << ">";
17027 0 : return oss.str();
17028 0 : }
17029 :
17030 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<FieldCodeMod::FieldCode> >& vv_e) {
17031 0 : ostringstream oss;
17032 : oss << "<" << elementName << ">"
17033 : << " 2"
17034 0 : << " " <<vv_e.size()
17035 0 : << " " <<vv_e.at(0).size();
17036 :
17037 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
17038 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
17039 0 : oss << " " << CFieldCode::name(vv_e.at(i).at(j));
17040 0 : oss << "</" << elementName << ">";
17041 0 : return oss.str();
17042 0 : }
17043 :
17044 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<FieldCodeMod::FieldCode> > >& vvv_e) {
17045 0 : ostringstream oss;
17046 : oss << "<" << elementName << ">"
17047 : << " 3"
17048 0 : << " " <<vvv_e.size()
17049 0 : << " " <<vvv_e.at(0).size()
17050 0 : << " " <<vvv_e.at(0).at(0).size();
17051 :
17052 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
17053 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
17054 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
17055 0 : oss << " " << CFieldCode::name(vvv_e.at(i).at(j).at(k));
17056 0 : oss << "</" << elementName << ">";
17057 0 : return oss.str();
17058 0 : }
17059 :
17060 0 : FieldCodeMod::FieldCode EnumerationParser::getFieldCode(const string &name, const string &tableName, const string &xmlDoc) {
17061 0 : string s = getField(xmlDoc,name);
17062 0 : if (s.length() == 0)
17063 0 : throw ConversionException("Error: Missing field \"" +
17064 0 : name + "\" or invalid syntax",tableName);
17065 :
17066 : FieldCode result;
17067 : try {
17068 0 : result = CFieldCode::newFieldCode(s);
17069 : }
17070 0 : catch (...) {
17071 0 : throw ConversionException("Error: could not convert '"+s+"' into a FieldCode.", tableName);
17072 0 : }
17073 0 : return result;
17074 0 : }
17075 :
17076 0 : vector<FieldCodeMod::FieldCode> EnumerationParser::getFieldCode1D(const string &name, const string &tableName, const string &xmlDoc) {
17077 0 : vector<FieldCodeMod::FieldCode> result;
17078 :
17079 0 : string s = getField(xmlDoc,name);
17080 0 : if (s.length() == 0)
17081 0 : throw ConversionException("Error: Missing field \"" +
17082 0 : name + "\" or invalid syntax",tableName);
17083 :
17084 0 : istringstream iss;
17085 0 : iss.str(s);
17086 0 : vector<string> tokens;
17087 :
17088 : // Tokenize.
17089 0 : string buf;
17090 0 : while (iss >> buf) {
17091 0 : tokens.push_back(buf);
17092 : }
17093 :
17094 : // The length must be 2 at the minimum (there may be an empty array)
17095 0 : if (tokens.size() < 2)
17096 0 : throw ConversionException("Error: missing values in field \"" +
17097 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17098 :
17099 :
17100 :
17101 : // The number of dimension should be 1.
17102 0 : if (tokens.at(0) != "1")
17103 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
17104 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17105 :
17106 : // Then parse the size of the unique dimension
17107 0 : errno = 0;
17108 0 : int size1 = atoi(tokens.at(1).c_str());
17109 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17110 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17111 :
17112 0 : if (size1 < 0)
17113 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
17114 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17115 :
17116 0 : if (tokens.size() != (unsigned int) (size1 + 2))
17117 0 : throw ConversionException("Error: incorrect number of values in field \"" +
17118 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17119 :
17120 0 : int k = 2;
17121 : try {
17122 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
17123 0 : result.push_back(CFieldCode::newFieldCode(tokens.at(k).c_str()));
17124 0 : k++;
17125 : }
17126 : }
17127 0 : catch (...) {
17128 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a FieldCode.", tableName);
17129 0 : }
17130 :
17131 0 : return result;
17132 0 : }
17133 :
17134 0 : vector<vector<FieldCodeMod::FieldCode> > EnumerationParser::getFieldCode2D(const string &name, const string &tableName, const string &xmlDoc) {
17135 0 : vector<vector<FieldCodeMod::FieldCode> > result;
17136 :
17137 0 : string s = getField(xmlDoc,name);
17138 0 : if (s.length() == 0)
17139 0 : throw ConversionException("Error: Missing field \"" +
17140 0 : name + "\" or invalid syntax",tableName);
17141 :
17142 0 : istringstream iss;
17143 0 : iss.str(s);
17144 0 : vector<string> tokens;
17145 :
17146 : // Tokenize.
17147 0 : string buf;
17148 0 : while (iss >> buf) {
17149 0 : tokens.push_back(buf);
17150 : }
17151 :
17152 : // The length must be 3 at the minimum (there may be an empty array)
17153 0 : if (tokens.size() < 3)
17154 0 : throw ConversionException("Error: missing values in field \"" +
17155 0 : name + "\" or invalid syntax(" + s +"')",tableName);
17156 :
17157 :
17158 : // The number of dimension should be 2.
17159 0 : if (tokens.at(0) != "2")
17160 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
17161 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17162 :
17163 : // Then parse the size of the two dimensions
17164 0 : errno = 0;
17165 0 : int size1 = atoi(tokens.at(1).c_str());
17166 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17167 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17168 :
17169 0 : if (size1 <= 0)
17170 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
17171 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17172 0 : errno = 0;
17173 0 : int size2 = atoi(tokens.at(2).c_str());
17174 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17175 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17176 :
17177 0 : if (size2 < 0)
17178 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
17179 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17180 :
17181 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
17182 0 : throw ConversionException("Error: incorrect number of values in field \"" +
17183 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17184 :
17185 0 : int k = 3;
17186 : try {
17187 0 : vector<FieldCodeMod::FieldCode> v_aux;
17188 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
17189 0 : v_aux.clear();
17190 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
17191 0 : v_aux.push_back(CFieldCode::newFieldCode(tokens.at(k).c_str()));
17192 0 : k++;
17193 : }
17194 0 : result.push_back(v_aux);
17195 : }
17196 0 : }
17197 0 : catch (...) {
17198 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a FieldCode.", tableName);
17199 0 : }
17200 0 : return result;
17201 0 : }
17202 :
17203 :
17204 0 : vector<vector<vector<FieldCodeMod::FieldCode> > > EnumerationParser::getFieldCode3D(const string &name, const string &tableName, const string &xmlDoc) {
17205 0 : vector<vector<vector<FieldCodeMod::FieldCode> > >result;
17206 :
17207 0 : string s = getField(xmlDoc,name);
17208 0 : if (s.length() == 0)
17209 0 : throw ConversionException("Error: Missing field \"" +
17210 0 : name + "\" or invalid syntax",tableName);
17211 :
17212 0 : istringstream iss;
17213 0 : iss.str(s);
17214 0 : vector<string> tokens;
17215 :
17216 : // Tokenize.
17217 0 : string buf;
17218 0 : while (iss >> buf) {
17219 0 : tokens.push_back(buf);
17220 : }
17221 :
17222 : // The length must be 4 at the minimum (there may be an empty array)
17223 0 : if (tokens.size() < 4)
17224 0 : throw ConversionException("Error: missing values in field \"" +
17225 0 : name + "\" or invalid syntax(" + s +"')",tableName);
17226 :
17227 :
17228 : // The number of dimension should be 3.
17229 0 : if (tokens.at(0) != "3")
17230 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
17231 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17232 :
17233 : // Then parse the size of the three dimensions
17234 0 : errno = 0;
17235 0 : int size1 = atoi(tokens.at(1).c_str());
17236 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17237 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17238 :
17239 0 : if (size1 <= 0)
17240 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
17241 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17242 :
17243 0 : errno = 0;
17244 0 : int size2 = atoi(tokens.at(2).c_str());
17245 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17246 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17247 :
17248 0 : if (size2 <= 0)
17249 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
17250 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17251 :
17252 0 : errno = 0;
17253 0 : int size3 = atoi(tokens.at(3).c_str());
17254 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17255 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17256 :
17257 :
17258 0 : if (size3 < 0)
17259 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
17260 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17261 :
17262 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
17263 0 : throw ConversionException("Error: incorrect number of values in field \"" +
17264 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17265 :
17266 0 : int k = 4;
17267 : try {
17268 0 : vector<FieldCodeMod::FieldCode> v_aux;
17269 0 : vector<vector<FieldCodeMod::FieldCode> > vv_aux;
17270 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
17271 0 : vv_aux.clear();
17272 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
17273 0 : v_aux.clear();
17274 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
17275 0 : v_aux.push_back(CFieldCode::newFieldCode(tokens.at(k).c_str()));
17276 0 : k++;
17277 : }
17278 0 : vv_aux.push_back(v_aux);
17279 : }
17280 0 : result.push_back(vv_aux);
17281 : }
17282 0 : }
17283 0 : catch (...) {
17284 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a FieldCode.", tableName);
17285 0 : }
17286 :
17287 0 : return result;
17288 0 : }
17289 :
17290 :
17291 :
17292 :
17293 :
17294 0 : string EnumerationParser::toXML(const string& elementName, ACAPolarizationMod::ACAPolarization e) {
17295 0 : return "<"+elementName+">"+CACAPolarization::name(e)+"</"+elementName+">";
17296 : }
17297 :
17298 0 : string EnumerationParser::toXML(const string& elementName, const vector<ACAPolarizationMod::ACAPolarization>& v_e) {
17299 0 : ostringstream oss;
17300 : oss << "<" << elementName << ">"
17301 : << " 1"
17302 0 : << " " << v_e.size();
17303 :
17304 0 : for (unsigned int i = 0; i < v_e.size(); i++)
17305 0 : oss << " " << CACAPolarization::name(v_e.at(i));
17306 0 : oss << "</" << elementName << ">";
17307 0 : return oss.str();
17308 0 : }
17309 :
17310 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<ACAPolarizationMod::ACAPolarization> >& vv_e) {
17311 0 : ostringstream oss;
17312 : oss << "<" << elementName << ">"
17313 : << " 2"
17314 0 : << " " <<vv_e.size()
17315 0 : << " " <<vv_e.at(0).size();
17316 :
17317 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
17318 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
17319 0 : oss << " " << CACAPolarization::name(vv_e.at(i).at(j));
17320 0 : oss << "</" << elementName << ">";
17321 0 : return oss.str();
17322 0 : }
17323 :
17324 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<ACAPolarizationMod::ACAPolarization> > >& vvv_e) {
17325 0 : ostringstream oss;
17326 : oss << "<" << elementName << ">"
17327 : << " 3"
17328 0 : << " " <<vvv_e.size()
17329 0 : << " " <<vvv_e.at(0).size()
17330 0 : << " " <<vvv_e.at(0).at(0).size();
17331 :
17332 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
17333 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
17334 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
17335 0 : oss << " " << CACAPolarization::name(vvv_e.at(i).at(j).at(k));
17336 0 : oss << "</" << elementName << ">";
17337 0 : return oss.str();
17338 0 : }
17339 :
17340 0 : ACAPolarizationMod::ACAPolarization EnumerationParser::getACAPolarization(const string &name, const string &tableName, const string &xmlDoc) {
17341 0 : string s = getField(xmlDoc,name);
17342 0 : if (s.length() == 0)
17343 0 : throw ConversionException("Error: Missing field \"" +
17344 0 : name + "\" or invalid syntax",tableName);
17345 :
17346 : ACAPolarization result;
17347 : try {
17348 0 : result = CACAPolarization::newACAPolarization(s);
17349 : }
17350 0 : catch (...) {
17351 0 : throw ConversionException("Error: could not convert '"+s+"' into a ACAPolarization.", tableName);
17352 0 : }
17353 0 : return result;
17354 0 : }
17355 :
17356 0 : vector<ACAPolarizationMod::ACAPolarization> EnumerationParser::getACAPolarization1D(const string &name, const string &tableName, const string &xmlDoc) {
17357 0 : vector<ACAPolarizationMod::ACAPolarization> result;
17358 :
17359 0 : string s = getField(xmlDoc,name);
17360 0 : if (s.length() == 0)
17361 0 : throw ConversionException("Error: Missing field \"" +
17362 0 : name + "\" or invalid syntax",tableName);
17363 :
17364 0 : istringstream iss;
17365 0 : iss.str(s);
17366 0 : vector<string> tokens;
17367 :
17368 : // Tokenize.
17369 0 : string buf;
17370 0 : while (iss >> buf) {
17371 0 : tokens.push_back(buf);
17372 : }
17373 :
17374 : // The length must be 2 at the minimum (there may be an empty array)
17375 0 : if (tokens.size() < 2)
17376 0 : throw ConversionException("Error: missing values in field \"" +
17377 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17378 :
17379 :
17380 :
17381 : // The number of dimension should be 1.
17382 0 : if (tokens.at(0) != "1")
17383 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
17384 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17385 :
17386 : // Then parse the size of the unique dimension
17387 0 : errno = 0;
17388 0 : int size1 = atoi(tokens.at(1).c_str());
17389 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17390 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17391 :
17392 0 : if (size1 < 0)
17393 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
17394 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17395 :
17396 0 : if (tokens.size() != (unsigned int) (size1 + 2))
17397 0 : throw ConversionException("Error: incorrect number of values in field \"" +
17398 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17399 :
17400 0 : int k = 2;
17401 : try {
17402 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
17403 0 : result.push_back(CACAPolarization::newACAPolarization(tokens.at(k).c_str()));
17404 0 : k++;
17405 : }
17406 : }
17407 0 : catch (...) {
17408 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ACAPolarization.", tableName);
17409 0 : }
17410 :
17411 0 : return result;
17412 0 : }
17413 :
17414 0 : vector<vector<ACAPolarizationMod::ACAPolarization> > EnumerationParser::getACAPolarization2D(const string &name, const string &tableName, const string &xmlDoc) {
17415 0 : vector<vector<ACAPolarizationMod::ACAPolarization> > result;
17416 :
17417 0 : string s = getField(xmlDoc,name);
17418 0 : if (s.length() == 0)
17419 0 : throw ConversionException("Error: Missing field \"" +
17420 0 : name + "\" or invalid syntax",tableName);
17421 :
17422 0 : istringstream iss;
17423 0 : iss.str(s);
17424 0 : vector<string> tokens;
17425 :
17426 : // Tokenize.
17427 0 : string buf;
17428 0 : while (iss >> buf) {
17429 0 : tokens.push_back(buf);
17430 : }
17431 :
17432 : // The length must be 3 at the minimum (there may be an empty array)
17433 0 : if (tokens.size() < 3)
17434 0 : throw ConversionException("Error: missing values in field \"" +
17435 0 : name + "\" or invalid syntax(" + s +"')",tableName);
17436 :
17437 :
17438 : // The number of dimension should be 2.
17439 0 : if (tokens.at(0) != "2")
17440 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
17441 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17442 :
17443 : // Then parse the size of the two dimensions
17444 0 : errno = 0;
17445 0 : int size1 = atoi(tokens.at(1).c_str());
17446 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17447 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17448 :
17449 0 : if (size1 <= 0)
17450 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
17451 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17452 0 : errno = 0;
17453 0 : int size2 = atoi(tokens.at(2).c_str());
17454 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17455 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17456 :
17457 0 : if (size2 < 0)
17458 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
17459 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17460 :
17461 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
17462 0 : throw ConversionException("Error: incorrect number of values in field \"" +
17463 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17464 :
17465 0 : int k = 3;
17466 : try {
17467 0 : vector<ACAPolarizationMod::ACAPolarization> v_aux;
17468 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
17469 0 : v_aux.clear();
17470 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
17471 0 : v_aux.push_back(CACAPolarization::newACAPolarization(tokens.at(k).c_str()));
17472 0 : k++;
17473 : }
17474 0 : result.push_back(v_aux);
17475 : }
17476 0 : }
17477 0 : catch (...) {
17478 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a ACAPolarization.", tableName);
17479 0 : }
17480 0 : return result;
17481 0 : }
17482 :
17483 :
17484 0 : vector<vector<vector<ACAPolarizationMod::ACAPolarization> > > EnumerationParser::getACAPolarization3D(const string &name, const string &tableName, const string &xmlDoc) {
17485 0 : vector<vector<vector<ACAPolarizationMod::ACAPolarization> > >result;
17486 :
17487 0 : string s = getField(xmlDoc,name);
17488 0 : if (s.length() == 0)
17489 0 : throw ConversionException("Error: Missing field \"" +
17490 0 : name + "\" or invalid syntax",tableName);
17491 :
17492 0 : istringstream iss;
17493 0 : iss.str(s);
17494 0 : vector<string> tokens;
17495 :
17496 : // Tokenize.
17497 0 : string buf;
17498 0 : while (iss >> buf) {
17499 0 : tokens.push_back(buf);
17500 : }
17501 :
17502 : // The length must be 4 at the minimum (there may be an empty array)
17503 0 : if (tokens.size() < 4)
17504 0 : throw ConversionException("Error: missing values in field \"" +
17505 0 : name + "\" or invalid syntax(" + s +"')",tableName);
17506 :
17507 :
17508 : // The number of dimension should be 3.
17509 0 : if (tokens.at(0) != "3")
17510 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
17511 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17512 :
17513 : // Then parse the size of the three dimensions
17514 0 : errno = 0;
17515 0 : int size1 = atoi(tokens.at(1).c_str());
17516 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17517 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17518 :
17519 0 : if (size1 <= 0)
17520 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
17521 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17522 :
17523 0 : errno = 0;
17524 0 : int size2 = atoi(tokens.at(2).c_str());
17525 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17526 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17527 :
17528 0 : if (size2 <= 0)
17529 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
17530 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17531 :
17532 0 : errno = 0;
17533 0 : int size3 = atoi(tokens.at(3).c_str());
17534 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17535 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17536 :
17537 :
17538 0 : if (size3 < 0)
17539 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
17540 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17541 :
17542 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
17543 0 : throw ConversionException("Error: incorrect number of values in field \"" +
17544 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17545 :
17546 0 : int k = 4;
17547 : try {
17548 0 : vector<ACAPolarizationMod::ACAPolarization> v_aux;
17549 0 : vector<vector<ACAPolarizationMod::ACAPolarization> > vv_aux;
17550 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
17551 0 : vv_aux.clear();
17552 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
17553 0 : v_aux.clear();
17554 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
17555 0 : v_aux.push_back(CACAPolarization::newACAPolarization(tokens.at(k).c_str()));
17556 0 : k++;
17557 : }
17558 0 : vv_aux.push_back(v_aux);
17559 : }
17560 0 : result.push_back(vv_aux);
17561 : }
17562 0 : }
17563 0 : catch (...) {
17564 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a ACAPolarization.", tableName);
17565 0 : }
17566 :
17567 0 : return result;
17568 0 : }
17569 :
17570 :
17571 :
17572 :
17573 :
17574 0 : string EnumerationParser::toXML(const string& elementName, PositionReferenceCodeMod::PositionReferenceCode e) {
17575 0 : return "<"+elementName+">"+CPositionReferenceCode::name(e)+"</"+elementName+">";
17576 : }
17577 :
17578 0 : string EnumerationParser::toXML(const string& elementName, const vector<PositionReferenceCodeMod::PositionReferenceCode>& v_e) {
17579 0 : ostringstream oss;
17580 : oss << "<" << elementName << ">"
17581 : << " 1"
17582 0 : << " " << v_e.size();
17583 :
17584 0 : for (unsigned int i = 0; i < v_e.size(); i++)
17585 0 : oss << " " << CPositionReferenceCode::name(v_e.at(i));
17586 0 : oss << "</" << elementName << ">";
17587 0 : return oss.str();
17588 0 : }
17589 :
17590 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<PositionReferenceCodeMod::PositionReferenceCode> >& vv_e) {
17591 0 : ostringstream oss;
17592 : oss << "<" << elementName << ">"
17593 : << " 2"
17594 0 : << " " <<vv_e.size()
17595 0 : << " " <<vv_e.at(0).size();
17596 :
17597 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
17598 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
17599 0 : oss << " " << CPositionReferenceCode::name(vv_e.at(i).at(j));
17600 0 : oss << "</" << elementName << ">";
17601 0 : return oss.str();
17602 0 : }
17603 :
17604 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<PositionReferenceCodeMod::PositionReferenceCode> > >& vvv_e) {
17605 0 : ostringstream oss;
17606 : oss << "<" << elementName << ">"
17607 : << " 3"
17608 0 : << " " <<vvv_e.size()
17609 0 : << " " <<vvv_e.at(0).size()
17610 0 : << " " <<vvv_e.at(0).at(0).size();
17611 :
17612 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
17613 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
17614 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
17615 0 : oss << " " << CPositionReferenceCode::name(vvv_e.at(i).at(j).at(k));
17616 0 : oss << "</" << elementName << ">";
17617 0 : return oss.str();
17618 0 : }
17619 :
17620 0 : PositionReferenceCodeMod::PositionReferenceCode EnumerationParser::getPositionReferenceCode(const string &name, const string &tableName, const string &xmlDoc) {
17621 0 : string s = getField(xmlDoc,name);
17622 0 : if (s.length() == 0)
17623 0 : throw ConversionException("Error: Missing field \"" +
17624 0 : name + "\" or invalid syntax",tableName);
17625 :
17626 : PositionReferenceCode result;
17627 : try {
17628 0 : result = CPositionReferenceCode::newPositionReferenceCode(s);
17629 : }
17630 0 : catch (...) {
17631 0 : throw ConversionException("Error: could not convert '"+s+"' into a PositionReferenceCode.", tableName);
17632 0 : }
17633 0 : return result;
17634 0 : }
17635 :
17636 0 : vector<PositionReferenceCodeMod::PositionReferenceCode> EnumerationParser::getPositionReferenceCode1D(const string &name, const string &tableName, const string &xmlDoc) {
17637 0 : vector<PositionReferenceCodeMod::PositionReferenceCode> result;
17638 :
17639 0 : string s = getField(xmlDoc,name);
17640 0 : if (s.length() == 0)
17641 0 : throw ConversionException("Error: Missing field \"" +
17642 0 : name + "\" or invalid syntax",tableName);
17643 :
17644 0 : istringstream iss;
17645 0 : iss.str(s);
17646 0 : vector<string> tokens;
17647 :
17648 : // Tokenize.
17649 0 : string buf;
17650 0 : while (iss >> buf) {
17651 0 : tokens.push_back(buf);
17652 : }
17653 :
17654 : // The length must be 2 at the minimum (there may be an empty array)
17655 0 : if (tokens.size() < 2)
17656 0 : throw ConversionException("Error: missing values in field \"" +
17657 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17658 :
17659 :
17660 :
17661 : // The number of dimension should be 1.
17662 0 : if (tokens.at(0) != "1")
17663 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
17664 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17665 :
17666 : // Then parse the size of the unique dimension
17667 0 : errno = 0;
17668 0 : int size1 = atoi(tokens.at(1).c_str());
17669 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17670 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17671 :
17672 0 : if (size1 < 0)
17673 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
17674 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17675 :
17676 0 : if (tokens.size() != (unsigned int) (size1 + 2))
17677 0 : throw ConversionException("Error: incorrect number of values in field \"" +
17678 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17679 :
17680 0 : int k = 2;
17681 : try {
17682 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
17683 0 : result.push_back(CPositionReferenceCode::newPositionReferenceCode(tokens.at(k).c_str()));
17684 0 : k++;
17685 : }
17686 : }
17687 0 : catch (...) {
17688 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PositionReferenceCode.", tableName);
17689 0 : }
17690 :
17691 0 : return result;
17692 0 : }
17693 :
17694 0 : vector<vector<PositionReferenceCodeMod::PositionReferenceCode> > EnumerationParser::getPositionReferenceCode2D(const string &name, const string &tableName, const string &xmlDoc) {
17695 0 : vector<vector<PositionReferenceCodeMod::PositionReferenceCode> > result;
17696 :
17697 0 : string s = getField(xmlDoc,name);
17698 0 : if (s.length() == 0)
17699 0 : throw ConversionException("Error: Missing field \"" +
17700 0 : name + "\" or invalid syntax",tableName);
17701 :
17702 0 : istringstream iss;
17703 0 : iss.str(s);
17704 0 : vector<string> tokens;
17705 :
17706 : // Tokenize.
17707 0 : string buf;
17708 0 : while (iss >> buf) {
17709 0 : tokens.push_back(buf);
17710 : }
17711 :
17712 : // The length must be 3 at the minimum (there may be an empty array)
17713 0 : if (tokens.size() < 3)
17714 0 : throw ConversionException("Error: missing values in field \"" +
17715 0 : name + "\" or invalid syntax(" + s +"')",tableName);
17716 :
17717 :
17718 : // The number of dimension should be 2.
17719 0 : if (tokens.at(0) != "2")
17720 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
17721 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17722 :
17723 : // Then parse the size of the two dimensions
17724 0 : errno = 0;
17725 0 : int size1 = atoi(tokens.at(1).c_str());
17726 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17727 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17728 :
17729 0 : if (size1 <= 0)
17730 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
17731 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17732 0 : errno = 0;
17733 0 : int size2 = atoi(tokens.at(2).c_str());
17734 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17735 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17736 :
17737 0 : if (size2 < 0)
17738 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
17739 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17740 :
17741 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
17742 0 : throw ConversionException("Error: incorrect number of values in field \"" +
17743 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17744 :
17745 0 : int k = 3;
17746 : try {
17747 0 : vector<PositionReferenceCodeMod::PositionReferenceCode> v_aux;
17748 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
17749 0 : v_aux.clear();
17750 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
17751 0 : v_aux.push_back(CPositionReferenceCode::newPositionReferenceCode(tokens.at(k).c_str()));
17752 0 : k++;
17753 : }
17754 0 : result.push_back(v_aux);
17755 : }
17756 0 : }
17757 0 : catch (...) {
17758 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a PositionReferenceCode.", tableName);
17759 0 : }
17760 0 : return result;
17761 0 : }
17762 :
17763 :
17764 0 : vector<vector<vector<PositionReferenceCodeMod::PositionReferenceCode> > > EnumerationParser::getPositionReferenceCode3D(const string &name, const string &tableName, const string &xmlDoc) {
17765 0 : vector<vector<vector<PositionReferenceCodeMod::PositionReferenceCode> > >result;
17766 :
17767 0 : string s = getField(xmlDoc,name);
17768 0 : if (s.length() == 0)
17769 0 : throw ConversionException("Error: Missing field \"" +
17770 0 : name + "\" or invalid syntax",tableName);
17771 :
17772 0 : istringstream iss;
17773 0 : iss.str(s);
17774 0 : vector<string> tokens;
17775 :
17776 : // Tokenize.
17777 0 : string buf;
17778 0 : while (iss >> buf) {
17779 0 : tokens.push_back(buf);
17780 : }
17781 :
17782 : // The length must be 4 at the minimum (there may be an empty array)
17783 0 : if (tokens.size() < 4)
17784 0 : throw ConversionException("Error: missing values in field \"" +
17785 0 : name + "\" or invalid syntax(" + s +"')",tableName);
17786 :
17787 :
17788 : // The number of dimension should be 3.
17789 0 : if (tokens.at(0) != "3")
17790 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
17791 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17792 :
17793 : // Then parse the size of the three dimensions
17794 0 : errno = 0;
17795 0 : int size1 = atoi(tokens.at(1).c_str());
17796 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17797 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17798 :
17799 0 : if (size1 <= 0)
17800 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
17801 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17802 :
17803 0 : errno = 0;
17804 0 : int size2 = atoi(tokens.at(2).c_str());
17805 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17806 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17807 :
17808 0 : if (size2 <= 0)
17809 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
17810 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17811 :
17812 0 : errno = 0;
17813 0 : int size3 = atoi(tokens.at(3).c_str());
17814 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17815 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17816 :
17817 :
17818 0 : if (size3 < 0)
17819 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
17820 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17821 :
17822 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
17823 0 : throw ConversionException("Error: incorrect number of values in field \"" +
17824 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17825 :
17826 0 : int k = 4;
17827 : try {
17828 0 : vector<PositionReferenceCodeMod::PositionReferenceCode> v_aux;
17829 0 : vector<vector<PositionReferenceCodeMod::PositionReferenceCode> > vv_aux;
17830 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
17831 0 : vv_aux.clear();
17832 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
17833 0 : v_aux.clear();
17834 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
17835 0 : v_aux.push_back(CPositionReferenceCode::newPositionReferenceCode(tokens.at(k).c_str()));
17836 0 : k++;
17837 : }
17838 0 : vv_aux.push_back(v_aux);
17839 : }
17840 0 : result.push_back(vv_aux);
17841 : }
17842 0 : }
17843 0 : catch (...) {
17844 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a PositionReferenceCode.", tableName);
17845 0 : }
17846 :
17847 0 : return result;
17848 0 : }
17849 :
17850 :
17851 :
17852 :
17853 :
17854 0 : string EnumerationParser::toXML(const string& elementName, BaselineReferenceCodeMod::BaselineReferenceCode e) {
17855 0 : return "<"+elementName+">"+CBaselineReferenceCode::name(e)+"</"+elementName+">";
17856 : }
17857 :
17858 0 : string EnumerationParser::toXML(const string& elementName, const vector<BaselineReferenceCodeMod::BaselineReferenceCode>& v_e) {
17859 0 : ostringstream oss;
17860 : oss << "<" << elementName << ">"
17861 : << " 1"
17862 0 : << " " << v_e.size();
17863 :
17864 0 : for (unsigned int i = 0; i < v_e.size(); i++)
17865 0 : oss << " " << CBaselineReferenceCode::name(v_e.at(i));
17866 0 : oss << "</" << elementName << ">";
17867 0 : return oss.str();
17868 0 : }
17869 :
17870 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<BaselineReferenceCodeMod::BaselineReferenceCode> >& vv_e) {
17871 0 : ostringstream oss;
17872 : oss << "<" << elementName << ">"
17873 : << " 2"
17874 0 : << " " <<vv_e.size()
17875 0 : << " " <<vv_e.at(0).size();
17876 :
17877 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
17878 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
17879 0 : oss << " " << CBaselineReferenceCode::name(vv_e.at(i).at(j));
17880 0 : oss << "</" << elementName << ">";
17881 0 : return oss.str();
17882 0 : }
17883 :
17884 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<BaselineReferenceCodeMod::BaselineReferenceCode> > >& vvv_e) {
17885 0 : ostringstream oss;
17886 : oss << "<" << elementName << ">"
17887 : << " 3"
17888 0 : << " " <<vvv_e.size()
17889 0 : << " " <<vvv_e.at(0).size()
17890 0 : << " " <<vvv_e.at(0).at(0).size();
17891 :
17892 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
17893 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
17894 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
17895 0 : oss << " " << CBaselineReferenceCode::name(vvv_e.at(i).at(j).at(k));
17896 0 : oss << "</" << elementName << ">";
17897 0 : return oss.str();
17898 0 : }
17899 :
17900 0 : BaselineReferenceCodeMod::BaselineReferenceCode EnumerationParser::getBaselineReferenceCode(const string &name, const string &tableName, const string &xmlDoc) {
17901 0 : string s = getField(xmlDoc,name);
17902 0 : if (s.length() == 0)
17903 0 : throw ConversionException("Error: Missing field \"" +
17904 0 : name + "\" or invalid syntax",tableName);
17905 :
17906 : BaselineReferenceCode result;
17907 : try {
17908 0 : result = CBaselineReferenceCode::newBaselineReferenceCode(s);
17909 : }
17910 0 : catch (...) {
17911 0 : throw ConversionException("Error: could not convert '"+s+"' into a BaselineReferenceCode.", tableName);
17912 0 : }
17913 0 : return result;
17914 0 : }
17915 :
17916 0 : vector<BaselineReferenceCodeMod::BaselineReferenceCode> EnumerationParser::getBaselineReferenceCode1D(const string &name, const string &tableName, const string &xmlDoc) {
17917 0 : vector<BaselineReferenceCodeMod::BaselineReferenceCode> result;
17918 :
17919 0 : string s = getField(xmlDoc,name);
17920 0 : if (s.length() == 0)
17921 0 : throw ConversionException("Error: Missing field \"" +
17922 0 : name + "\" or invalid syntax",tableName);
17923 :
17924 0 : istringstream iss;
17925 0 : iss.str(s);
17926 0 : vector<string> tokens;
17927 :
17928 : // Tokenize.
17929 0 : string buf;
17930 0 : while (iss >> buf) {
17931 0 : tokens.push_back(buf);
17932 : }
17933 :
17934 : // The length must be 2 at the minimum (there may be an empty array)
17935 0 : if (tokens.size() < 2)
17936 0 : throw ConversionException("Error: missing values in field \"" +
17937 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17938 :
17939 :
17940 :
17941 : // The number of dimension should be 1.
17942 0 : if (tokens.at(0) != "1")
17943 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
17944 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17945 :
17946 : // Then parse the size of the unique dimension
17947 0 : errno = 0;
17948 0 : int size1 = atoi(tokens.at(1).c_str());
17949 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
17950 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
17951 :
17952 0 : if (size1 < 0)
17953 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
17954 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17955 :
17956 0 : if (tokens.size() != (unsigned int) (size1 + 2))
17957 0 : throw ConversionException("Error: incorrect number of values in field \"" +
17958 0 : name + "\" or invalid syntax('" + s +"')",tableName);
17959 :
17960 0 : int k = 2;
17961 : try {
17962 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
17963 0 : result.push_back(CBaselineReferenceCode::newBaselineReferenceCode(tokens.at(k).c_str()));
17964 0 : k++;
17965 : }
17966 : }
17967 0 : catch (...) {
17968 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a BaselineReferenceCode.", tableName);
17969 0 : }
17970 :
17971 0 : return result;
17972 0 : }
17973 :
17974 0 : vector<vector<BaselineReferenceCodeMod::BaselineReferenceCode> > EnumerationParser::getBaselineReferenceCode2D(const string &name, const string &tableName, const string &xmlDoc) {
17975 0 : vector<vector<BaselineReferenceCodeMod::BaselineReferenceCode> > result;
17976 :
17977 0 : string s = getField(xmlDoc,name);
17978 0 : if (s.length() == 0)
17979 0 : throw ConversionException("Error: Missing field \"" +
17980 0 : name + "\" or invalid syntax",tableName);
17981 :
17982 0 : istringstream iss;
17983 0 : iss.str(s);
17984 0 : vector<string> tokens;
17985 :
17986 : // Tokenize.
17987 0 : string buf;
17988 0 : while (iss >> buf) {
17989 0 : tokens.push_back(buf);
17990 : }
17991 :
17992 : // The length must be 3 at the minimum (there may be an empty array)
17993 0 : if (tokens.size() < 3)
17994 0 : throw ConversionException("Error: missing values in field \"" +
17995 0 : name + "\" or invalid syntax(" + s +"')",tableName);
17996 :
17997 :
17998 : // The number of dimension should be 2.
17999 0 : if (tokens.at(0) != "2")
18000 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
18001 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18002 :
18003 : // Then parse the size of the two dimensions
18004 0 : errno = 0;
18005 0 : int size1 = atoi(tokens.at(1).c_str());
18006 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18007 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18008 :
18009 0 : if (size1 <= 0)
18010 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18011 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18012 0 : errno = 0;
18013 0 : int size2 = atoi(tokens.at(2).c_str());
18014 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18015 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18016 :
18017 0 : if (size2 < 0)
18018 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
18019 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18020 :
18021 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
18022 0 : throw ConversionException("Error: incorrect number of values in field \"" +
18023 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18024 :
18025 0 : int k = 3;
18026 : try {
18027 0 : vector<BaselineReferenceCodeMod::BaselineReferenceCode> v_aux;
18028 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
18029 0 : v_aux.clear();
18030 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
18031 0 : v_aux.push_back(CBaselineReferenceCode::newBaselineReferenceCode(tokens.at(k).c_str()));
18032 0 : k++;
18033 : }
18034 0 : result.push_back(v_aux);
18035 : }
18036 0 : }
18037 0 : catch (...) {
18038 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a BaselineReferenceCode.", tableName);
18039 0 : }
18040 0 : return result;
18041 0 : }
18042 :
18043 :
18044 0 : vector<vector<vector<BaselineReferenceCodeMod::BaselineReferenceCode> > > EnumerationParser::getBaselineReferenceCode3D(const string &name, const string &tableName, const string &xmlDoc) {
18045 0 : vector<vector<vector<BaselineReferenceCodeMod::BaselineReferenceCode> > >result;
18046 :
18047 0 : string s = getField(xmlDoc,name);
18048 0 : if (s.length() == 0)
18049 0 : throw ConversionException("Error: Missing field \"" +
18050 0 : name + "\" or invalid syntax",tableName);
18051 :
18052 0 : istringstream iss;
18053 0 : iss.str(s);
18054 0 : vector<string> tokens;
18055 :
18056 : // Tokenize.
18057 0 : string buf;
18058 0 : while (iss >> buf) {
18059 0 : tokens.push_back(buf);
18060 : }
18061 :
18062 : // The length must be 4 at the minimum (there may be an empty array)
18063 0 : if (tokens.size() < 4)
18064 0 : throw ConversionException("Error: missing values in field \"" +
18065 0 : name + "\" or invalid syntax(" + s +"')",tableName);
18066 :
18067 :
18068 : // The number of dimension should be 3.
18069 0 : if (tokens.at(0) != "3")
18070 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
18071 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18072 :
18073 : // Then parse the size of the three dimensions
18074 0 : errno = 0;
18075 0 : int size1 = atoi(tokens.at(1).c_str());
18076 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18077 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18078 :
18079 0 : if (size1 <= 0)
18080 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18081 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18082 :
18083 0 : errno = 0;
18084 0 : int size2 = atoi(tokens.at(2).c_str());
18085 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18086 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18087 :
18088 0 : if (size2 <= 0)
18089 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18090 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18091 :
18092 0 : errno = 0;
18093 0 : int size3 = atoi(tokens.at(3).c_str());
18094 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18095 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18096 :
18097 :
18098 0 : if (size3 < 0)
18099 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
18100 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18101 :
18102 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
18103 0 : throw ConversionException("Error: incorrect number of values in field \"" +
18104 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18105 :
18106 0 : int k = 4;
18107 : try {
18108 0 : vector<BaselineReferenceCodeMod::BaselineReferenceCode> v_aux;
18109 0 : vector<vector<BaselineReferenceCodeMod::BaselineReferenceCode> > vv_aux;
18110 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
18111 0 : vv_aux.clear();
18112 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
18113 0 : v_aux.clear();
18114 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
18115 0 : v_aux.push_back(CBaselineReferenceCode::newBaselineReferenceCode(tokens.at(k).c_str()));
18116 0 : k++;
18117 : }
18118 0 : vv_aux.push_back(v_aux);
18119 : }
18120 0 : result.push_back(vv_aux);
18121 : }
18122 0 : }
18123 0 : catch (...) {
18124 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a BaselineReferenceCode.", tableName);
18125 0 : }
18126 :
18127 0 : return result;
18128 0 : }
18129 :
18130 :
18131 :
18132 :
18133 :
18134 0 : string EnumerationParser::toXML(const string& elementName, CorrelatorTypeMod::CorrelatorType e) {
18135 0 : return "<"+elementName+">"+CCorrelatorType::name(e)+"</"+elementName+">";
18136 : }
18137 :
18138 0 : string EnumerationParser::toXML(const string& elementName, const vector<CorrelatorTypeMod::CorrelatorType>& v_e) {
18139 0 : ostringstream oss;
18140 : oss << "<" << elementName << ">"
18141 : << " 1"
18142 0 : << " " << v_e.size();
18143 :
18144 0 : for (unsigned int i = 0; i < v_e.size(); i++)
18145 0 : oss << " " << CCorrelatorType::name(v_e.at(i));
18146 0 : oss << "</" << elementName << ">";
18147 0 : return oss.str();
18148 0 : }
18149 :
18150 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<CorrelatorTypeMod::CorrelatorType> >& vv_e) {
18151 0 : ostringstream oss;
18152 : oss << "<" << elementName << ">"
18153 : << " 2"
18154 0 : << " " <<vv_e.size()
18155 0 : << " " <<vv_e.at(0).size();
18156 :
18157 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
18158 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
18159 0 : oss << " " << CCorrelatorType::name(vv_e.at(i).at(j));
18160 0 : oss << "</" << elementName << ">";
18161 0 : return oss.str();
18162 0 : }
18163 :
18164 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<CorrelatorTypeMod::CorrelatorType> > >& vvv_e) {
18165 0 : ostringstream oss;
18166 : oss << "<" << elementName << ">"
18167 : << " 3"
18168 0 : << " " <<vvv_e.size()
18169 0 : << " " <<vvv_e.at(0).size()
18170 0 : << " " <<vvv_e.at(0).at(0).size();
18171 :
18172 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
18173 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
18174 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
18175 0 : oss << " " << CCorrelatorType::name(vvv_e.at(i).at(j).at(k));
18176 0 : oss << "</" << elementName << ">";
18177 0 : return oss.str();
18178 0 : }
18179 :
18180 0 : CorrelatorTypeMod::CorrelatorType EnumerationParser::getCorrelatorType(const string &name, const string &tableName, const string &xmlDoc) {
18181 0 : string s = getField(xmlDoc,name);
18182 0 : if (s.length() == 0)
18183 0 : throw ConversionException("Error: Missing field \"" +
18184 0 : name + "\" or invalid syntax",tableName);
18185 :
18186 : CorrelatorType result;
18187 : try {
18188 0 : result = CCorrelatorType::newCorrelatorType(s);
18189 : }
18190 0 : catch (...) {
18191 0 : throw ConversionException("Error: could not convert '"+s+"' into a CorrelatorType.", tableName);
18192 0 : }
18193 0 : return result;
18194 0 : }
18195 :
18196 0 : vector<CorrelatorTypeMod::CorrelatorType> EnumerationParser::getCorrelatorType1D(const string &name, const string &tableName, const string &xmlDoc) {
18197 0 : vector<CorrelatorTypeMod::CorrelatorType> result;
18198 :
18199 0 : string s = getField(xmlDoc,name);
18200 0 : if (s.length() == 0)
18201 0 : throw ConversionException("Error: Missing field \"" +
18202 0 : name + "\" or invalid syntax",tableName);
18203 :
18204 0 : istringstream iss;
18205 0 : iss.str(s);
18206 0 : vector<string> tokens;
18207 :
18208 : // Tokenize.
18209 0 : string buf;
18210 0 : while (iss >> buf) {
18211 0 : tokens.push_back(buf);
18212 : }
18213 :
18214 : // The length must be 2 at the minimum (there may be an empty array)
18215 0 : if (tokens.size() < 2)
18216 0 : throw ConversionException("Error: missing values in field \"" +
18217 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18218 :
18219 :
18220 :
18221 : // The number of dimension should be 1.
18222 0 : if (tokens.at(0) != "1")
18223 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
18224 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18225 :
18226 : // Then parse the size of the unique dimension
18227 0 : errno = 0;
18228 0 : int size1 = atoi(tokens.at(1).c_str());
18229 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18230 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18231 :
18232 0 : if (size1 < 0)
18233 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
18234 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18235 :
18236 0 : if (tokens.size() != (unsigned int) (size1 + 2))
18237 0 : throw ConversionException("Error: incorrect number of values in field \"" +
18238 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18239 :
18240 0 : int k = 2;
18241 : try {
18242 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
18243 0 : result.push_back(CCorrelatorType::newCorrelatorType(tokens.at(k).c_str()));
18244 0 : k++;
18245 : }
18246 : }
18247 0 : catch (...) {
18248 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelatorType.", tableName);
18249 0 : }
18250 :
18251 0 : return result;
18252 0 : }
18253 :
18254 0 : vector<vector<CorrelatorTypeMod::CorrelatorType> > EnumerationParser::getCorrelatorType2D(const string &name, const string &tableName, const string &xmlDoc) {
18255 0 : vector<vector<CorrelatorTypeMod::CorrelatorType> > result;
18256 :
18257 0 : string s = getField(xmlDoc,name);
18258 0 : if (s.length() == 0)
18259 0 : throw ConversionException("Error: Missing field \"" +
18260 0 : name + "\" or invalid syntax",tableName);
18261 :
18262 0 : istringstream iss;
18263 0 : iss.str(s);
18264 0 : vector<string> tokens;
18265 :
18266 : // Tokenize.
18267 0 : string buf;
18268 0 : while (iss >> buf) {
18269 0 : tokens.push_back(buf);
18270 : }
18271 :
18272 : // The length must be 3 at the minimum (there may be an empty array)
18273 0 : if (tokens.size() < 3)
18274 0 : throw ConversionException("Error: missing values in field \"" +
18275 0 : name + "\" or invalid syntax(" + s +"')",tableName);
18276 :
18277 :
18278 : // The number of dimension should be 2.
18279 0 : if (tokens.at(0) != "2")
18280 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
18281 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18282 :
18283 : // Then parse the size of the two dimensions
18284 0 : errno = 0;
18285 0 : int size1 = atoi(tokens.at(1).c_str());
18286 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18287 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18288 :
18289 0 : if (size1 <= 0)
18290 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18291 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18292 0 : errno = 0;
18293 0 : int size2 = atoi(tokens.at(2).c_str());
18294 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18295 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18296 :
18297 0 : if (size2 < 0)
18298 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
18299 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18300 :
18301 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
18302 0 : throw ConversionException("Error: incorrect number of values in field \"" +
18303 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18304 :
18305 0 : int k = 3;
18306 : try {
18307 0 : vector<CorrelatorTypeMod::CorrelatorType> v_aux;
18308 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
18309 0 : v_aux.clear();
18310 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
18311 0 : v_aux.push_back(CCorrelatorType::newCorrelatorType(tokens.at(k).c_str()));
18312 0 : k++;
18313 : }
18314 0 : result.push_back(v_aux);
18315 : }
18316 0 : }
18317 0 : catch (...) {
18318 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelatorType.", tableName);
18319 0 : }
18320 0 : return result;
18321 0 : }
18322 :
18323 :
18324 0 : vector<vector<vector<CorrelatorTypeMod::CorrelatorType> > > EnumerationParser::getCorrelatorType3D(const string &name, const string &tableName, const string &xmlDoc) {
18325 0 : vector<vector<vector<CorrelatorTypeMod::CorrelatorType> > >result;
18326 :
18327 0 : string s = getField(xmlDoc,name);
18328 0 : if (s.length() == 0)
18329 0 : throw ConversionException("Error: Missing field \"" +
18330 0 : name + "\" or invalid syntax",tableName);
18331 :
18332 0 : istringstream iss;
18333 0 : iss.str(s);
18334 0 : vector<string> tokens;
18335 :
18336 : // Tokenize.
18337 0 : string buf;
18338 0 : while (iss >> buf) {
18339 0 : tokens.push_back(buf);
18340 : }
18341 :
18342 : // The length must be 4 at the minimum (there may be an empty array)
18343 0 : if (tokens.size() < 4)
18344 0 : throw ConversionException("Error: missing values in field \"" +
18345 0 : name + "\" or invalid syntax(" + s +"')",tableName);
18346 :
18347 :
18348 : // The number of dimension should be 3.
18349 0 : if (tokens.at(0) != "3")
18350 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
18351 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18352 :
18353 : // Then parse the size of the three dimensions
18354 0 : errno = 0;
18355 0 : int size1 = atoi(tokens.at(1).c_str());
18356 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18357 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18358 :
18359 0 : if (size1 <= 0)
18360 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18361 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18362 :
18363 0 : errno = 0;
18364 0 : int size2 = atoi(tokens.at(2).c_str());
18365 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18366 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18367 :
18368 0 : if (size2 <= 0)
18369 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18370 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18371 :
18372 0 : errno = 0;
18373 0 : int size3 = atoi(tokens.at(3).c_str());
18374 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18375 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18376 :
18377 :
18378 0 : if (size3 < 0)
18379 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
18380 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18381 :
18382 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
18383 0 : throw ConversionException("Error: incorrect number of values in field \"" +
18384 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18385 :
18386 0 : int k = 4;
18387 : try {
18388 0 : vector<CorrelatorTypeMod::CorrelatorType> v_aux;
18389 0 : vector<vector<CorrelatorTypeMod::CorrelatorType> > vv_aux;
18390 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
18391 0 : vv_aux.clear();
18392 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
18393 0 : v_aux.clear();
18394 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
18395 0 : v_aux.push_back(CCorrelatorType::newCorrelatorType(tokens.at(k).c_str()));
18396 0 : k++;
18397 : }
18398 0 : vv_aux.push_back(v_aux);
18399 : }
18400 0 : result.push_back(vv_aux);
18401 : }
18402 0 : }
18403 0 : catch (...) {
18404 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a CorrelatorType.", tableName);
18405 0 : }
18406 :
18407 0 : return result;
18408 0 : }
18409 :
18410 :
18411 :
18412 :
18413 :
18414 0 : string EnumerationParser::toXML(const string& elementName, DopplerTrackingModeMod::DopplerTrackingMode e) {
18415 0 : return "<"+elementName+">"+CDopplerTrackingMode::name(e)+"</"+elementName+">";
18416 : }
18417 :
18418 0 : string EnumerationParser::toXML(const string& elementName, const vector<DopplerTrackingModeMod::DopplerTrackingMode>& v_e) {
18419 0 : ostringstream oss;
18420 : oss << "<" << elementName << ">"
18421 : << " 1"
18422 0 : << " " << v_e.size();
18423 :
18424 0 : for (unsigned int i = 0; i < v_e.size(); i++)
18425 0 : oss << " " << CDopplerTrackingMode::name(v_e.at(i));
18426 0 : oss << "</" << elementName << ">";
18427 0 : return oss.str();
18428 0 : }
18429 :
18430 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<DopplerTrackingModeMod::DopplerTrackingMode> >& vv_e) {
18431 0 : ostringstream oss;
18432 : oss << "<" << elementName << ">"
18433 : << " 2"
18434 0 : << " " <<vv_e.size()
18435 0 : << " " <<vv_e.at(0).size();
18436 :
18437 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
18438 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
18439 0 : oss << " " << CDopplerTrackingMode::name(vv_e.at(i).at(j));
18440 0 : oss << "</" << elementName << ">";
18441 0 : return oss.str();
18442 0 : }
18443 :
18444 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<DopplerTrackingModeMod::DopplerTrackingMode> > >& vvv_e) {
18445 0 : ostringstream oss;
18446 : oss << "<" << elementName << ">"
18447 : << " 3"
18448 0 : << " " <<vvv_e.size()
18449 0 : << " " <<vvv_e.at(0).size()
18450 0 : << " " <<vvv_e.at(0).at(0).size();
18451 :
18452 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
18453 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
18454 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
18455 0 : oss << " " << CDopplerTrackingMode::name(vvv_e.at(i).at(j).at(k));
18456 0 : oss << "</" << elementName << ">";
18457 0 : return oss.str();
18458 0 : }
18459 :
18460 0 : DopplerTrackingModeMod::DopplerTrackingMode EnumerationParser::getDopplerTrackingMode(const string &name, const string &tableName, const string &xmlDoc) {
18461 0 : string s = getField(xmlDoc,name);
18462 0 : if (s.length() == 0)
18463 0 : throw ConversionException("Error: Missing field \"" +
18464 0 : name + "\" or invalid syntax",tableName);
18465 :
18466 : DopplerTrackingMode result;
18467 : try {
18468 0 : result = CDopplerTrackingMode::newDopplerTrackingMode(s);
18469 : }
18470 0 : catch (...) {
18471 0 : throw ConversionException("Error: could not convert '"+s+"' into a DopplerTrackingMode.", tableName);
18472 0 : }
18473 0 : return result;
18474 0 : }
18475 :
18476 0 : vector<DopplerTrackingModeMod::DopplerTrackingMode> EnumerationParser::getDopplerTrackingMode1D(const string &name, const string &tableName, const string &xmlDoc) {
18477 0 : vector<DopplerTrackingModeMod::DopplerTrackingMode> result;
18478 :
18479 0 : string s = getField(xmlDoc,name);
18480 0 : if (s.length() == 0)
18481 0 : throw ConversionException("Error: Missing field \"" +
18482 0 : name + "\" or invalid syntax",tableName);
18483 :
18484 0 : istringstream iss;
18485 0 : iss.str(s);
18486 0 : vector<string> tokens;
18487 :
18488 : // Tokenize.
18489 0 : string buf;
18490 0 : while (iss >> buf) {
18491 0 : tokens.push_back(buf);
18492 : }
18493 :
18494 : // The length must be 2 at the minimum (there may be an empty array)
18495 0 : if (tokens.size() < 2)
18496 0 : throw ConversionException("Error: missing values in field \"" +
18497 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18498 :
18499 :
18500 :
18501 : // The number of dimension should be 1.
18502 0 : if (tokens.at(0) != "1")
18503 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
18504 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18505 :
18506 : // Then parse the size of the unique dimension
18507 0 : errno = 0;
18508 0 : int size1 = atoi(tokens.at(1).c_str());
18509 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18510 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18511 :
18512 0 : if (size1 < 0)
18513 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
18514 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18515 :
18516 0 : if (tokens.size() != (unsigned int) (size1 + 2))
18517 0 : throw ConversionException("Error: incorrect number of values in field \"" +
18518 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18519 :
18520 0 : int k = 2;
18521 : try {
18522 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
18523 0 : result.push_back(CDopplerTrackingMode::newDopplerTrackingMode(tokens.at(k).c_str()));
18524 0 : k++;
18525 : }
18526 : }
18527 0 : catch (...) {
18528 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DopplerTrackingMode.", tableName);
18529 0 : }
18530 :
18531 0 : return result;
18532 0 : }
18533 :
18534 0 : vector<vector<DopplerTrackingModeMod::DopplerTrackingMode> > EnumerationParser::getDopplerTrackingMode2D(const string &name, const string &tableName, const string &xmlDoc) {
18535 0 : vector<vector<DopplerTrackingModeMod::DopplerTrackingMode> > result;
18536 :
18537 0 : string s = getField(xmlDoc,name);
18538 0 : if (s.length() == 0)
18539 0 : throw ConversionException("Error: Missing field \"" +
18540 0 : name + "\" or invalid syntax",tableName);
18541 :
18542 0 : istringstream iss;
18543 0 : iss.str(s);
18544 0 : vector<string> tokens;
18545 :
18546 : // Tokenize.
18547 0 : string buf;
18548 0 : while (iss >> buf) {
18549 0 : tokens.push_back(buf);
18550 : }
18551 :
18552 : // The length must be 3 at the minimum (there may be an empty array)
18553 0 : if (tokens.size() < 3)
18554 0 : throw ConversionException("Error: missing values in field \"" +
18555 0 : name + "\" or invalid syntax(" + s +"')",tableName);
18556 :
18557 :
18558 : // The number of dimension should be 2.
18559 0 : if (tokens.at(0) != "2")
18560 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
18561 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18562 :
18563 : // Then parse the size of the two dimensions
18564 0 : errno = 0;
18565 0 : int size1 = atoi(tokens.at(1).c_str());
18566 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18567 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18568 :
18569 0 : if (size1 <= 0)
18570 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18571 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18572 0 : errno = 0;
18573 0 : int size2 = atoi(tokens.at(2).c_str());
18574 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18575 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18576 :
18577 0 : if (size2 < 0)
18578 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
18579 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18580 :
18581 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
18582 0 : throw ConversionException("Error: incorrect number of values in field \"" +
18583 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18584 :
18585 0 : int k = 3;
18586 : try {
18587 0 : vector<DopplerTrackingModeMod::DopplerTrackingMode> v_aux;
18588 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
18589 0 : v_aux.clear();
18590 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
18591 0 : v_aux.push_back(CDopplerTrackingMode::newDopplerTrackingMode(tokens.at(k).c_str()));
18592 0 : k++;
18593 : }
18594 0 : result.push_back(v_aux);
18595 : }
18596 0 : }
18597 0 : catch (...) {
18598 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a DopplerTrackingMode.", tableName);
18599 0 : }
18600 0 : return result;
18601 0 : }
18602 :
18603 :
18604 0 : vector<vector<vector<DopplerTrackingModeMod::DopplerTrackingMode> > > EnumerationParser::getDopplerTrackingMode3D(const string &name, const string &tableName, const string &xmlDoc) {
18605 0 : vector<vector<vector<DopplerTrackingModeMod::DopplerTrackingMode> > >result;
18606 :
18607 0 : string s = getField(xmlDoc,name);
18608 0 : if (s.length() == 0)
18609 0 : throw ConversionException("Error: Missing field \"" +
18610 0 : name + "\" or invalid syntax",tableName);
18611 :
18612 0 : istringstream iss;
18613 0 : iss.str(s);
18614 0 : vector<string> tokens;
18615 :
18616 : // Tokenize.
18617 0 : string buf;
18618 0 : while (iss >> buf) {
18619 0 : tokens.push_back(buf);
18620 : }
18621 :
18622 : // The length must be 4 at the minimum (there may be an empty array)
18623 0 : if (tokens.size() < 4)
18624 0 : throw ConversionException("Error: missing values in field \"" +
18625 0 : name + "\" or invalid syntax(" + s +"')",tableName);
18626 :
18627 :
18628 : // The number of dimension should be 3.
18629 0 : if (tokens.at(0) != "3")
18630 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
18631 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18632 :
18633 : // Then parse the size of the three dimensions
18634 0 : errno = 0;
18635 0 : int size1 = atoi(tokens.at(1).c_str());
18636 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18637 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18638 :
18639 0 : if (size1 <= 0)
18640 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18641 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18642 :
18643 0 : errno = 0;
18644 0 : int size2 = atoi(tokens.at(2).c_str());
18645 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18646 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18647 :
18648 0 : if (size2 <= 0)
18649 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18650 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18651 :
18652 0 : errno = 0;
18653 0 : int size3 = atoi(tokens.at(3).c_str());
18654 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18655 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18656 :
18657 :
18658 0 : if (size3 < 0)
18659 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
18660 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18661 :
18662 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
18663 0 : throw ConversionException("Error: incorrect number of values in field \"" +
18664 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18665 :
18666 0 : int k = 4;
18667 : try {
18668 0 : vector<DopplerTrackingModeMod::DopplerTrackingMode> v_aux;
18669 0 : vector<vector<DopplerTrackingModeMod::DopplerTrackingMode> > vv_aux;
18670 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
18671 0 : vv_aux.clear();
18672 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
18673 0 : v_aux.clear();
18674 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
18675 0 : v_aux.push_back(CDopplerTrackingMode::newDopplerTrackingMode(tokens.at(k).c_str()));
18676 0 : k++;
18677 : }
18678 0 : vv_aux.push_back(v_aux);
18679 : }
18680 0 : result.push_back(vv_aux);
18681 : }
18682 0 : }
18683 0 : catch (...) {
18684 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a DopplerTrackingMode.", tableName);
18685 0 : }
18686 :
18687 0 : return result;
18688 0 : }
18689 :
18690 :
18691 :
18692 :
18693 :
18694 0 : string EnumerationParser::toXML(const string& elementName, SynthProfMod::SynthProf e) {
18695 0 : return "<"+elementName+">"+CSynthProf::name(e)+"</"+elementName+">";
18696 : }
18697 :
18698 0 : string EnumerationParser::toXML(const string& elementName, const vector<SynthProfMod::SynthProf>& v_e) {
18699 0 : ostringstream oss;
18700 : oss << "<" << elementName << ">"
18701 : << " 1"
18702 0 : << " " << v_e.size();
18703 :
18704 0 : for (unsigned int i = 0; i < v_e.size(); i++)
18705 0 : oss << " " << CSynthProf::name(v_e.at(i));
18706 0 : oss << "</" << elementName << ">";
18707 0 : return oss.str();
18708 0 : }
18709 :
18710 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<SynthProfMod::SynthProf> >& vv_e) {
18711 0 : ostringstream oss;
18712 : oss << "<" << elementName << ">"
18713 : << " 2"
18714 0 : << " " <<vv_e.size()
18715 0 : << " " <<vv_e.at(0).size();
18716 :
18717 0 : for (unsigned int i = 0; i < vv_e.size(); i++)
18718 0 : for (unsigned int j = 0; j < vv_e.at(i).size(); j++)
18719 0 : oss << " " << CSynthProf::name(vv_e.at(i).at(j));
18720 0 : oss << "</" << elementName << ">";
18721 0 : return oss.str();
18722 0 : }
18723 :
18724 0 : string EnumerationParser::toXML(const string& elementName, const vector<vector<vector<SynthProfMod::SynthProf> > >& vvv_e) {
18725 0 : ostringstream oss;
18726 : oss << "<" << elementName << ">"
18727 : << " 3"
18728 0 : << " " <<vvv_e.size()
18729 0 : << " " <<vvv_e.at(0).size()
18730 0 : << " " <<vvv_e.at(0).at(0).size();
18731 :
18732 0 : for (unsigned int i = 0; i < vvv_e.size(); i++)
18733 0 : for (unsigned int j = 0; j < vvv_e.at(i).size(); j++)
18734 0 : for (unsigned int k = 0; k < vvv_e.at(i).at(j).size(); k++)
18735 0 : oss << " " << CSynthProf::name(vvv_e.at(i).at(j).at(k));
18736 0 : oss << "</" << elementName << ">";
18737 0 : return oss.str();
18738 0 : }
18739 :
18740 0 : SynthProfMod::SynthProf EnumerationParser::getSynthProf(const string &name, const string &tableName, const string &xmlDoc) {
18741 0 : string s = getField(xmlDoc,name);
18742 0 : if (s.length() == 0)
18743 0 : throw ConversionException("Error: Missing field \"" +
18744 0 : name + "\" or invalid syntax",tableName);
18745 :
18746 : SynthProf result;
18747 : try {
18748 0 : result = CSynthProf::newSynthProf(s);
18749 : }
18750 0 : catch (...) {
18751 0 : throw ConversionException("Error: could not convert '"+s+"' into a SynthProf.", tableName);
18752 0 : }
18753 0 : return result;
18754 0 : }
18755 :
18756 0 : vector<SynthProfMod::SynthProf> EnumerationParser::getSynthProf1D(const string &name, const string &tableName, const string &xmlDoc) {
18757 0 : vector<SynthProfMod::SynthProf> result;
18758 :
18759 0 : string s = getField(xmlDoc,name);
18760 0 : if (s.length() == 0)
18761 0 : throw ConversionException("Error: Missing field \"" +
18762 0 : name + "\" or invalid syntax",tableName);
18763 :
18764 0 : istringstream iss;
18765 0 : iss.str(s);
18766 0 : vector<string> tokens;
18767 :
18768 : // Tokenize.
18769 0 : string buf;
18770 0 : while (iss >> buf) {
18771 0 : tokens.push_back(buf);
18772 : }
18773 :
18774 : // The length must be 2 at the minimum (there may be an empty array)
18775 0 : if (tokens.size() < 2)
18776 0 : throw ConversionException("Error: missing values in field \"" +
18777 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18778 :
18779 :
18780 :
18781 : // The number of dimension should be 1.
18782 0 : if (tokens.at(0) != "1")
18783 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
18784 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18785 :
18786 : // Then parse the size of the unique dimension
18787 0 : errno = 0;
18788 0 : int size1 = atoi(tokens.at(1).c_str());
18789 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18790 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18791 :
18792 0 : if (size1 < 0)
18793 0 : throw ConversionException("Error: wrong size for the unique dimension \"" +
18794 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18795 :
18796 0 : if (tokens.size() != (unsigned int) (size1 + 2))
18797 0 : throw ConversionException("Error: incorrect number of values in field \"" +
18798 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18799 :
18800 0 : int k = 2;
18801 : try {
18802 0 : for (unsigned int i = 0 ; i < (unsigned int) size1; i++) {
18803 0 : result.push_back(CSynthProf::newSynthProf(tokens.at(k).c_str()));
18804 0 : k++;
18805 : }
18806 : }
18807 0 : catch (...) {
18808 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SynthProf.", tableName);
18809 0 : }
18810 :
18811 0 : return result;
18812 0 : }
18813 :
18814 0 : vector<vector<SynthProfMod::SynthProf> > EnumerationParser::getSynthProf2D(const string &name, const string &tableName, const string &xmlDoc) {
18815 0 : vector<vector<SynthProfMod::SynthProf> > result;
18816 :
18817 0 : string s = getField(xmlDoc,name);
18818 0 : if (s.length() == 0)
18819 0 : throw ConversionException("Error: Missing field \"" +
18820 0 : name + "\" or invalid syntax",tableName);
18821 :
18822 0 : istringstream iss;
18823 0 : iss.str(s);
18824 0 : vector<string> tokens;
18825 :
18826 : // Tokenize.
18827 0 : string buf;
18828 0 : while (iss >> buf) {
18829 0 : tokens.push_back(buf);
18830 : }
18831 :
18832 : // The length must be 3 at the minimum (there may be an empty array)
18833 0 : if (tokens.size() < 3)
18834 0 : throw ConversionException("Error: missing values in field \"" +
18835 0 : name + "\" or invalid syntax(" + s +"')",tableName);
18836 :
18837 :
18838 : // The number of dimension should be 2.
18839 0 : if (tokens.at(0) != "2")
18840 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
18841 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18842 :
18843 : // Then parse the size of the two dimensions
18844 0 : errno = 0;
18845 0 : int size1 = atoi(tokens.at(1).c_str());
18846 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18847 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18848 :
18849 0 : if (size1 <= 0)
18850 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18851 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18852 0 : errno = 0;
18853 0 : int size2 = atoi(tokens.at(2).c_str());
18854 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18855 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18856 :
18857 0 : if (size2 < 0)
18858 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
18859 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18860 :
18861 0 : if (tokens.size() != (unsigned int) (size1*size2 + 3))
18862 0 : throw ConversionException("Error: incorrect number of values in field \"" +
18863 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18864 :
18865 0 : int k = 3;
18866 : try {
18867 0 : vector<SynthProfMod::SynthProf> v_aux;
18868 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
18869 0 : v_aux.clear();
18870 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
18871 0 : v_aux.push_back(CSynthProf::newSynthProf(tokens.at(k).c_str()));
18872 0 : k++;
18873 : }
18874 0 : result.push_back(v_aux);
18875 : }
18876 0 : }
18877 0 : catch (...) {
18878 0 : throw ConversionException("Error: in '" + s + "' could not convert '"+tokens.at(k)+"' into a SynthProf.", tableName);
18879 0 : }
18880 0 : return result;
18881 0 : }
18882 :
18883 :
18884 0 : vector<vector<vector<SynthProfMod::SynthProf> > > EnumerationParser::getSynthProf3D(const string &name, const string &tableName, const string &xmlDoc) {
18885 0 : vector<vector<vector<SynthProfMod::SynthProf> > >result;
18886 :
18887 0 : string s = getField(xmlDoc,name);
18888 0 : if (s.length() == 0)
18889 0 : throw ConversionException("Error: Missing field \"" +
18890 0 : name + "\" or invalid syntax",tableName);
18891 :
18892 0 : istringstream iss;
18893 0 : iss.str(s);
18894 0 : vector<string> tokens;
18895 :
18896 : // Tokenize.
18897 0 : string buf;
18898 0 : while (iss >> buf) {
18899 0 : tokens.push_back(buf);
18900 : }
18901 :
18902 : // The length must be 4 at the minimum (there may be an empty array)
18903 0 : if (tokens.size() < 4)
18904 0 : throw ConversionException("Error: missing values in field \"" +
18905 0 : name + "\" or invalid syntax(" + s +"')",tableName);
18906 :
18907 :
18908 : // The number of dimension should be 3.
18909 0 : if (tokens.at(0) != "3")
18910 0 : throw ConversionException("Error: wrong dimensionality in field \"" +
18911 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18912 :
18913 : // Then parse the size of the three dimensions
18914 0 : errno = 0;
18915 0 : int size1 = atoi(tokens.at(1).c_str());
18916 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18917 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18918 :
18919 0 : if (size1 <= 0)
18920 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18921 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18922 :
18923 0 : errno = 0;
18924 0 : int size2 = atoi(tokens.at(2).c_str());
18925 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18926 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18927 :
18928 0 : if (size2 <= 0)
18929 0 : throw ConversionException("Error: wrong size for the first dimension \"" +
18930 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18931 :
18932 0 : errno = 0;
18933 0 : int size3 = atoi(tokens.at(3).c_str());
18934 0 : if (errno != 0) throw ConversionException("Error: Field \"" +
18935 0 : name + "\": Invalid XML syntax ('" + s +"')", tableName);
18936 :
18937 :
18938 0 : if (size3 < 0)
18939 0 : throw ConversionException("Error: wrong size for the second dimension \"" +
18940 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18941 :
18942 0 : if (tokens.size() != (unsigned int) (size1*size2*size3 + 4))
18943 0 : throw ConversionException("Error: incorrect number of values in field \"" +
18944 0 : name + "\" or invalid syntax('" + s +"')",tableName);
18945 :
18946 0 : int k = 4;
18947 : try {
18948 0 : vector<SynthProfMod::SynthProf> v_aux;
18949 0 : vector<vector<SynthProfMod::SynthProf> > vv_aux;
18950 0 : for (unsigned int i = 0; i < (unsigned int) size1; i++) {
18951 0 : vv_aux.clear();
18952 0 : for (unsigned int j = 0; j < (unsigned int) size2; j++) {
18953 0 : v_aux.clear();
18954 0 : for (unsigned int l = 0; l < (unsigned int) size3; l++) {
18955 0 : v_aux.push_back(CSynthProf::newSynthProf(tokens.at(k).c_str()));
18956 0 : k++;
18957 : }
18958 0 : vv_aux.push_back(v_aux);
18959 : }
18960 0 : result.push_back(vv_aux);
18961 : }
18962 0 : }
18963 0 : catch (...) {
18964 0 : throw ConversionException("Error:in '" + s + "' could not convert '"+tokens.at(k)+"' into a SynthProf.", tableName);
18965 0 : }
18966 :
18967 0 : return result;
18968 0 : }
18969 :
18970 :
18971 :
18972 : } // namespace asdm.
18973 :
|