General Purpose Geodetic Library
SgVlbiHistory.h
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 #ifndef SG_VLBI_HISTORY_H
24 #define SG_VLBI_HISTORY_H
25 
26 
27 #ifdef HAVE_CONFIG_H
28 # include <config.h>
29 #endif
30 
31 
32 #include <math.h>
33 
34 #include <QtCore/QString>
35 #include <QtCore/QList>
36 
37 
38 #include <SgMJD.h>
39 
40 
41 class SgDbhImage;
42 
43 /***===================================================================================================*/
50 {
51 public:
52  //
53  // constructors/destructors:
54  //
58  inline SgVlbiHistoryRecord();
59 
63  inline SgVlbiHistoryRecord(const SgMJD&, int, const QString&, bool=false);
64 
65  inline SgVlbiHistoryRecord(const SgVlbiHistoryRecord& rec);
66 
70  inline ~SgVlbiHistoryRecord() {};
71 
72 
73  //
74  // Interfaces:
75  //
76  // gets:
79  inline const SgMJD& getEpoch() const;
80 
83  inline int getVersion() const;
84 
87  inline const QString& getText() const;
88 
91  inline bool getIsEditable() const;
92 
93  // sets:
97  inline void setEpoch(const SgMJD& t);
98 
102  inline void setVersion(int v);
103 
107  inline void setText(const QString& text);
108 
112  inline void setIsEditable(bool is);
113 
114  //
115  // Functions:
116  //
117  inline const QString className() const;
118 
119 private:
120  //
121  SgMJD epoch_; // an epoch of the history text band
122  int version_; // version of the file where it was added
123  QString text_; // a text of a historical record
124  bool isEditable_; // user (an owner) can edit or delete the record
125 };
126 /*=====================================================================================================*/
127 
128 
129 
130 /***===================================================================================================*/
136 class SgDbhHistoryEntry;
137 class SgVlbiHistory : public QList<SgVlbiHistoryRecord*>
138 {
139 public:
140  //
141  // constructors/destructors:
142  //
146  inline SgVlbiHistory();
147 
151  inline ~SgVlbiHistory();
152 
153  //
154  // Interfaces:
155  //
156  // gets:
157  inline const QString& getFirstRecordFromUser() const;
158 
159  // sets:
160  inline void setFirstRecordFromUser(const QString&);
161 
162 
163  //
164  // Functions:
165  //
167 
169 
170 // void addHistoryRecord(const QString&, const SgMJD& t = SgMJD::currentMJD().toUtc());
171  void addHistoryRecord(const QString&, const SgMJD& t);
172 
173  inline const QString className() const;
174 
175 
176 private:
177  // for David:
179 };
180 /*=====================================================================================================*/
181 
182 
183 
184 
185 /*=====================================================================================================*/
186 /* */
187 /* SgVlbiHistoryEntry inline members: */
188 /* */
189 /*=====================================================================================================*/
190 //
191 //
192 // CONSTRUCTORS:
193 //
194 // An empty constructor:
196  epoch_(tZero),
197  version_(-1),
198  text_("Unnatural history record"),
199  isEditable_(false)
200 {
201 };
202 
203 
204 //
205 inline SgVlbiHistoryRecord::SgVlbiHistoryRecord(const SgMJD& t, int v, const QString& text, bool is) :
206  epoch_(t),
207  version_(v),
208  text_(text),
209  isEditable_(is)
210 {
211 };
212 
213 
214 
215 //
217  epoch_(rec.getEpoch()),
218  version_(rec.getVersion()),
219  text_(rec.getText()),
220  isEditable_(rec.getIsEditable())
221 {
222 };
223 
224 
225 
226 //
227 // INTERFACE:
228 //
229 //
231 {
232  return epoch_;
233 };
234 
235 
236 
237 //
239 {
240  return version_;
241 };
242 
243 
244 
245 //
246 inline const QString& SgVlbiHistoryRecord::getText() const
247 {
248  return text_;
249 };
250 
251 
252 
253 //
255 {
256  return isEditable_;
257 };
258 
259 
260 
261 //
263 {
264  epoch_ = t;
265 };
266 
267 
268 
269 //
271 {
272  version_ = v;
273 };
274 
275 
276 
277 //
278 inline void SgVlbiHistoryRecord::setText(const QString& text)
279 {
280  text_ = text;
281 };
282 
283 
284 
285 //
287 {
288  isEditable_ = is;
289 };
290 
291 
292 
293 //
294 inline const QString SgVlbiHistoryRecord::className() const
295 {
296  return "SgVlbiHistoryRecord";
297 };
298 /*=====================================================================================================*/
299 
300 
301 
302 
303 
304 
305 /*================================================================================================*/
306 /* */
307 /* SgVlbiHistory inline members: */
308 /* */
309 /*================================================================================================*/
310 //
311 //
312 // CONSTRUCTORS:
313 //
314 // An empty constructor:
317  firstRecordFromUser_()
318 {
319 };
320 
321 
322 
323 //
325 {
326  for (int i=0; i<size(); i++)
327  delete at(i);
328  clear();
329 };
330 
331 
332 
333 //
334 inline const QString SgVlbiHistory::className() const
335 {
336  return "SgVlbiHistory";
337 };
338 
339 
340 
341 //
342 inline const QString& SgVlbiHistory::getFirstRecordFromUser() const
343 {
344  return firstRecordFromUser_;
345 };
346 
347 
348 
349 //
350 inline void SgVlbiHistory::setFirstRecordFromUser(const QString& str)
351 {
352  firstRecordFromUser_ = str;
353 };
354 /*=====================================================================================================*/
355 
356 
357 
358 
359 
360 
361 /*=====================================================================================================*/
362 #endif // SG_VLBI_HISTORY_H
const SgMJD tZero(1957, 10, 4)
Definition: SgMJD.h:59
int getVersion() const
void setIsEditable(bool is)
bool getIsEditable() const
void setVersion(int v)
const QString className() const
const SgMJD & getEpoch() const
void setText(const QString &text)
void setEpoch(const SgMJD &t)
const QString & getText() const
const QString className() const
const QString & getFirstRecordFromUser() const
QString firstRecordFromUser_
void importDbhHistoryBlock(SgDbhImage *)
void addHistoryRecord(const QString &, const SgMJD &t)
void export2DbhHistoryBlock(SgDbhImage *)
void setFirstRecordFromUser(const QString &)