-
Notifications
You must be signed in to change notification settings - Fork 1
/
datamodels.h
206 lines (175 loc) · 5.07 KB
/
datamodels.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#ifndef DATAMODELS_H
#define DATAMODELS_H
#include <fstream>
#include <string>
#include <vector>
#include <iostream>
namespace datamodels {
const char* const FormatKAT_OBS_R = "%c%d%d%lld%lld%lld%d%2s%8s%d%lf%lf%d%lf%lf%lf%d%lf";
const char* const FormatKAT_OBS_W = "e%3d%3d%6lld%6lld%8lld%5d%3s%9s%6d%6.1lf%7.1lf%3d%8.3lf%10.2lf%6.3lf%3d%7.1lf";
const char* const FormatKAT_KBO_R = "%c%lld%lld%d%3s%lld%lld%lf%lf%d%d%lf%d%d%d%8s%lf";
const char* const FormatKAT_KBO_W = "e%7lld%8lld%5d%3s%6lld%6lld%6.1lf%7.1lf%3d%6d%6.3lf%3d%4d%4d% 9s%7.1lf";
const char* const FormatOGA_R = "%lf%lf%lf%lf%d";
const char* const FormatCGA_W = " %20.12lf%10.4lf%8.4lf%14.3lf%15.7lf%5d";
const char* const FormatCGA_R = " %lf%lf%lf%lf%lf%d";
const char* const FormatEGA_R = "%c%lld%lf%lf%lf";
const char* const FormatPGA_W = " %20.12lf%12.4lf%12.4lf%12.4lf";
const char* const FormatPGA_R = "%lf%lf%lf%lf";
const char* const FormatKGA_R = "%lf%lf%lf%lf%d%lf";
const char* const FormatKGA_W = "%20.12lf%9.4lf%8.4lf%14.3lf%5d%8.4lf";
const char* const FormatKAT_KAL_R = "%c%d%2s%2s%lld%lld%d%lf%lf%lf%lf%lf%d%d%d%d%lld%d%lf%lf%lf%12s";
const char* const FormatKAT_KAL_W = "e %5d %2s %2s%6lld%6lld%4d%9.3lf%6.3lf%9.3lf%6.1lf%7.1lf%3d%5d%4d%3d%7lld%3d%7.3lf%7.3lf%12.4lf % 12s";
const char* const FormatSYS_CONF_R = "%lf%s%s%s%s%s";
const char* const FormatKAT_TAR_R = "%*d%*2s%2s%lf%*lf%*lf%*20s";
const char* const FormatEPA_AUTO_W = "%4d%6lld%4d%4d%8lld %10s";
const char* const FormatEPA_AUTO_R = "%d%lld%d%d%lld";
const char* const FormatCOPY_W = "%20.12lf%9.4lf%8.4lf%14.3lf%15.7lf%5d";
const char* const FormatSATELLIT_R = "%10s%lld%d%lld%d%d%d%d%s";
template <typename T>
class Singleton {
public:
static T* Instance() {
if (!m_instance)
m_instance = new T();
return m_instance;
}
Singleton(const Singleton&) = delete;
Singleton& operator= (const Singleton&) = delete;
private:
static T* m_instance;
};
template <typename T>
T* Singleton<T>::m_instance = nullptr;
// following structure and class represents KAT_OBS data.
struct ObsCatElem {
int nr;
char c;
int ws, ws1;
int64_t mjd, secday;
int64_t nsat;
int nsta;
char kodst[3], namefe[9];
int npoint;
double temp, pres;
int humid;
double TB, RB, RMS;
int POLY;
double clock_cor;
};
class ObsCatalogue {
public:
ObsCatalogue()=default;
~ObsCatalogue()=default;
bool read (const std::string& fname);
bool write(const std::string& fname);
std::vector<ObsCatElem> cat;
};
// following structure and class represents KAT_KAL data.
struct CalCatElem {
int nr;
char c;
int nsta;
char kodst[3], nam[3];
int64_t mjd, secday;
int filtr;
double meanval, rms, corect, temp, baro;
int humid, nflash, nreturn, weather;
int64_t numberpas;
int coef;
double skew, kurt, target;
char namcal[13];
};
class CalCatalogue {
public:
CalCatalogue()=default;
~CalCatalogue()=default;
bool read (const std::string& fname);
bool write(const std::string& fname);
std::vector<CalCatElem> cat;
};
// following structure and class represents SATELLIT file's data.
struct SatellitLine {
char name[11];
int64_t id;
int sic;
int64_t norad;
int transponder, i_flag, NOR_POINT, np_window;
char sname[4];
};
class SatellitCatalogue {
public:
SatellitCatalogue()=default;
~SatellitCatalogue()=default;
bool read (const std::string& fname);
// if sat not found by sat_id, returns blank: SatellitLine{"",0,0,0,0,0,0,0,""}
SatellitLine getSatById(int64_t sat_id);
std::vector<SatellitLine> cat;
};
// .cXX files data.
struct CopyObsElem {
double sec, azym, elev, range1, range;
int ampl;
};
class CopyObs {
public:
CopyObs()=default;
~CopyObs()=default;
bool read (const std::string& fname);
bool write(const std::string& fname);
std::vector<CopyObsElem> data;
};
// .oXX files data.
struct ObsElem {
double sec, azym, elev, range;
int ampl;
};
class Obs {
public:
Obs()=default;
~Obs()=default;
bool read (const std::string& fname);
std::vector<ObsElem> data;
};
// .eXX files data.
struct EfemElem {
char c;
double azym, elev, range;
int64_t sec;
};
class Efem {
public:
Efem()=default;
~Efem()=default;
bool read (const std::string& fname);
std::vector<EfemElem> data;
};
// .pXX files data.
struct DifElem {
double sec, omc, tbrb, czeb;
};
class Dif {
public:
Dif()=default;
~Dif()=default;
bool read (const std::string& fname);
bool write(const std::string& fname);
std::vector<DifElem> data;
};
// .kXX files data.
struct KobsElem {
double sec, azym, elev, range, czeb1;
int ampl;
};
class Kobs {
public:
Kobs()=default;
~Kobs()=default;
bool read (const std::string& fname);
bool write(const std::string& fname);
std::vector<KobsElem> data;
};
}
typedef datamodels::Singleton<datamodels::ObsCatalogue> UniqueKAT_OBS;
typedef datamodels::Singleton<datamodels::CalCatalogue> UniqueKAT_CAL;
typedef datamodels::Singleton<datamodels::SatellitCatalogue> UniqueKAT_SAT;
#endif // DATAMODELS_H