General Purpose Geodetic Library
SgVlbiSessionIoAgv.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/QTextStream>
29 
30 
31 #include <SgVlbiSession.h>
32 
33 #include <SgConstants.h>
34 #include <SgIdentities.h>
35 #include <SgLogger.h>
36 #include <SgVgosDb.h>
37 #include <SgVlbiBand.h>
38 #include <SgVlbiObservation.h>
39 
40 
41 
42 #include <SgIoAgvDriver.h>
43 
44 
45 /*=======================================================================================================
46 *
47 * Auxiliary data structures
48 *
49 *======================================================================================================*/
50 //
51 
52 
53 /*=====================================================================================================*/
54 //
55 bool SgVlbiSession::putDataIntoAgvFile(const QString& dirName, const QString& fileName,
57 {
58  bool isOk;
59  SgMJD startEpoch(SgMJD::currentMJD());
60  SgAgvDriver agvDriver(ids, driverVersion);
61 
62  agvDriver.setSession(this);
63  isOk = agvDriver.exportData(dirName, fileName.size()?fileName:getName());
64 
65  SgMJD finisEpoch(SgMJD::currentMJD());
66 
67  if (isOk)
69  "::putDataIntoAgvFile(): the session " + name_ + " has been exported in an AGV file \"" +
70  agvDriver.fileName() + "\" in directory \"" + agvDriver.path2File() +
71  "\"; elapsed time: " + QString("").sprintf("%.2f", (finisEpoch - startEpoch)*86400000.0) + " ms");
72  else
74  "::putDataIntoAgvFile(): export of the session \"" + name_ +
75  "\" in AGV format has failed; file: \"" + agvDriver.fileName() +
76  "\", directory: \"" + agvDriver.path2File() + "\"");
77 
78  return isOk;
79 };
80 
81 
82 
83 //
84 bool SgVlbiSession::getDataFromAgvFile(const QString& fileName, SgIdentities *ids,
86 {
87  bool isOk;
88  SgMJD startEpoch(SgMJD::currentMJD());
89  SgAgvDriver agvDriver(ids, driverVersion);
90 
91 
92  agvDriver.setSession(this);
93  if ((isOk = agvDriver.importData(fileName)))
95  else
97  ": getDataFromAgvFile(): import of AGV file \"" + fileName + "\" has failed");
98 
99  if (bandByKey_.size() == 0)
100  isOk = false;
101  if (observations_.size() == 0)
102  isOk = false;
103 
104  //isOk = isOk && selfCheck(guiExpected);
105  isOk = isOk && selfCheck(false);
106  //
107  SgMJD finisEpoch(SgMJD::currentMJD());
108  if (isOk)
110  ": getDataFromAgvFile(): the session " + getName() + " has been read from vgosDb data set" +
111  ", elapsed time: " + QString("").sprintf("%.2f", (finisEpoch - startEpoch)*86400000.0) + " ms");
112 
113  return isOk;
114 };
115 
116 /*=====================================================================================================*/
117 
118 
119 
120 
121 
122 /*=====================================================================================================*/
123 //
124 // constants:
125 //
126 
127 
128 
129 /*=====================================================================================================*/
130 
131 /*=====================================================================================================*/
SgLogger * logger
Definition: SgLogger.cpp:231
const QString & path2File() const
Definition: SgIoAgvDriver.h:68
bool importData(const QString &fileName)
void setSession(SgVlbiSession *session)
Definition: SgIoAgvDriver.h:87
bool exportData(const QString &path2File, const QString &fileName)
const QString & fileName() const
Definition: SgIoAgvDriver.h:69
void addAttr(uint a)
Definition: SgAttribute.h:202
virtual void write(LogLevel, quint32, const QString &, bool=false)
Definition: SgLogger.cpp:88
@ IO_NCDF
Definition: SgLogger.h:66
@ IO_TXT
Definition: SgLogger.h:65
@ DATA
Definition: SgLogger.h:78
Definition: SgMJD.h:59
static SgMJD currentMJD()
Definition: SgMJD.cpp:119
const QString & getName() const
@ Attr_FF_CREATED
the session has been imported from correlator;//vgosDbMake
QString name_
name of the session (e.g., 10JUL22XE);
bool selfCheck(bool guiExpected)
QMap< QString, SgVlbiBand * > bandByKey_
QList< SgVlbiObservation * > observations_
bool putDataIntoAgvFile(const QString &dirName, const QString &fileName, SgIdentities *ids, SgVersion *driverVersion)
bool getDataFromAgvFile(const QString &fileName, SgIdentities *ids, SgVersion *driverVersion)
static QString className()
SgVersion * driverVersion
Definition: l2aVersion.cpp:31