CARMA C++
DataTransfer.h
Go to the documentation of this file.
1 
11 #ifndef CARMA_ARCHIVE_DATATRANSFER_H_
12 #define CARMA_ARCHIVE_DATATRANSFER_H_
13 
15 #include "carma/sdp/MiriadUV.h"
16 
17 // C includes
18 #include <sys/types.h>
19 #include <dirent.h>
20 #include <stdio.h>
21 #include <zlib.h>
22 #include <errno.h>
23 
24 // Std C++ includes
25 #include <iostream>
26 #include <fstream>
27 #include <map>
28 #include <exception>
29 #include <vector>
30 #include <string>
31 
32 // Carma tools includes
33 #include "log4cpp/Category.hh"
34 #include "bgftp/ArchiveJni.h"
35 
36 namespace carma {
37 namespace archive {
38 
39 class DataTransfer
40 {
41  public:
45  DataTransfer(std::map<std::string, std::string> arv);
46 
50  ~DataTransfer();
51 
58  int update(const std::vector<std::string> & p,
59  const std::vector<std::string> & dirs,
60  const std::string & filter);
61 
69  int move_mp(const std::vector<std::string> & p,
70  const std::vector<std::string> & dirs,
71  const std::string & filter);
72 
80  int move_sza(const std::vector<std::string> & p,
81  const std::vector<std::string> & dirs,
82  const std::string & filter);
83 
91  int move_qr(const std::vector<std::string> & p,
92  const std::string & dir,
93  const std::string & filter);
94 
98  void start(const std::vector<std::string> & p,
99  const std::vector<std::string> & dirs,
100  const std::string & filter);
101 
105  void stop();
106 
107  private:
108 
113  std::vector<std::string> getFiles(const std::string & dir, const std::string & filter);
114  std::vector<std::string> getSZAFiles(const std::string & dir);
115  std::vector<std::string> getQualityReports(const std::string & dir);
119  void setParams(const std::vector<std::string> & params, const std::string & filter);
120 
124  void gzip(const std::string & source, const std::string & dest);
125 
129  //void gunzip(std::string& source, std::string& dest);
130 
134  void writeTransferLog(const std::vector<std::string> & list);
135 
140  void writeTransferDB(const std::vector<std::string> & list, const bool append);
141 
145  void appendDoneList(const std::vector<std::string>& list);
146 
151  std::string getDate(const std::string & filename);
152 
156  std::string getYear(const std::string & filename);
157 
161  std::string getRange(const std::string & name);
162 
166  std::string logFile;
167 
171  std::vector<std::string> doneList;
172 
176  ArchiveJni *jniObj;
177 
181  std::string theDate;
182 
186  std::string theYear;
187 
191  std::string szaYear;
192 
197  std::string theRange;
198 
202  bool yearIsSet;
203 
207  bool szaYearIsSet;
208 
212  bool rangeIsSet;
213 
219  bool toAppend;
220 
224  TransferDB* db;
225 };
226 
227 }} // namespace carma::archive
228 
229 #endif /*CARMA_ARCHIVE_DATATRANSFER_H_*/
Defines the abstract class MiriadUV and the specialization MiriadUVBin which define the interface for...
Class definition for TransferDB class.