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:nickName());
64 
65  SgMJD finisEpoch(SgMJD::currentMJD());
67  "::putDataIntoAgvFile(): the session " + name_ + " has been exported in an AGV file \"" +
68  agvDriver.fileName() + "\" in directory \"" + agvDriver.path2File() +
69  "\"; elapsed time: " + QString("").sprintf("%.2f", (finisEpoch - startEpoch)*86400000.0) + " ms");
70 
71  return isOk;
72 };
73 
74 
75 
76 //
77 bool SgVlbiSession::getDataFromAgvFile(const QString& fileName, SgIdentities *ids,
79 {
80  bool isOk;
81  SgMJD startEpoch(SgMJD::currentMJD());
82  SgAgvDriver agvDriver(ids, driverVersion);
83 
84 
85  agvDriver.setSession(this);
86  if ((isOk = agvDriver.importData(fileName)))
88  else
90  ": getDataFromAgvFile(): reading AGV file \"" + fileName + "\" has failed");
91 
92  if (bandByKey_.size() == 0)
93  isOk = false;
94  if (observations_.size() == 0)
95  isOk = false;
96 
97  //isOk = isOk && selfCheck(guiExpected);
98  isOk = isOk && selfCheck(false);
99  //
100  SgMJD finisEpoch(SgMJD::currentMJD());
102  ": getDataFromAgvFile(): the session " + getName() + " has been read from vgosDb data set" +
103  ", elapsed time: " + QString("").sprintf("%.2f", (finisEpoch - startEpoch)*86400000.0) + " ms");
104 
105  return isOk;
106 };
107 
108 /*=====================================================================================================*/
109 
110 
111 
112 
113 
114 /*=====================================================================================================*/
115 //
116 // constants:
117 //
118 
119 
120 
121 /*=====================================================================================================*/
122 
123 /*=====================================================================================================*/
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:118
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()
QString nickName()
SgVersion * driverVersion
Definition: l2aVersion.cpp:31