Navigator2Go  2.0
Manage your local Ocean Navigator installation.
ioutils.h
1 #ifndef IOUTILS_H
2 #define IOUTILS_H
3 
4 #include "netcdfimportdesc.h"
5 #include "datadownloaddesc.h"
6 
7 #include <QObject>
8 #include <QVector>
9 #include <QRunnable>
10 
11 namespace IO {
12 
13 /***********************************************************************************/
15 #ifdef __linux__
16 const constexpr auto TOMCAT_BIN_DIR{ "/opt/tomcat9/bin" };
17 #else
18 #endif
19 #ifdef __linux__
21 const constexpr auto NAVIGATOR_FRONTEND_DIR{ "/opt/Ocean-Data-Map-Project/" };
22 #else
23 #endif
24 
25 /***********************************************************************************/
27 struct NODISCARD THREDDSFileDesc {
28  QString Path;
29  const QString Filename;
30 };
31 
32 /***********************************************************************************/
33 // Figures out the correct filename + path for a dataset
34 NODISCARD THREDDSFileDesc GetNCFilename(const QString& threddsContentDir, const DataDownloadDesc& data);
35 
36 /***********************************************************************************/
38 NODISCARD bool FileExists(const QString& path);
39 
40 /***********************************************************************************/
41 void ClearPythonCache();
42 
43 /***********************************************************************************/
45 void CreateDir(const QString& path);
46 
47 /***********************************************************************************/
49 void RemoveDir(const QString& path);
50 
51 /***********************************************************************************/
53 NODISCARD QString FindTimeDimension(const QString& netcdfFilePath);
54 
55 /***********************************************************************************/
57 
58 class CopyFilesRunnable : public QObject, public QRunnable {
59  Q_OBJECT
60 
61 public:
62  CopyFilesRunnable(const QString threddsContentDir, const bool removeSourceFiles, QVector<NetCDFImportDesc>&& fileList);
63 
64  void run() override;
65 
66 signals:
67  void progress(const qint64 percentDone);
68  void finished(const QStringList failedFiles);
69 
70 private:
71  const QString m_contentDir;
72  const bool m_removeSourceNCFiles;
73  const QVector<NetCDFImportDesc> m_fileList;
74 };
75 
76 } // namespace IO
77 
78 #endif // IOUTILS_H
Definition: ioutils.cpp:17
Copies (or moves) netCDF files to the THREDDS directory.
Definition: ioutils.h:58
Holds info needed to download a dataset from the remote server.
Definition: datadownloaddesc.h:11
Location of Tomcat bin/ folder.
Definition: ioutils.h:27