General Purpose Geodetic Library
SgIoAgv.cpp
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of Space Geodetic Library. The library is used by
4  * nuSolve, a part of CALC/SOLVE system, and designed to make analysis of
5  * geodetic VLBI observations.
6  * Copyright (C) 2010-2020 Sergei Bolotin.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #include <iostream>
24 #include <stdlib.h>
25 
26 #include <QtCore/QFile>
27 #include <QtCore/QList>
28 #include <QtCore/QRegExp>
29 #include <QtCore/QTextStream>
30 
31 
32 
33 #include <Sg3dVector.h>
34 #include <SgConstants.h>
35 #include <SgEccRec.h>
36 #include <SgIdentities.h>
37 #include <SgLogger.h>
38 #include <SgVersion.h>
39 #include <SgVgosDb.h>
40 #include <SgVlbiBand.h>
41 #include <SgVlbiObservation.h>
42 #include <SgVlbiSession.h>
43 #include <SgVlbiStationInfo.h>
44 
45 
46 
47 
48 #include <SgIoAgv.h>
49 #include <SgIoAgvDriver.h>
50 
51 
52 //#define LOCAL_DEBUG
53 
54 
55 
56 extern QString strNa;
57 //const QString strNa("N/A");
58 
59 /*=====================================================================================================*/
60 /* */
61 /* SgAgvDatumDescriptor implementation */
62 /* */
63 /*=====================================================================================================*/
64 //
65 SgAgvDatumDescriptor::SgAgvDatumDescriptor(const QString& lCode, const QString descr,
66  AgvDataScope scp, AgvDataType typ, int d1, int d2, unsigned int exp, bool hasMutableScope) :
67  lCode_(lCode),
68  description_(descr)
69 {
70  dataScope_ = scp;
71  dataType_ = typ;
72  dim1_ = d1;
73  dim2_ = d2;
74  hasData_ = false;
75  expectance_ = exp;
76  switch (dataScope_)
77  {
78  case ADS_SESSION:
79  dim3_ = 1;
80  dim4_ = 1;
81  break;
82  case ADS_SCAN:
84  dim4_ = 1;
85  break;
86  case ADS_STATION:
88  dim4_ = SD_NumStn;
89  break;
90  case ADS_BASELINE:
91  dim3_ = SD_NumObs;
92  dim4_ = 1;
93  break;
94  case ADS_NONE:
95  default:
96  dim3_ = 0;
97  dim4_ = 0;
98  break;
99  };
100  driver_ = NULL;
101  hasMutableScope_ = hasMutableScope;
102 };
103 
104 
105 
106 //
108 {
109  lCode_ = add.getLCode();
111  dataScope_ = add.getDataScope();
112  dataType_ = add.getDataType();
113  dim1_ = add.getDim1();
114  dim2_ = add.getDim2();
115  dim3_ = add.getDim3();
116  dim4_ = add.getDim4();
117  driver_ = add.driver_;
118  hasData_ = add.getHasData();
119  expectance_ = add.getExpectance();
121 };
122 
123 
124 
125 //
127 {
128  if (0 < d)
129  return d;
130  if (!driver_)
131  {
133  "::effectiveSize(): the driver is NULL for the lCode \"" + lCode_ + "\"");
134  return 0;
135  };
136 
137  if (d == SD_NumObs)
138  d = driver_->getNumOfObs();
139  else if (d == SD_NumScans)
140  d = driver_->getNumOfScans();
141  else if (d == SD_NumChans)
142  {
144  "::effectiveSize(): the type SD_NumChans is not used in this format; the lCode is \"" +
145  lCode_ + "\"");
146  d = 0;
147  }
148  else if (d == SD_2NumChans)
149  {
151  "::effectiveSize(): the type SD_2NumChans is not used in this format; the lCode is \"" +
152  lCode_ + "\"");
153  d = 0;
154  }
155  else if (d == SD_NumStnPts)
156  d = driver_->getMaxNumPerStn();
157  else if (d == SD_NumSrc)
158  d = driver_->getNumOfSrc();
159  else if (d == SD_NumStn)
160  d = driver_->getNumOfStn();
161  else if (d == SD_NumBands)
162  d = driver_->getNumOfBands();
163  else if (d == SD_NumBln)
164  d = driver_->getNumOfBln();
165  else if (d < 0)
166  {
168  "::effectiveSize(): uknown special dimension \"" + QString("").setNum(d) + "\" for the lCode \"" +
169  lCode_ + "\"");
170  d = 0;
171  };
172  return d;
173 // inline const QMap<QString, int>& getNumOfChansByBand() const {return numOfChansByBand_;};
174 // inline int getNumOfStnPts() const {return numOfStnPts_;};
175 // inline int getNumOfChans2() const {return numOfChans2_;};
176 // inline const QMap<QString, int>& getNumOfObsByStn() const {return numOfObsByStn_;};
177 };
178 
179 
180 
181 //
183 {
184  int n;
185  if (dataScope_ != ADS_STATION)
186  n = totalMaxSize();
187  else // special case for stations, data are NOT arrays there:
188  {
189  n = 0;
190  for (QMap<QString, int>::const_iterator it=driver_->getNumOfObsByStn().begin();
191  it != driver_->getNumOfObsByStn().end(); ++it)
192  n += it.value();
193  n *= (dataType_==ADT_CHAR?1:d1())*d2();
194  };
195  return n;
196 };
197 
198 
199 
200 //
202 {
203  const QString dtype2char[] = {"NO", "C1", "I2", "I4", "I8", "R4", "R8"};
204  return dtype2char[tp];
205 };
206 
207 
208 
209 //
211 {
212  const QString scope2char[] = {"NON", "SES", "SCA", "STA", "BAS"};
213  return scope2char[sc];
214 };
215 /*=====================================================================================================*/
216 
217 
218 
219 
220 
221 /*=====================================================================================================*/
222 /* */
223 /* SgAgvDatum implementation */
224 /* */
225 /*=====================================================================================================*/
226 template<class C> void SgAgvDatum<C>::allocateSpace()
227 {
228  if (!descriptor_)
229  {
230  logger->write(SgLogger::ERR, SgLogger::IO_TXT, className() +
231  "::allocateSpace(): the descriptor is NULL");
232  data_ = NULL;
233  return;
234  };
235 // if (data_)
236 // return; // already allocated
237 
238  int numOfElements=descriptor_->totalMaxSize();
239  if (numOfElements<=0)
240  {
241  logger->write(SgLogger::ERR, SgLogger::IO_TXT, className() +
242  "::allocateSpace(): cannot allocate space for the descriptor \"" + descriptor_->getLCode() +
243  "\": the size, " + QString("").setNum(numOfElements) + ", is unusable");
244  data_ = NULL;
245  return;
246  };
247  freeSpace();
248  data_ = new C[numOfElements];
249  memset((void*)data_, 0, numOfElements*sizeof(C));
250 };
251 
252 
253 
254 //
255 template<class C> void SgAgvDatum<C>::freeSpace()
256 {
257  if (data_)
258  delete []data_;
259  data_ = NULL;
260 };
261 
262 
263 
264 //
265 template<class C> bool SgAgvDatum<C>::isEmpty()
266 {
267  if (!data_)
268  {
269  logger->write(SgLogger::ERR, SgLogger::IO_TXT, className() +
270  "::isEmpty(): the data are not allocated yet");
271  return true;
272  };
273  //
274  for (int i=0; i<descriptor_->totalMaxSize(); i++)
275  if (*(data_ + i) != C(0))
276  return false;
277  return true;
278 };
279 
280 
281 
282 //
283 template<class C> C SgAgvDatum<C>::getValue(int idx1, int idx2, int idx3, int idx4) const
284 {
285  if (!descriptor_)
286  {
287  logger->write(SgLogger::ERR, SgLogger::IO_TXT, className() +
288  "::getValue(): the descriptor is NULL");
289  return (C)0;
290  };
291  return
292  ( idx1<descriptor_->d1() &&
293  idx2<descriptor_->d2() &&
294  idx3<descriptor_->d3() &&
295  idx4<descriptor_->d4() )?
296  *(data_ + idx1 +
297  descriptor_->d1()*idx2 +
298  descriptor_->d1()*descriptor_->d2()*idx3 +
299  descriptor_->d1()*descriptor_->d2()*descriptor_->d3()*idx4) : (C)0;
300 };
301 
302 
303 
304 //
305 template<class C> C& SgAgvDatum<C>::value(int idx1, int idx2, int idx3, int idx4)
306 {
307  if (!descriptor_)
308  {
309  logger->write(SgLogger::ERR, SgLogger::IO_TXT, className() +
310  "::value(): the descriptor is NULL");
311  return *data_;
312  };
313  if (idx1<0 || descriptor_->d1()<=idx1)
314  logger->write(SgLogger::ERR, SgLogger::IO_TXT, className() +
315  QString().sprintf("::value(): the first index, %d, is out of range [0:%d] ",
316  idx1, descriptor_->d1()) + descriptor_->getLCode());
317  if (idx2<0 || descriptor_->d2()<=idx2)
318  logger->write(SgLogger::ERR, SgLogger::IO_TXT, className() +
319  QString().sprintf("::value(): the second index, %d, is out of range [0:%d] ",
320  idx2, descriptor_->d2()) + descriptor_->getLCode());
321  if (idx3<0 || descriptor_->d3()<=idx3)
322  logger->write(SgLogger::ERR, SgLogger::IO_TXT, className() +
323  QString().sprintf("::value(): the third index, %d, is out of range [0:%d] ",
324  idx3, descriptor_->d3()) + descriptor_->getLCode());
325  if (idx4<0 || descriptor_->d4()<=idx4)
326  logger->write(SgLogger::ERR, SgLogger::IO_TXT, className() +
327  QString().sprintf("::value(): the fourth index, %d, is out of range [0:%d] ",
328  idx4, descriptor_->d4()) + descriptor_->getLCode());
329 
330  return *(data_ + idx1 +
331  descriptor_->d1()*idx2 +
332  descriptor_->d1()*descriptor_->d2()*idx3 +
333  descriptor_->d1()*descriptor_->d2()*descriptor_->d3()*idx4);
334 };
335 /*=====================================================================================================*/
336 
337 
338 
339 
340 /*=====================================================================================================*/
341 /* */
342 /* SgAgvDatumString implementation */
343 /* */
344 /*=====================================================================================================*/
346 {
347  if (!descriptor_)
348  {
350  "::allocateSpace(): the descriptor is NULL");
351  return;
352  };
353 
354  //if (data_)
355  // return; // already allocated
356 
357  int numOfElements=descriptor_->d2()*descriptor_->d3()*descriptor_->d4();
358  if (numOfElements<=0)
359  {
361  "::allocateSpace(): cannot allocate space for the descriptor \"" + descriptor_->getLCode() +
362  "\": the size, " + QString("").setNum(numOfElements) + ", is unusable");
363  return;
364  };
365  freeSpace();
366  data_ = new QString[numOfElements];
367  for (int i=0; i<numOfElements; i++)
368  *(data_ + i) = descriptor_->d1()>0 ? QString(descriptor_->d1(), QChar(' ')) : QString("");
369 };
370 
371 
372 
373 //
375 {
376  if (data_)
377  delete []data_;
378  data_ = NULL;
379 };
380 
381 
382 
383 //
385 {
386  if (!data_)
387  return true;
388  //
389  int d1=descriptor_->d1();
390  if (d1 <= 0)
391  return true;
392  QString emptyStr(d1, QChar(' '));
393  int numOfElements=descriptor_->d2()*descriptor_->d3()*descriptor_->d4();
394  //
395  //numOfElements = descriptor_->totalSize()/d1
396 
397  for (int i=0; i<numOfElements; i++)
398  if (*(data_ + i) != emptyStr)
399  return false;
400  return true;
401 };
402 
403 
404 
405 //
406 const QString& SgAgvDatumString::getValue(int idx2, int idx3, int idx4) const
407 {
408  if (!descriptor_)
409  {
411  "::getValue(): the descriptor is NULL");
412  return strNa;
413  };
414  return
415  ( idx2<descriptor_->d2() &&
416  idx3<descriptor_->d3() &&
417  idx4<descriptor_->d4() )?
418  *(data_ + idx2 +
419  descriptor_->d2()*idx3 +
420  descriptor_->d2()*descriptor_->d3()*idx4) : strNa;
421 };
422 
423 
424 
425 //
426 QString& SgAgvDatumString::value(int idx2, int idx3, int idx4)
427 {
428  if (!descriptor_)
429  {
431  "::value(): the descriptor is NULL");
432  return *data_;
433  };
434  if (idx2<0 || descriptor_->d2()<=idx2)
436  QString().sprintf("::value(): the second index, %d, is out of range [0:%d] ",
437  idx2, descriptor_->d2() - 1) +
438  "for " + descriptor_->getLCode());
439  if (idx3<0 || descriptor_->d3()<=idx3)
441  QString().sprintf("::value(): the third index, %d, is out of range [0:%d] ",
442  idx3, descriptor_->d3() - 1) +
443  "for " + descriptor_->getLCode());
444  if (idx4<0 || descriptor_->d4()<=idx4)
446  QString().sprintf("::value(): the fourth index, %d, is out of range [0:%d] ",
447  idx4, descriptor_->d4() - 1) +
448  "for " + descriptor_->getLCode());
449 
450  return *(data_ + idx2 +
451  descriptor_->d2()*idx3 +
452  descriptor_->d2()*descriptor_->d3()*idx4);
453 };
454 
455 /*=====================================================================================================*/
456 
457 
458 
459 
460 
461 /*=====================================================================================================*/
462 /* */
463 /* SgAgvSection implementation */
464 /* */
465 /*=====================================================================================================*/
466 int SgAgvRecord::exportData(QTextStream& ts, const QString& prefix)
467 {
468  ts << prefix << " " << content_ << "\n";
469  return 1;
470 };
471 /*=====================================================================================================*/
472 
473 
474 
475 
476 
477 /*=====================================================================================================*/
478 /* */
479 /* SgAgvSection implementation */
480 /* */
481 /*=====================================================================================================*/
483 {
484  for (int i=0; i<size(); i++)
485  {
486  //at(i)->fillDataStructures(session);
487  };
488 
489 };
490 
491 
492 
493 //
494 int SgAgvSection::importData(QTextStream& ts, SgAgvDriver* /*drv*/)
495 {
496  int numOfReadRecords, num2read; //, idx;
497  QRegExp re(prefix_ + "\\.(\\d+)\\s+(.*)", Qt::CaseInsensitive);
498  QString str("");
499  // bool isOk;
501  numOfReadRecords = 0;
502  str = ts.readLine();
503  if (parseSectionLengthString(str, num2read))
504  {
505  numOfReadRecords = 1;
506  for (int i=0; i<num2read; i++)
507  {
508  str = ts.readLine();
509 // if (re.indexIn(str) != -1)
510  if (true || re.indexIn(str) != -1)
511  {
512 // idx = re.cap(1).toInt(&isOk);
513 // if (isOk)
514  {
515 // if (idx != idx_ + 1)
516 // logger->write(SgLogger::WRN, SgLogger::IO_TXT, className() +
517 // "::importData(): the current index, " + QString("").setNum(idx_ + 1) +
518 // ", does not match the index from input, " + QString("").setNum(idx));
519 // append(new SgAgvRecord(this, re.cap(2)));
520  append(new SgAgvRecord(this, str.mid(7)));
521  };
522  }
523  else
525  "::importData(): cannot parse a string \"" + str + "\" as a record of " + prefix_ +
526  " section");
527  };
528  numOfReadRecords += num2read;
530  "::importData(): read " + QString("").setNum(numOfReadRecords) + " records of the section " +
531  prefix_);
532  }
533  else
534  {
536  "::importData(): error reading the section_length string: \"" + str + "\"");
537  };
538 
539 #ifdef LOCAL_DEBUG
540  std::cout << " SgAgvSection::importData finished, prefix=[" << qPrintable(prefix_) << "]"
541  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
542  << "\n";
543 #endif
544 
545  return numOfReadRecords;
546 };
547 
548 
549 
550 //
551 bool SgAgvSection::parseSectionLengthString(const QString& str, int& num2read)
552 {
553  bool isOk;
554  QRegExp re(prefix_ + "\\.(\\d+)\\s+@section_length:\\s+(\\d+)\\s+.*",
555  Qt::CaseInsensitive);
556  num2read = 0;
557  isOk = false;
558  if (re.indexIn(str) != -1)
559  {
560  int idx;
561  idx = re.cap(1).toInt(&isOk);
562  if (isOk)
563  {
564  num2read = re.cap(2).toInt(&isOk);
565  if (isOk)
566  {
568  "::parseSectionLengthString(): section parsing the length string is ok: idx=" +
569  QString("").setNum(idx) + ", num2read=" + QString("").setNum(num2read));
570  if (idx != idx_ + 1)
572  "::parseSectionLengthString(): the current index, " + QString("").setNum(idx_ + 1) +
573  ", does not match the index from input, " + QString("").setNum(idx));
574  };
575  };
576  }
577  else
578  {
579  isOk = false;
581  "::parseSectionLengthString(): cannot parse the length string \"" + str + "\"");
582  };
583  return isOk;
584 };
585 /*=====================================================================================================*/
586 
587 
588 
589 
590 
591 /*=====================================================================================================*/
592 /* */
593 /* SgAgvFileSection implementation */
594 /* */
595 /*=====================================================================================================*/
597 {
598  if (size())
599  for (int i=0; i<size(); i++)
600  delete at(i);
601  clear();
602 
603  const SgIoDriver *inptDrv=session->getInputDriver();
604 
605  if (inptDrv) // can be NULL, it is ok
606  {
607  const QList<QString> inputFileNames=inptDrv->listOfInputFiles();
608  for (int i=0; i<inputFileNames.size(); i++)
609  {
610  append(new SgAgvRecord(this, inputFileNames.at(i)));
611  };
613  "::fillDataStructures(): collected " + QString("").setNum(size()) + " records");
614  }
615  else
617  "::fillDataStructures(): the input driver is NULL, nothing to do");
618 };
619 
620 
621 
622 //
623 int SgAgvFileSection::exportData(QTextStream& ts, SgAgvDriver* /*drv*/)
624 {
625  int numOfWritenRecords=0;
626  QString prfx(prefix_ + "." + QString("").setNum(idx_ + 1));
627 
628  ts << prfx << " @section_length: " << size() << " files\n";
629 
630  for (int i=0; i<size(); i++)
631  numOfWritenRecords += at(i)->exportData(ts, prfx);
632 
633  return numOfWritenRecords + 1;
634 };
635 /*=====================================================================================================*/
636 
637 
638 
639 
640 
641 /*=====================================================================================================*/
642 /* */
643 /* SgAgvPreaSection implementation */
644 /* */
645 /*=====================================================================================================*/
647 {
648  if (size())
649  for (int i=0; i<size(); i++)
650  delete at(i);
651  clear();
652  const SgIoDriver *inptDrv=session->getInputDriver();
653 
654  // these records are beyound our control:
655  append(new SgAgvRecord(this, "DEF_TYPE: 1 CHARACTER ASCII"));
656  append(new SgAgvRecord(this, "DEF_TYPE: 2 INTEGER*2 IEEE-231"));
657  append(new SgAgvRecord(this, "DEF_TYPE: 3 INTEGER*4 IEEE-231"));
658  append(new SgAgvRecord(this, "DEF_TYPE: 4 REAL*4 IEEE 754-1985"));
659  append(new SgAgvRecord(this, "DEF_TYPE: 5 REAL*8 IEEE 754-1985"));
660  append(new SgAgvRecord(this, "DEF_TYPE: 6 INTEGER*8 IEEE-231"));
661  append(new SgAgvRecord(this, "DEF_CLASS: 81 Session"));
662  append(new SgAgvRecord(this, "DEF_CLASS: 82 Scan"));
663  append(new SgAgvRecord(this, "DEF_CLASS: 83 Station"));
664  append(new SgAgvRecord(this, "DEF_CLASS: 84 Baseline"));
665 
666  if (inptDrv) // can be NULL, it is ok
667  {
668  const SgVersion *drvVersion=inptDrv->getCurrentDriverVersion();
669  const SgIdentities *ids=inptDrv->getCurrentIdentities();
670  if (drvVersion)
671  {
672  append(new SgAgvRecord(this, "GVH_VERSION: " +
673  libraryVersion.name() + " released on " +
675  append(new SgAgvRecord(this, "GENERATOR: " +
676  drvVersion->name() + " released on " +
678  };
679  append(new SgAgvRecord(this, "CREATED_AT: " +
680  SgMJD::currentMJD().toUtc().toString(SgMJD::F_SOLVE_SPLFL) + " UTC"));
681  if (ids)
682  {
683  append(new SgAgvRecord(this, "CREATED_BY: " + ids->getUserName() +
684  " ( " + ids->getUserEmailAddress() + " ) of " + ids->getAcAbbrevName() ));
685  };
686  }
687  else
689  "::fillDataStructures(): the input driver is NULL, some information is missed");
690 
692  "::fillDataStructures(): collected " + QString("").setNum(size()) + " records");
693 };
694 
695 
696 
697 //
698 int SgAgvPreaSection::exportData(QTextStream& ts, SgAgvDriver* /*drv*/)
699 {
700  int numOfWritenRecords=0;
701  QString prfx(prefix_ + "." + QString("").setNum(idx_ + 1));
702 
703  ts << prfx << " @section_length: " << size() << " keywords\n";
704 
705  for (int i=0; i<size(); i++)
706  numOfWritenRecords += at(i)->exportData(ts, prfx);
707 
708  return numOfWritenRecords + 1;
709 };
710 
711 
712 
713 //
714 int SgAgvPreaSection::importData(QTextStream& ts, SgAgvDriver* drv)
715 {
716  SgMJD t(tZero);
717  QString res;
718 //PREA.1 GVH_VERSION: SgLib-0.6.4 (Tir-na Nog'th) released on 20 Sep, 2019
719 //PREA.1 GVH_VERSION: GVH release of 2011.01.22
720  QRegExp reVer("^GVH_VERSION:\\s+(.+)(?: released on | release of )\\s*(.*)",
721  Qt::CaseInsensitive);
722 //PREA.1 GENERATOR: nuSolve-0.6.4 (Corilaine) released on 20 Sep, 2019
723 //PREA.1 GENERATOR: gvf_transform v 3.0 release of 2019.09.15 AFTER nuSolve-0.6.4
724 //PREA.1 GENERATOR: PIMA v 2.22 2016.02.29
725 //PREA.1 GENERATOR: PIMA v 2.30g 2019.02.24
726 //PREA.1 GENERATOR: mark3_to_gvf Version of 2007.10.15
727  QRegExp reGen("^GENERATOR:\\s+(.+)(?: released on | v | Version of )\\s*(.*)",
728  Qt::CaseInsensitive);
729 //PREA.1 CREATED_AT: 2019.10.04-18:42:44 UTC
730 //PREA.1 CREATED_AT: 2016.04.23-22:14:04
731  QRegExp reCat("^CREATED_AT:\\s+(\\d{4}\\.\\d{2}\\.\\d{2}-\\d{2}:\\d{2}:\\d{2})"
732  "\\s*([A-Z0-9:+-]*)",
733  Qt::CaseInsensitive);
734 //PREA.1 CREATED_BY: Sergei Bolotin ( sergei.bolotin@nasa.gov ) of NASA GSFC
735 //PREA.1 CREATED_BY: Leonid Petrov ( lpetrov@astrogeo.home )
736  QRegExp reCby("^CREATED_BY:\\s+(.+)\\s+\\(\\s*(.+)\\s*\\)\\s*(.*)",
737  Qt::CaseInsensitive);
738  QRegExp reOth("^(DEF_TYPE|DEF_CLASS):.*",
739  Qt::CaseInsensitive);
740  int numOfReadRecords;
741  numOfReadRecords = SgAgvSection::importData(ts, drv);
742  SgIdentities *ids=drv->getInputIdentities();
743 //SgVersion *ver=drv->getInputDriverVersion();
744  SgVersion inptVer;
745 
746  // digest what have get:
747  for (int i=0; i<size(); i++)
748  {
749  const QString& str=at(i)->content();
750 
751  if (reOth.indexIn(str) != -1) // just a stub
752  {
753  }
754  else if (reVer.indexIn(str) != -1)
755  {
756  res = reVer.cap(1);
757  if (inptVer.parseString(res))
758  {
759  t.fromString(SgMJD::F_DDMonYYYY, reVer.cap(2));
760  inptVer.setReleaseEpoch(t);
762  {
765  "::importData(): content style has been set to ACS_NATIVE");
766  };
767  }
768  else // foreign:
769  {
770  inptVer.setSoftwareName(reVer.cap(1));
771  t.fromString(SgMJD::F_YYYYMMDD, reVer.cap(2));
772  inptVer.setReleaseEpoch(t);
773  if (inptVer.getSoftwareName() == "GVH")
775  };
776  }
777  else if (reGen.indexIn(str) != -1)
778  {
779  res = reGen.cap(1);
780  if (inptVer.parseString(res))
781  {
782  t.fromString(SgMJD::F_DDMonYYYY, reGen.cap(2));
783  inptVer.setReleaseEpoch(t);
784  }
785  else // foreign:
786  {
787 //PREA.1 GENERATOR: nuSolve-0.6.4 (Corilaine) released on 20 Sep, 2019
788 //PREA.1 GENERATOR: gvf_transform v 3.0 release of 2019.09.15 AFTER nuSolve-0.6.4
789 //PREA.1 GENERATOR: PIMA v 2.22 2016.02.29
790 //PREA.1 GENERATOR: PIMA v 2.30g 2019.02.24
791 //PREA.1 GENERATOR: mark3_to_gvf Version of 2007.10.15
792  // 1 2 3 4
793  QRegExp reAft("\\s*(\\d+)\\.?(\\d*)(.*)\\s*(\\d{4}\\.\\d{2}\\.\\d{2})\\s*AFTER\\s*nuSolve",
794  Qt::CaseInsensitive);
795  QRegExp reDte("\\s*(.*)\\s*(\\d{4}\\.\\d{2}\\.\\d{2})\\s*",
796  Qt::CaseInsensitive);
797 
798  QRegExp reVr("\\s*(\\d+)\\.?(\\d*)(.*)\\s*",
799  Qt::CaseInsensitive);
800 
801  int n;
802  bool isOk;
803  inptVer.setSoftwareName(res);
804  res = reGen.cap(2);
805 
806  if (reAft.indexIn(res) != -1)
807  {
808  res = "";
809  if (reAft.captureCount() == 4)
810  {
811  t.fromString(SgMJD::F_YYYYMMDD, reAft.cap(4));
812  res = reAft.cap(2);
813  }
814  else if (reAft.captureCount() == 3)
815  t.fromString(SgMJD::F_YYYYMMDD, reAft.cap(3));
816  else if (reAft.captureCount() == 2)
817  t.fromString(SgMJD::F_YYYYMMDD, reAft.cap(2));
818  else
820  "::importData(): do not know what to do with \"" + reAft.cap(0) + "\"");
821 
822  inptVer.setReleaseEpoch(t);
823 
824  n = reAft.cap(1).toInt(&isOk);
825  if (isOk)
826  inptVer.setMajorNumber(n);
827  if (res.size())
828  {
829  n = res.toInt(&isOk);
830  if (isOk)
831  inptVer.setMinorNumber(n);
832  };
833  }
834  else if (reDte.indexIn(res) != -1)
835  {
836  res = reDte.cap(2);
838  inptVer.setReleaseEpoch(t);
839  res = reDte.cap(1);
840  if (reVr.indexIn(res) != -1)
841  {
842  if (reVr.cap(1).size())
843  {
844  n = reVr.cap(1).toInt(&isOk);
845  if (isOk)
846  inptVer.setMajorNumber(n);
847  };
848  if (reVr.cap(2).size())
849  {
850  n = reVr.cap(2).toInt(&isOk);
851  if (isOk)
852  inptVer.setMinorNumber(n);
853  };
854  if (reVr.cap(3).size())
855  inptVer.setCodeName(reVr.cap(3));
856  };
857  };
858 
859  if (inptVer.getSoftwareName() == "gvf_transform")
860  {
863  "::importData(): content style has been set to ACS_GVH_VDB");
864  }
865  else if (inptVer.getSoftwareName() == "mark3_to_gvf")
866  {
869  "::importData(): content style has been set to ACS_GVH_DBH");
870  }
871  else if (inptVer.getSoftwareName() == "PIMA")
872  {
875  "::importData(): content style has been set to ACS_GVH_PIMA");
876  }
877  else
879  "::importData(): cannot determine content style from a string \"" + str + "\"");
880  };
881  }
882  else if (reCat.indexIn(str) != -1)
883  {
884  t.fromString(SgMJD::F_SOLVE_SPLFL, reCat.cap(1));
885  drv->setDateOfCreation(t);
886  res = reCat.cap(2);
887  if (res.size() && res != "UTC") // have to add support for time zones
889  "::importData(): got a non standard time zone: \"" + res + "\", need to fix this");
890  }
891  else if (reCby.indexIn(str) != -1 && ids)
892  {
893  ids->setUserName(reCby.cap(1));
894  if (reCby.cap(2).size())
895  ids->setUserEmailAddress(reCby.cap(2).simplified());
896  res = reCby.cap(3).simplified();
897  if (res.startsWith("of "))
898  res = res.mid(3);
899  if (res.size())
900  ids->setAcAbbrevName(res);
901  }
902  else // something new
903  {
905  "::importData(): got unknown keyword: \"" + str + "\"");
906  };
907  };
908 
909 
910 
911  if (inptVer.getSoftwareName().size())
912  ids->setDriverVersion(inptVer);
913 
914 #ifdef LOCAL_DEBUG
915  std::cout << " SgAgvPreaSection::importData finished"
916  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
917  << "\n";
918 #endif
919 
920  return numOfReadRecords;
921 };
922 /*=====================================================================================================*/
923 
924 
925 
926 
927 //
928 /*=====================================================================================================*/
929 /* */
930 /* SgAgvTextSection implementation */
931 /* */
932 /*=====================================================================================================*/
934 {
935  if (size())
936  for (int i=0; i<size(); i++)
937  delete at(i);
938  clear();
939  headerByIdx_.clear();
940  numByIdx_.clear();
941  maxLenByIdx_.clear();
942 
943  SgMJD t(tZero);
944  int v(-1);
945  int chapterIdx(-1);
946  const SgVlbiBand *pBand=session->primaryBand();
947  if (pBand)
948  {
949  const SgVlbiHistory *history=&pBand->history();
950  if (history)
951  {
952  for (int i=0; i<history->size() - 1 /* we do not need here the last record*/; i++)
953 // for (int i=0; i<history->size(); i++)
954  {
955  const SgVlbiHistoryRecord
956  *hRec=history->at(i);
957  if (t < hRec->getEpoch() || v != hRec->getVersion())
958  {
959  chapterIdx++;
960  t = hRec->getEpoch();
961  v = hRec->getVersion();
962  headerByIdx_[chapterIdx] = "Comments of the Mark-3 DBH database " + session->getName() +
963  " Version " + QString("").setNum(hRec->getVersion()) + " " + t.toString(SgMJD::F_SOLVE_SPLFL);
964  numByIdx_[chapterIdx] = 0;
965  maxLenByIdx_[chapterIdx] = hRec->getText().size();
966  };
967  append(new SgAgvRecord(this, hRec->getText(), chapterIdx));
968  numByIdx_[chapterIdx]++;
969  if (maxLenByIdx_[chapterIdx] < hRec->getText().size())
970  maxLenByIdx_[chapterIdx] = hRec->getText().size();
971  };
972  }
973  };
975  "::fillDataStructures(): collected " + QString("").setNum(size()) + " records");
976 };
977 
978 
979 
980 //
981 int SgAgvTextSection::exportData(QTextStream& ts, SgAgvDriver* /*drv*/)
982 {
984 
985  int numOfWritenRecords=0;
986  int chapterIdx;
987  QString prfx(prefix_ + "." + QString("").setNum(idx_ + 1));
988 
989  ts << prfx << " @section_length: " << headerByIdx_.size() << " chapters\n";
990 
991  chapterIdx = -1;
992  for (int i=0; i<size(); i++)
993  {
994  const SgAgvRecord *rec=at(i);
995  if (chapterIdx < rec->getSubIdx())
996  {
997  chapterIdx++;
998  ts << prfx << " @@chapter: " << chapterIdx + 1
999  << " " << numByIdx_.value(chapterIdx)
1000  << " records, max_len: " << maxLenByIdx_.value(chapterIdx)
1001  << " charaters " << headerByIdx_.value(chapterIdx)
1002  << "\n";
1003  numOfWritenRecords++;
1004  }
1005  numOfWritenRecords += at(i)->exportData(ts, prfx);
1006  };
1007 
1008 #ifdef LOCAL_DEBUG
1009  std::cout << "SgAgvTextSection::exportData: done"
1010  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1011  << "\n";
1012 #endif
1013 
1014  return numOfWritenRecords + 1;
1015 };
1016 
1017 
1018 
1019 //
1020 int SgAgvTextSection::importData(QTextStream& ts, SgAgvDriver* /*drv*/)
1021 {
1023 
1024  int numOfReadRecords, numChapter2read, numRecord2read, idx;
1025  QRegExp re(prefix_ + "\\.(\\d+)\\s+(.*)", Qt::CaseInsensitive);
1026  QString str("");
1027  bool isOk;
1028 
1029  history_.clear();
1030  numOfReadRecords = 0;
1031  str = ts.readLine();
1032  if (parseSectionLengthString(str, numChapter2read))
1033  {
1034  numOfReadRecords = 1;
1035  for (int i=0; i<numChapter2read; i++)
1036  {
1037  str = ts.readLine();
1038  numOfReadRecords++;
1039  if (parseChapterInitString(str, numRecord2read))
1040  {
1041  for (int j=0; j<numRecord2read; j++)
1042  {
1043  str = ts.readLine();
1044  if (re.indexIn(str) != -1)
1045  {
1046  idx = re.cap(1).toInt(&isOk);
1047  if (isOk)
1048  {
1049  if (idx != idx_ + 1)
1051  "::importData(): the current index, " + QString("").setNum(idx_ + 1) +
1052  ", does not match the index from input, " + QString("").setNum(idx));
1053  append(new SgAgvRecord(this, re.cap(2)));
1054  history_.append(new SgVlbiHistoryRecord(histEpoch_, histVer_, re.cap(2)));
1055  };
1056  }
1057  else
1059  "::importData(): cannot parse a string \"" + str + "\" as a record of " + prefix_ +
1060  " section");
1061  };
1062  numOfReadRecords += numRecord2read;
1063  }
1064  else
1066  "::importData(): parsing chapter string has failed: \"" + str + "\"");
1067  };
1069  "::importData(): read " + QString("").setNum(numOfReadRecords) + " records of the section " +
1070  prefix_);
1071  }
1072  else
1073  {
1075  "::importData(): error reading the section_length string: \"" + str + "\"");
1076  };
1077 
1078 #ifdef LOCAL_DEBUG
1079  std::cout << " SgAgvTextSection::importData finished"
1080  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1081  << "\n";
1082 #endif
1083 
1084  return numOfReadRecords;
1085 };
1086 
1087 
1088 
1089 //
1090 bool SgAgvTextSection::parseChapterInitString(const QString& str, int& num2read)
1091 {
1092  bool isOk;
1093  //TEXT.1 @@chapter: 1 225 records, max_len: 72 charaters Comments of the Mark-3 DBH database $18JAN02XA Version 1 2018.01.17-22:40:17.
1094  //TEXT.1 @@chapter: 1 191 records, max_len: 72 charaters Comments of the Mark-3 DBH database 18JUN29XU Version 1 2018.06.30-01:32:39
1095  QRegExp re(prefix_ + "\\.(\\d+)\\s+@*@chapter:\\s+(\\d+)\\s+(\\d+)\\s+records,\\s+.*",
1096  Qt::CaseInsensitive);
1097  QRegExp reVer(".*\\s+Version\\s+(\\d+)\\s+(\\d{4}\\.\\d{2}\\.\\d{2}-\\d{2}:\\d{2}:\\d{2}).*",
1098  Qt::CaseInsensitive);
1099 
1100  num2read = 0;
1101  isOk = false;
1102  if (re.indexIn(str) != -1)
1103  {
1104  int idx, chapterIdx;
1105  idx = re.cap(1).toInt(&isOk);
1106  if (isOk)
1107  {
1108  chapterIdx = re.cap(2).toInt(&isOk);
1109  if (isOk)
1110  {
1111  num2read = re.cap(3).toInt(&isOk);
1112  if (isOk)
1113  {
1115  "::parseChapterInitString(): parsing the chapter string is ok: idx=" +
1116  QString("").setNum(idx) + ", chapterIdx=" + QString("").setNum(chapterIdx) +
1117  ", num2read=" + QString("").setNum(num2read));
1118  if (reVer.indexIn(str) != -1)
1119  {
1121  histVer_ = reVer.cap(1).toInt(&isOk);
1122  }
1123  else
1125  "::parseChapterInitString(): cannot figure out version and epoch from the string \"" +
1126  str + "\"");
1127 
1128  };
1129  };
1130  };
1131  }
1132  else
1133  {
1134  isOk = false;
1136  "::parseChapterInitString(): cannot parse the chapter string \"" + str + "\"");
1137  };
1138  return isOk;
1139 };
1140 
1141 /*=====================================================================================================*/
1142 
1143 
1144 
1145 
1146 //
1147 /*=====================================================================================================*/
1148 /* */
1149 /* SgAgvTocsSection implementation */
1150 /* */
1151 /*=====================================================================================================*/
1153 {
1155  if (size())
1156  for (int i=0; i<size(); i++)
1157  delete at(i);
1158  clear();
1159 
1160  // first, process the mandatory entries:
1161  for (QMap<QString, SgAgvDatumDescriptor*>::iterator it=drv->mandatoryDatumByKey().begin();
1162  it!=drv->mandatoryDatumByKey().end(); ++it)
1163  {
1164  dd = it.value();
1165  if (dd->getHasData())
1166  append(datumDescriptor2agvRecord(dd));
1167  };
1168  // then, everything else:
1169  for (QMap<QString, SgAgvDatumDescriptor*>::iterator it=drv->datumByKey().begin();
1170  it!=drv->datumByKey().end(); ++it)
1171  {
1172  dd = it.value();
1173  if (dd->getHasData())
1174  append(datumDescriptor2agvRecord(dd));
1175  };
1176 
1178  "::fillDataStructures(): collected " + QString("").setNum(size()) + " records");
1179 };
1180 
1181 
1182 
1183 //
1185 {
1186  const char* scope2char[] = {"NON", "SES", "SCA", "STA", "BAS"};
1187  const char* dtype2char[] = {"NO", "C1", "I2", "I4", "I8", "R4", "R8"};
1188  return new SgAgvRecord(this,
1189  QString("").sprintf("%-8s %3s %2s %3d %3d ",
1190  qPrintable(dd->getLCode()),
1191  scope2char[dd->getDataScope()],
1192  dtype2char[dd->getDataType()],
1193  dd->d1(),
1194  dd->d2())
1195  + dd->getDescription());
1196 };
1197 
1198 
1199 
1200 //
1202 {
1203  //POLARZ1 BAS C1 32 1 Space separated polarization per sta/chan in band 1
1204  QRegExp re("(\\S+)\\s+([A-Z]{3})\\s+([CIR][1248])\\s+(\\d+)\\s+(\\d+)\\s+(.*)",
1205  Qt::CaseInsensitive);
1206  bool isOk;
1207  QString lCode(""), descr(""), str("");
1208  AgvDataScope dScope;
1209  AgvDataType dType;
1210  int d1, d2;
1212 
1213  dd = NULL;
1214  if (re.indexIn(rec->content()) != -1)
1215  {
1216  lCode = re.cap(1).leftJustified(8, ' ');
1217  descr = re.cap(6).simplified();
1218  //
1219  str = re.cap(2);
1220  if (str == "SES")
1221  dScope = ADS_SESSION;
1222  else if (str == "SCA")
1223  dScope = ADS_SCAN;
1224  else if (str == "STA")
1225  dScope = ADS_STATION;
1226  else if (str == "BAS")
1227  dScope = ADS_BASELINE;
1228  else
1229  dScope = ADS_NONE;
1230  //
1231  str = re.cap(3);
1232  if (str == "C1")
1233  dType = ADT_CHAR;
1234  else if (str == "I2")
1235  dType = ADT_I2;
1236  else if (str == "I4")
1237  dType = ADT_I4;
1238  else if (str == "I8")
1239  dType = ADT_I8;
1240  else if (str == "R4")
1241  dType = ADT_R4;
1242  else if (str == "R8")
1243  dType = ADT_R8;
1244  else
1245  dType = ADT_NONE;
1246  //
1247  d1 = re.cap(4).toInt(&isOk);
1248  if (!isOk)
1249  d1 = -1;
1250  d2 = re.cap(5).toInt(&isOk);
1251  if (!isOk)
1252  d2 = -1;
1253  //
1254  if (dScope!=ADS_NONE && dType!=ADT_NONE && d1!=-1 && d2!=-1)
1255  dd = new SgAgvDatumDescriptor(lCode, descr, dScope, dType, d1, d2, ACS_ANY);
1256  else
1258  "::agvRecord2datumDescriptor(): cannot create datumDescriptor from for a TOC record \"" +
1259  rec->content() + "\"");
1260  }
1261  else
1263  "::agvRecord2datumDescriptor(): cannot parse a TOC record \"" + rec->content() + "\"");
1264 
1265  return dd;
1266 };
1267 
1268 
1269 
1270 //
1271 int SgAgvTocsSection::exportData(QTextStream& ts, SgAgvDriver* /*drv*/)
1272 {
1274  int numOfWritenRecords=0;
1275  QString prfx(prefix_ + "." + QString("").setNum(idx_ + 1));
1276 
1277  ts << prfx << " @section_length: " << size() << " lcodes\n";
1278 
1279  for (int i=0; i<size(); i++)
1280  numOfWritenRecords += at(i)->exportData(ts, prfx);
1281 
1282 #ifdef LOCAL_DEBUG
1283  std::cout << "SgAgvTocsSection::exportData: done"
1284  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1285  << "\n";
1286 #endif
1287 
1288  return numOfWritenRecords + 1;
1289 };
1290 
1291 
1292 
1293 //
1294 int SgAgvTocsSection::importData(QTextStream& ts, SgAgvDriver* drv)
1295 {
1296  int numOfReadRecords;
1298  numOfReadRecords = SgAgvSection::importData(ts, drv);
1299 
1300 #ifdef LOCAL_DEBUG
1301  std::cout << " SgAgvTocsSection::importData: (" << idx_ << ") begin\n";
1302 #endif
1303 
1304  for (int i=0; i<size(); i++)
1305  {
1306  dd = agvRecord2datumDescriptor(at(i));
1307  if (dd)
1308  drv->addDatumDescriptor(dd);
1309  };
1310 #ifdef LOCAL_DEBUG
1311  std::cout << " SgAgvTocsSection::importData: (" << idx_ << ") end"
1312  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1313  << "\n";
1314 #endif
1315 
1316  return numOfReadRecords;
1317 };
1318 /*=====================================================================================================*/
1319 
1320 
1321 
1322 
1323 
1324 //
1325 /*=====================================================================================================*/
1326 /* */
1327 /* SgAgvTocsSection implementation */
1328 /* */
1329 /*=====================================================================================================*/
1331 {
1332  if (size())
1333  for (int i=0; i<size(); i++)
1334  delete at(i);
1335  clear();
1336 
1338  "::fillDataStructures(): there are " +
1339  QString("").setNum(drv->mandatoryDatumByKey().size() + drv->datumByKey().size()) +
1340  " registered entries for output");
1341 };
1342 
1343 
1344 
1345 //
1346 int SgAgvDataSection::exportData(QTextStream& ts, SgAgvDriver* drv)
1347 {
1349 
1350  int numOfWritenRecords=0, num2write=0;
1351 
1352  // evaluate number of records to write:
1353  for (QMap<QString, SgAgvDatumDescriptor*>::iterator it=drv->mandatoryDatumByKey().begin();
1354  it!=drv->mandatoryDatumByKey().end(); ++it)
1355  if (it.value()->getHasData())
1356  num2write += it.value()->totalSize();
1357 
1358 #ifdef LOCAL_DEBUG
1359  std::cout << "SgAgvDataSection::exportData: calced num of mandatory records"
1360  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1361  << "\n";
1362 #endif
1363 
1364  for (QMap<QString, SgAgvDatumDescriptor*>::iterator it=drv->datumByKey().begin();
1365  it!=drv->datumByKey().end(); ++it)
1366  if (it.value()->getHasData())
1367  num2write += it.value()->totalSize();
1368 
1369 #ifdef LOCAL_DEBUG
1370  std::cout << "SgAgvDataSection::exportData: calced num of other records"
1371  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1372  << "\n";
1373 #endif
1374 
1375 
1376  QString prfx(prefix_ + "." + QString("").setNum(idx_ + 1));
1377  ts << prfx << " @section_length: " << num2write << " records\n";
1378 
1379  // make output:
1380  for (QMap<QString, SgAgvDatumDescriptor*>::iterator it=drv->mandatoryDatumByKey().begin();
1381  it!=drv->mandatoryDatumByKey().end(); ++it)
1382  numOfWritenRecords += writeDatumOpt(ts, it.value(), prfx, drv);
1383 // numOfWritenRecords += writeDatum(ts, it.value(), prfx, drv);
1384 
1385 #ifdef LOCAL_DEBUG
1386  std::cout << "SgAgvDataSection::exportData: wrote mandatory records"
1387  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1388  << "\n";
1389 #endif
1390 
1391  for (QMap<QString, SgAgvDatumDescriptor*>::iterator it=drv->datumByKey().begin();
1392  it!=drv->datumByKey().end(); ++it)
1393  numOfWritenRecords += writeDatumOpt(ts, it.value(), prfx, drv);
1394 // numOfWritenRecords += writeDatum(ts, it.value(), prfx, drv);
1395 
1396 #ifdef LOCAL_DEBUG
1397  std::cout << "SgAgvDataSection::exportData: wrote other records"
1398  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1399  << "\n";
1400  std::cout << "SgAgvDataSection::exportData: done"
1401  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1402  << "\n";
1403 #endif
1404 
1405  return numOfWritenRecords + 1;
1406 };
1407 
1408 
1409 
1410 //
1411 int SgAgvDataSection::writeDatum(QTextStream& ts, SgAgvDatumDescriptor* dd, const QString& prfx,
1412  SgAgvDriver* drv)
1413 {
1414  int numOfWritenRecords=0;
1415  int d1, d2, d3, d4;
1416  if (!dd->getHasData())
1417  return numOfWritenRecords;
1418  //
1419  QString content("");
1420  d1 = dd->d1();
1421  d2 = dd->d2();
1422  d3 = dd->d3();
1423  d4 = dd->d4();
1424  if (dd->getDataType() == ADT_CHAR)
1425  {
1426  for (int l=0; l<d4; l++)
1427  {
1428  if (dd->getDataScope()==ADS_STATION)
1429  d3 = drv->getNumOfStnPts(l);
1430  for (int k=0; k<d3; k++)
1431  for (int j=0; j<d2; j++)
1432  {
1433 /*
1434  content.sprintf(" %-8s %d %d %2d %2d ", qPrintable(dd->getLCode()), k + 1, l + 1, 1, j + 1);
1435  ts << prfx << content << drv->data2str(dd, 0, j, k, l) << "\n";
1436  ts << prfx << " " << "\n";
1437 */
1438  ts
1439  << prfx
1440  << " "
1441  << dd->getLCode().leftJustified(8, ' ') << " "
1442  << QString("").setNum(k + 1) << " "
1443  << QString("").setNum(l + 1) << " 1 "
1444  << QString("").setNum(j + 1) << " "
1445  << drv->data2str(dd, 0, j, k, l)
1446  << "\n";
1447 
1448  numOfWritenRecords++;
1449  };
1450  };
1451  }
1452  else
1453  {
1454  for (int l=0; l<d4; l++)
1455  {
1456  if (dd->getDataScope()==ADS_STATION)
1457  d3 = drv->getNumOfStnPts(l);
1458  for (int k=0; k<d3; k++)
1459  for (int j=0; j<d2; j++)
1460  for (int i=0; i<d1; i++)
1461  {
1462  /*
1463  content.sprintf("%-8s %d %d %2d %2d ",
1464  qPrintable(dd->getLCode()), k + 1, l + 1, i + 1, j + 1);
1465  ts << prfx << " " << content << drv->data2str(dd, i, j, k, l) << "\n";
1466  */
1467  ts
1468  << prfx
1469  << " "
1470  << dd->getLCode().leftJustified(8, ' ') << " "
1471  << content
1472  << QString("").setNum(k + 1) << " "
1473  << QString("").setNum(l + 1) << " "
1474  << QString("").setNum(i + 1) << " "
1475  << QString("").setNum(j + 1) << " "
1476  << drv->data2str(dd, i, j, k, l)
1477  << "\n";
1478 
1479  numOfWritenRecords++;
1480  };
1481  };
1482  };
1483  return numOfWritenRecords;
1484 };
1485 
1486 
1487 
1488 //
1489 int SgAgvDataSection::writeDatumOpt(QTextStream& ts, SgAgvDatumDescriptor* dd, const QString& prfx,
1490  SgAgvDriver* drv)
1491 {
1492  int numOfWritenRecords=0;
1493  int d1, d2, d3, d4;
1494  if (!dd->getHasData())
1495  return numOfWritenRecords;
1496  //
1497  QString content("N/A");
1498  SgAgvDatumString *dstr=NULL;
1499  SgAgvDatum<short int> *dsin=NULL;
1500  SgAgvDatum<int> *dint=NULL;
1501  SgAgvDatum<long int> *dlin=NULL;
1502  SgAgvDatum<float> *dflt=NULL;
1503  SgAgvDatum<double> *ddbl=NULL;
1504 
1505  d1 = dd->d1();
1506  d2 = dd->d2();
1507  d3 = dd->d3();
1508  d4 = dd->d4();
1509 
1510  switch (dd->getDataType())
1511  {
1512  case ADT_CHAR:
1513  dstr = drv->c1Data().value(dd->getLCode());
1514  for (int l=0; l<d4; l++)
1515  {
1516  if (dd->getDataScope()==ADS_STATION)
1517  d3 = drv->getNumOfStnPts(l);
1518  for (int k=0; k<d3; k++)
1519  for (int j=0; j<d2; j++)
1520  {
1521  content = dstr->getValue(j, k, l).trimmed();
1522  content.replace(' ', '_');
1523  ts << prfx << " " << dd->getLCode().leftJustified(8, ' ') << " "
1524  << QString("").setNum(k + 1) << " " << QString("").setNum(l + 1) << " 1 "
1525  << QString("").setNum(j + 1) << " " << content << "\n";
1526  numOfWritenRecords++;
1527  };
1528  };
1529  break;
1530  case ADT_I2:
1531  dsin = drv->i2Data().value(dd->getLCode());
1532  for (int l=0; l<d4; l++)
1533  {
1534  if (dd->getDataScope()==ADS_STATION)
1535  d3 = drv->getNumOfStnPts(l);
1536  for (int k=0; k<d3; k++)
1537  for (int j=0; j<d2; j++)
1538  for (int i=0; i<d1; i++)
1539  {
1540  content.setNum(dsin->getValue(i, j, k, l));
1541  ts << prfx << " " << dd->getLCode().leftJustified(8, ' ') << " "
1542  << QString("").setNum(k + 1) << " " << QString("").setNum(l + 1) << " "
1543  << QString("").setNum(i + 1) << " " << QString("").setNum(j + 1) << " "
1544  << content << "\n";
1545  };
1546  numOfWritenRecords++;
1547 
1548  };
1549  break;
1550  case ADT_I4:
1551  dint = drv->i4Data().value(dd->getLCode());
1552  for (int l=0; l<d4; l++)
1553  {
1554  if (dd->getDataScope()==ADS_STATION)
1555  d3 = drv->getNumOfStnPts(l);
1556  for (int k=0; k<d3; k++)
1557  for (int j=0; j<d2; j++)
1558  for (int i=0; i<d1; i++)
1559  {
1560  content.setNum(dint->getValue(i, j, k, l));
1561  ts << prfx << " " << dd->getLCode().leftJustified(8, ' ') << " "
1562  << QString("").setNum(k + 1) << " " << QString("").setNum(l + 1) << " "
1563  << QString("").setNum(i + 1) << " " << QString("").setNum(j + 1) << " "
1564  << content << "\n";
1565  numOfWritenRecords++;
1566  };
1567  };
1568  break;
1569  case ADT_I8:
1570  dlin = drv->i8Data().value(dd->getLCode());
1571  for (int l=0; l<d4; l++)
1572  {
1573  if (dd->getDataScope()==ADS_STATION)
1574  d3 = drv->getNumOfStnPts(l);
1575  for (int k=0; k<d3; k++)
1576  for (int j=0; j<d2; j++)
1577  for (int i=0; i<d1; i++)
1578  {
1579  content.setNum(dlin->getValue(i, j, k, l));
1580  ts << prfx << " " << dd->getLCode().leftJustified(8, ' ') << " "
1581  << QString("").setNum(k + 1) << " " << QString("").setNum(l + 1) << " "
1582  << QString("").setNum(i + 1) << " " << QString("").setNum(j + 1) << " "
1583  << content << "\n";
1584  numOfWritenRecords++;
1585  };
1586  };
1587  break;
1588  case ADT_R4:
1589  dflt = drv->r4Data().value(dd->getLCode());
1590  for (int l=0; l<d4; l++)
1591  {
1592  if (dd->getDataScope()==ADS_STATION)
1593  d3 = drv->getNumOfStnPts(l);
1594  for (int k=0; k<d3; k++)
1595  for (int j=0; j<d2; j++)
1596  for (int i=0; i<d1; i++)
1597  {
1598  content.setNum(dflt->getValue(i, j, k, l), 'E', 7);
1599  ts << prfx << " " << dd->getLCode().leftJustified(8, ' ') << " "
1600  << QString("").setNum(k + 1) << " " << QString("").setNum(l + 1) << " "
1601  << QString("").setNum(i + 1) << " " << QString("").setNum(j + 1) << " "
1602  << content << "\n";
1603  numOfWritenRecords++;
1604  };
1605  };
1606  break;
1607  case ADT_R8:
1608  ddbl = drv->r8Data().value(dd->getLCode());
1609  for (int l=0; l<d4; l++)
1610  {
1611  if (dd->getDataScope()==ADS_STATION)
1612  d3 = drv->getNumOfStnPts(l);
1613  for (int k=0; k<d3; k++)
1614  for (int j=0; j<d2; j++)
1615  for (int i=0; i<d1; i++)
1616  {
1617  content.setNum(ddbl->getValue(i, j, k, l), 'E', 15);
1618  ts << prfx << " " << dd->getLCode().leftJustified(8, ' ') << " "
1619  << QString("").setNum(k + 1) << " " << QString("").setNum(l + 1) << " "
1620  << QString("").setNum(i + 1) << " " << QString("").setNum(j + 1) << " "
1621  << content << "\n";
1622  numOfWritenRecords++;
1623  };
1624  };
1625  break;
1626  case ADT_NONE:
1627  default:
1628  break;
1629  };
1630 
1631  return numOfWritenRecords;
1632 };
1633 
1634 
1635 
1636 //
1637 int SgAgvDataSection::importData(QTextStream& ts, SgAgvDriver* drv)
1638 {
1639  int numOfReadRecords;
1640 #ifdef LOCAL_DEBUG
1641  std::cout << " SgAgvDataSection::importData: (" << idx_ << ") start\n";
1642 #endif
1643  numOfReadRecords = SgAgvSection::importData(ts, drv);
1644 
1645  // it is a first chunk and the special dimensions are not known yet:
1646  if (drv->getNumOfObs()==0 || drv->getNumOfStn()==0 || drv->getNumOfScans()==0)
1647  drv->figureOutImplicitDimensions(this); // grrr..
1648 
1649  if (drv->getNumOfObs()==0 || drv->getNumOfStn()==0 || drv->getNumOfScans()==0) // failed
1650  {
1652  "::importData(): parsing the mandatory records have failed");
1653  return numOfReadRecords;
1654  };
1655 
1656  drv->allocateData();
1657 #ifdef LOCAL_DEBUG
1658  std::cout << " SgAgvDataSection::importData: allocating data: (" << idx_ << ") done"
1659  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1660  << "\n";
1661 #endif
1662 
1663 // drv->digestData(this);
1664  drv->digestDataNoRegEx(this);
1665 #ifdef LOCAL_DEBUG
1666  std::cout << " SgAgvDataSection::importData: digesting data: (" << idx_ << ") done"
1667  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1668  << "\n";
1669  std::cout << " SgAgvDataSection::importData finished"
1670  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1671  << "\n";
1672 #endif
1673 
1674  return numOfReadRecords;
1675 };
1676 /*=====================================================================================================*/
1677 
1678 
1679 
1680 
1681 
1682 /*=====================================================================================================*/
1683 /* */
1684 /* SgAgvChunk implementation */
1685 /* */
1686 /*=====================================================================================================*/
1688 {
1689  sFile_.fillDataStructures(session, drv);
1690  sPrea_.fillDataStructures(session, drv);
1691  sText_.fillDataStructures(session, drv);
1692  sTocs_.fillDataStructures(session, drv);
1693  sData_.fillDataStructures(session, drv);
1694  sHeap_.fillDataStructures(session, drv);
1695 };
1696 
1697 
1698 
1699 //
1700 void SgAgvChunk::exportData(QTextStream& ts, SgAgvDriver* drv)
1701 {
1702 SgMJD startEpoch_ = SgMJD::currentMJD();
1703 
1704  int numOfWritenRecords;
1705  ts << sMagicString_ << "\n";
1706 
1707  numOfWritenRecords = 0;
1708 
1709  numOfWritenRecords += sFile_.exportData(ts, drv);
1710  numOfWritenRecords += sPrea_.exportData(ts, drv);
1711  numOfWritenRecords += sText_.exportData(ts, drv);
1712  numOfWritenRecords += sTocs_.exportData(ts, drv);
1713  numOfWritenRecords += sData_.exportData(ts, drv);
1714  numOfWritenRecords += sHeap_.exportData(ts, drv);
1715 
1716  ts << "CHUN." << idx_ + 1 << " @chunk_size: " << numOfWritenRecords << " records\n";
1717 
1718 #ifdef LOCAL_DEBUG
1719  std::cout << "SgAgvChunk::exportData: done"
1720  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch_)*86400000.0))
1721  << "\n";
1722 #endif
1723 };
1724 
1725 
1726 
1727 //
1728 void SgAgvChunk::importData(QTextStream& ts, SgAgvDriver* drv)
1729 {
1730  int numOfReadRecords;
1731  QString str("");
1732 
1733  SgMJD startEpoch(SgMJD::currentMJD());
1734 
1735  str = ts.readLine();
1736  if (parseMagicString(str))
1737  {
1738 #ifdef LOCAL_DEBUG
1739  std::cout << " SgAgvChunk::importData: (" << idx_ << ") start\n";
1740 #endif
1741  numOfReadRecords = 1;
1742 
1743  numOfReadRecords += sFile_.importData(ts, drv);
1744  numOfReadRecords += sPrea_.importData(ts, drv);
1745  numOfReadRecords += sText_.importData(ts, drv);
1746  numOfReadRecords += sTocs_.importData(ts, drv);
1747  numOfReadRecords += sData_.importData(ts, drv);
1748  numOfReadRecords += sHeap_.importData(ts, drv);
1749 
1750  str = ts.readLine();
1751  numOfReadRecords++;
1752 
1753  if (parseEndString(str))
1754  {
1755  numOfReadRecords++;
1757  "::importData(): read " + QString("").setNum(numOfReadRecords) + " records of the chunk #" +
1758  QString("").setNum(idx_));
1759  //
1760 #ifdef LOCAL_DEBUG
1761  std::cout << " SgAgvChunk::importData: (" << idx_ << ") done"
1762  << qPrintable(QString("").sprintf(", dt= %.2f ms", (SgMJD::currentMJD() - startEpoch)*86400000.0))
1763  << "\n";
1764 #endif
1765  }
1766  else
1768  "::importData(): error parsing the ending string: \"" + str + "\"");
1769  }
1770  else
1771  {
1773  "::importData(): error parsing the magic string: \"" + str + "\"");
1774  return;
1775  };
1776 };
1777 
1778 
1779 
1780 //
1781 bool SgAgvChunk::parseMagicString(const QString& str)
1782 {
1783  bool isOk;
1784  // "AGV format of 2005.01.14"
1785  QRegExp reMagicDate(magicPrefix_ + "\\s*(\\d+)\\.(\\d+)\\.(\\d+).*",
1786  Qt::CaseInsensitive);
1787  QRegExp reMagicStr(magicPrefix_ + "\\s*(.+)", Qt::CaseInsensitive);
1788  if (reMagicDate.indexIn(str) != -1)
1789  {
1790  int vYr, vMn, vDy;
1791  vYr = reMagicDate.cap(1).toInt(&isOk);
1792  if (isOk)
1793  {
1794  vMn = reMagicDate.cap(2).toInt(&isOk);
1795  if (isOk)
1796  {
1797  vDy = reMagicDate.cap(3).toInt(&isOk);
1798  if (isOk)
1799  {
1800  inputFmtDate_ = SgMJD(vYr, vMn, vDy);
1802  "::parseMagicString(): found format version of " + inputFmtDate_.toString(SgMJD::F_Date));
1803  }
1804  };
1805  };
1806  }
1807  else
1808  {
1809  isOk = false;
1811  "::parseMagicString(): cannot extract a date from format string \"" + str + "\"");
1812  };
1813  //
1814  if (reMagicStr.indexIn(str) != -1)
1815  {
1816  inputFmtVersion_ = reMagicStr.cap(1);
1817  }
1818  else
1819  {
1820  isOk = false;
1822  "::parseMagicString(): cannot extract a version from format string \"" + str + "\"");
1823  };
1824  return isOk;
1825 };
1826 
1827 
1828 
1829 //
1830 bool SgAgvChunk::parseEndString(const QString& str)
1831 {
1832  bool isOk;
1833 //CHUN.5 @chunk_size: 484843 records
1834 //CHUN.1 @chunk_size: 11699 records
1835  QRegExp reClosingStr("CHUN\\.(\\d+)\\s+@chunk_size:\\s+(\\d+)\\s+records.*",
1836  Qt::CaseInsensitive);
1837  //
1838  if (reClosingStr.indexIn(str) != -1)
1839  {
1840  isOk = true;
1841  }
1842  else
1843  {
1844  isOk = false;
1846  "::parseEndString(): cannot recognize the ending string \"" + str + "\"");
1847  };
1848  return isOk;
1849 };
1850 /*=====================================================================================================*/
1851 
1852 
1853 QString strNa("N/A");
1854 
1855 template class SgAgvDatum<float>;
1856 template class SgAgvDatum<double>;
1857 template class SgAgvDatum<int>;
1858 template class SgAgvDatum<short int>;
1859 template class SgAgvDatum<long int>;
1860 
1861 /*=====================================================================================================*/
1862 
1863 /*=====================================================================================================*/
QString strNa
AgvDataScope
Definition: SgIoAgv.h:57
@ ADS_SESSION
session scope
Definition: SgIoAgv.h:59
@ ADS_NONE
undefinite
Definition: SgIoAgv.h:58
@ ADS_BASELINE
baseline scope
Definition: SgIoAgv.h:62
@ ADS_SCAN
scan scope
Definition: SgIoAgv.h:60
@ ADS_STATION
station scope
Definition: SgIoAgv.h:61
AgvDataType
Definition: SgIoAgv.h:67
@ ADT_I8
baseline scope
Definition: SgIoAgv.h:72
@ ADT_CHAR
session scope
Definition: SgIoAgv.h:69
@ ADT_R4
baseline scope
Definition: SgIoAgv.h:73
@ ADT_R8
baseline scope
Definition: SgIoAgv.h:74
@ ADT_NONE
undefinite
Definition: SgIoAgv.h:68
@ ADT_I2
scan scope
Definition: SgIoAgv.h:70
@ ADT_I4
station scope
Definition: SgIoAgv.h:71
@ ACS_ANY
Definition: SgIoAgv.h:86
@ ACS_NATIVE
Definition: SgIoAgv.h:81
@ ACS_GVH_VDB
Definition: SgIoAgv.h:83
@ ACS_GVH_PIMA
Definition: SgIoAgv.h:84
@ ACS_GVH
Definition: SgIoAgv.h:85
@ ACS_GVH_DBH
Definition: SgIoAgv.h:82
@ SD_NumBln
Definition: SgIoDriver.h:61
@ SD_NumChans
Definition: SgIoDriver.h:55
@ SD_NumStn
Definition: SgIoDriver.h:58
@ SD_2NumChans
Definition: SgIoDriver.h:59
@ SD_NumObs
Definition: SgIoDriver.h:53
@ SD_NumScans
Definition: SgIoDriver.h:54
@ SD_NumStnPts
Definition: SgIoDriver.h:56
@ SD_NumSrc
Definition: SgIoDriver.h:57
@ SD_NumBands
Definition: SgIoDriver.h:60
SgLogger * logger
Definition: SgLogger.cpp:231
const SgMJD tZero(1957, 10, 4)
SgVersion libraryVersion("SgLib", 0, 7, 5, "Tuscarora (rc1)", SgMJD(2022, 2, 18, 17, 34))
int idx_
Definition: SgIoAgv.h:505
static const QString magicPrefix_
Definition: SgIoAgv.h:517
QString sMagicString_
Definition: SgIoAgv.h:516
QString inputFmtVersion_
Definition: SgIoAgv.h:520
SgAgvSection sHeap_
Definition: SgIoAgv.h:515
void exportData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1700
QString className() const
Definition: SgIoAgv.h:496
SgAgvFileSection sFile_
Definition: SgIoAgv.h:510
SgAgvPreaSection sPrea_
Definition: SgIoAgv.h:511
SgAgvTextSection sText_
Definition: SgIoAgv.h:512
bool parseEndString(const QString &str)
Definition: SgIoAgv.cpp:1830
void fillDataStructures(const SgVlbiSession *session, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1687
bool parseMagicString(const QString &str)
Definition: SgIoAgv.cpp:1781
void importData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1728
SgMJD inputFmtDate_
Definition: SgIoAgv.h:521
SgAgvDataSection sData_
Definition: SgIoAgv.h:514
SgAgvTocsSection sTocs_
Definition: SgIoAgv.h:513
int importData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1637
int writeDatumOpt(QTextStream &ts, SgAgvDatumDescriptor *dd, const QString &prfx, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1489
int writeDatum(QTextStream &ts, SgAgvDatumDescriptor *dd, const QString &prfx, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1411
void fillDataStructures(const SgVlbiSession *session, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1330
QString className() const
Definition: SgIoAgv.h:463
int exportData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1346
AgvDataType getDataType() const
Definition: SgIoAgv.h:120
static QString dataType2str(AgvDataType)
Definition: SgIoAgv.cpp:201
int d3() const
Definition: SgIoAgv.h:152
int getDim1() const
Definition: SgIoAgv.h:122
QString className() const
Definition: SgIoAgv.h:110
int totalSize() const
Definition: SgIoAgv.cpp:182
int d1() const
Definition: SgIoAgv.h:150
unsigned int getExpectance() const
Definition: SgIoAgv.h:128
const QString & getLCode() const
Definition: SgIoAgv.h:116
AgvDataScope dataScope_
Definition: SgIoAgv.h:165
unsigned int expectance_
Definition: SgIoAgv.h:175
int getDim3() const
Definition: SgIoAgv.h:124
int totalMaxSize() const
Definition: SgIoAgv.h:154
AgvDataType dataType_
Definition: SgIoAgv.h:166
SgAgvDriver * driver_
Definition: SgIoAgv.h:172
int d2() const
Definition: SgIoAgv.h:151
int d4() const
Definition: SgIoAgv.h:153
bool getHasData() const
Definition: SgIoAgv.h:112
const QString & getDescription() const
Definition: SgIoAgv.h:117
int effectiveSize(int d) const
Definition: SgIoAgv.cpp:126
int getDim2() const
Definition: SgIoAgv.h:123
AgvDataScope getDataScope() const
Definition: SgIoAgv.h:119
static QString dataScope2str(AgvDataScope)
Definition: SgIoAgv.cpp:210
int getDim4() const
Definition: SgIoAgv.h:125
QString description_
Definition: SgIoAgv.h:164
const QString & getValue(int idx2, int idx3, int idx4) const
Definition: SgIoAgv.cpp:406
QString className() const
Definition: SgIoAgv.h:237
QString & value(int idx2, int idx3, int idx4)
Definition: SgIoAgv.cpp:426
void allocateSpace()
Definition: SgIoAgv.cpp:345
void freeSpace()
Definition: SgIoAgv.cpp:374
QString * data_
Definition: SgIoAgv.h:254
SgAgvDatumDescriptor * descriptor_
Definition: SgIoAgv.h:253
void allocateSpace()
Definition: SgIoAgv.cpp:226
bool isEmpty()
Definition: SgIoAgv.cpp:265
C getValue(int idx1, int idx2, int idx3, int idx4) const
Definition: SgIoAgv.cpp:283
C & value(int idx1, int idx2, int idx3, int idx4)
Definition: SgIoAgv.cpp:305
void freeSpace()
Definition: SgIoAgv.cpp:255
QMap< QString, SgAgvDatumDescriptor * > & datumByKey()
int getNumOfObs() const
Definition: SgIoAgvDriver.h:72
int getNumOfStnPts(int idx) const
Definition: SgIoAgvDriver.h:79
void allocateData()
QString data2str(SgAgvDatumDescriptor *dd, int idx1, int idx2, int idx3, int idx4)
bool addDatumDescriptor(SgAgvDatumDescriptor *dd)
QMap< QString, SgAgvDatum< float > * > & r4Data()
int getNumOfStn() const
Definition: SgIoAgvDriver.h:77
void setExpectedStyle(AgvContentStyle stl)
Definition: SgIoAgvDriver.h:89
QMap< QString, SgAgvDatumString * > & c1Data()
QMap< QString, SgAgvDatum< int > * > & i4Data()
int getNumOfBln() const
Definition: SgIoAgvDriver.h:78
const QMap< QString, int > & getNumOfObsByStn() const
Definition: SgIoAgvDriver.h:82
int getNumOfSrc() const
Definition: SgIoAgvDriver.h:76
int getNumOfBands() const
Definition: SgIoAgvDriver.h:75
QMap< QString, SgAgvDatumDescriptor * > & mandatoryDatumByKey()
void figureOutImplicitDimensions(const QList< SgAgvRecord * > *)
QMap< QString, SgAgvDatum< long int > * > & i8Data()
int getNumOfScans() const
Definition: SgIoAgvDriver.h:73
QMap< QString, SgAgvDatum< short int > * > & i2Data()
int getMaxNumPerStn() const
Definition: SgIoAgvDriver.h:83
QMap< QString, SgAgvDatum< double > * > & r8Data()
void digestDataNoRegEx(const QList< SgAgvRecord * > *)
void fillDataStructures(const SgVlbiSession *session, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:596
QString className() const
Definition: SgIoAgv.h:341
int exportData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:623
void fillDataStructures(const SgVlbiSession *session, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:646
QString className() const
Definition: SgIoAgv.h:369
int exportData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:698
int importData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:714
int exportData(QTextStream &ts, const QString &prefix)
Definition: SgIoAgv.cpp:466
const QString & content() const
Definition: SgIoAgv.h:278
QString content_
Definition: SgIoAgv.h:285
int exportData(QTextStream &ts, SgAgvDriver *)
Definition: SgIoAgv.h:313
bool parseSectionLengthString(const QString &str, int &num2read)
Definition: SgIoAgv.cpp:551
int importData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:494
QString className() const
Definition: SgIoAgv.h:309
SgMJD startEpoch_
Definition: SgIoAgv.h:318
void fillDataStructures(const SgVlbiSession *session, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:482
QString prefix_
Definition: SgIoAgv.h:319
SgVlbiHistory & history()
Definition: SgIoAgv.h:399
SgVlbiHistory history_
Definition: SgIoAgv.h:411
QMap< int, QString > headerByIdx_
Definition: SgIoAgv.h:408
QMap< int, int > maxLenByIdx_
Definition: SgIoAgv.h:410
SgMJD histEpoch_
Definition: SgIoAgv.h:412
int exportData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:981
int importData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1020
void fillDataStructures(const SgVlbiSession *session, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:933
QString className() const
Definition: SgIoAgv.h:397
bool parseChapterInitString(const QString &str, int &num2read)
Definition: SgIoAgv.cpp:1090
QMap< int, int > numByIdx_
Definition: SgIoAgv.h:409
void fillDataStructures(const SgVlbiSession *session, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1152
SgAgvDatumDescriptor * agvRecord2datumDescriptor(SgAgvRecord *rec)
Definition: SgIoAgv.cpp:1201
int importData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1294
QString className() const
Definition: SgIoAgv.h:434
int exportData(QTextStream &ts, SgAgvDriver *drv)
Definition: SgIoAgv.cpp:1271
SgAgvRecord * datumDescriptor2agvRecord(SgAgvDatumDescriptor *dd)
Definition: SgIoAgv.cpp:1184
const QString & getAcAbbrevName() const
Definition: SgIdentities.h:247
void setAcAbbrevName(const QString &)
Definition: SgIdentities.h:367
const QString & getUserEmailAddress() const
Definition: SgIdentities.h:223
void setUserEmailAddress(const QString &)
Definition: SgIdentities.h:343
void setUserName(const QString &)
Definition: SgIdentities.h:335
const QString & getUserName() const
Definition: SgIdentities.h:215
void setDriverVersion(const SgVersion &)
virtual const QList< QString > listOfInputFiles() const =0
const SgIdentities * getCurrentIdentities() const
Definition: SgIoDriver.h:102
const SgVersion * getCurrentDriverVersion() const
Definition: SgIoDriver.h:104
SgIdentities * getInputIdentities() const
Definition: SgIoDriver.h:103
void setDateOfCreation(const SgMJD &t)
Definition: SgIoDriver.h:110
virtual void write(LogLevel, quint32, const QString &, bool=false)
Definition: SgLogger.cpp:88
@ IO_TXT
Definition: SgLogger.h:65
Definition: SgMJD.h:59
bool fromString(Format format, const QString &str, bool isReset=true)
Definition: SgMJD.cpp:267
@ F_YYYYMMDD
Another format for a date: 02 Apr, 2010.
Definition: SgMJD.h:88
@ F_DDMonYYYY
Date: 2010 Apr 02.
Definition: SgMJD.h:87
@ F_Date
RFC2822 date format realized by Qt (Qt::RFC2822Date)
Definition: SgMJD.h:86
@ F_SOLVE_SPLFL
That was used in ECC.dat files: 2010.04.02-17.02.
Definition: SgMJD.h:74
QString toString(Format format=F_Verbose) const
Definition: SgMJD.cpp:1007
static SgMJD currentMJD()
Definition: SgMJD.cpp:118
void setCodeName(const QString &)
Definition: SgVersion.h:336
const SgMJD & getReleaseEpoch() const
Definition: SgVersion.h:294
const QString & getSoftwareName() const
Definition: SgVersion.h:254
void setReleaseEpoch(const SgMJD &)
Definition: SgVersion.h:344
QString name(NameFormat fmt=NF_Human) const
Definition: SgVersion.cpp:54
void setMinorNumber(int)
Definition: SgVersion.h:320
void setMajorNumber(int)
Definition: SgVersion.h:312
void setSoftwareName(const QString &)
Definition: SgVersion.h:304
bool parseString(const QString &str)
Definition: SgVersion.cpp:140
SgVlbiHistory & history()
Definition: SgVlbiBand.h:360
int getVersion() const
const SgMJD & getEpoch() const
const QString & getText() const
const QString & getName() const
SgVlbiBand * primaryBand()
const SgIoDriver * getInputDriver() const