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