General Purpose Geodetic Library
SgTaskManager.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_TASK_MANAGER_H
24 #define SG_TASK_MANAGER_H
25 
26 
27 #ifdef HAVE_CONFIG_H
28 # include <config.h>
29 #endif
30 
31 
32 #include <QtCore/QString>
33 #include <QtCore/QList>
34 #include <QtCore/QMap>
35 
36 
37 #include <SgMJD.h>
38 #include <SgVlbiSession.h>
39 #include <SgTask.h>
40 
41 
42 class SgEstimator;
43 class SgParameter;
44 class SgRefraction;
45 class SgObservation;
46 class SgVlbiSession;
47 class SgVlbiSessionInfo;
48 
49 
50 
51 /***===================================================================================================*/
58 {
59 public:
60  //
61  // constructors/destructors:
62  //
66  inline SgTaskManager();
67 
71  inline SgTaskManager(SgTask*);
72 
76  virtual ~SgTaskManager();
77 
78 
79 
80  //
81  // Interfaces:
82  //
86 
90 
91  // gets:
94  inline SgTask* getTask() const;
95 
98 // inline SgEstimator* estimator();
99 
102  inline SgEstimator* estimator();
103 
106  inline bool getIsTaskOwner();
107 
110  inline SgRefraction* refraction();
111 
114  inline const SgMJD& getStartRunEpoch() const;
115 
118  inline const SgMJD& getFinisRunEpoch() const;
119 
122  inline const SgMJD& getTStart() const;
123  inline const SgMJD& getTRefer() const {return tRefer_;};
124 
127  inline const SgMJD& getTFinis() const;
128 
131  inline int getNumOfParameters() const;
132 
135  inline int getNumOfConstraints() const;
136 
137  // sets:
140  inline void setTask(SgTask*);
141 
144  inline void setIsTaskOwner(bool);
145 
149 
153 
157 
161 
165 
169 
170 
171  inline void setHave2InteractWithGui(bool have2) {have2InteractWithGui_ = have2;};
172 
173  inline void setLongOperationStart(void (*operation)(int, int, const QString&))
174  {longOperationStart_ = operation;};
175 
176  inline void setLongOperationProgress(void (*operation)(int)) {longOperationProgress_ = operation;};
177 
178  inline void setLongOperationStop(void (*operation)()) {longOperationStop_ = operation;};
179 
180  inline void setLongOperationMessage(void (*operation)(const QString&))
181  {longOperationMessage_ = operation;};
182 
183  inline void setLongOperationShowStats(void (*operation)
184  (const QString& label, int numTot, int numPrc, double wrms, double chi2))
185  {longOperationShowStats_ = operation;};
186 
187 
188  //
189  // Functions:
190  //
193  virtual const QString className();
194 
195  virtual void run(bool =true);
196  virtual bool prepare4Run();
197  virtual void finisRun();
198 
199 
200  //
201  // Friends:
202  //
203 
204  //
205  // I/O:
206  //
207  // ...
208 
209 protected:
217 
218 
219  // a cache of observations:
222  // working list of sessions infos:
224  // current session info:
226  // current session:
228 
229  // lists of parameters:
235 
236  // for calculations:
241 
242  // private functions:
243  // session manipulations:
244  void loadVlbiSession(const QString&);
245  void saveVlbiSession();
246  // lists of parameters:
247  void updateParamaterLists();
249  // constraints:
250  int constrainClocks();
255  int constrainSourcesTmp();
256 
257  // interactions with GUI:
259  void (*longOperationStart_) (int minStep, int maxStep, const QString& message);
260  void (*longOperationProgress_) (int step);
261  void (*longOperationStop_) ();
262  void (*longOperationMessage_) (const QString& message);
263  void (*longOperationShowStats_) (const QString& label, int numTot, int numPrc,
264  double wrms, double chi2);
265 };
266 /*=====================================================================================================*/
267 
268 
269 
270 
271 
272 
273 
274 
275 /*=====================================================================================================*/
276 /* */
277 /* SgTaskManager inline members: */
278 /* */
279 /*=====================================================================================================*/
280 //
281 //
282 // CONSTRUCTORS:
283 //
284 // An empty constructor:
286  startRunEpoch_(tZero),
287  finisRunEpoch_(tZero),
288  tStart_(tZero),
289  tFinis_(tZero),
290  tRefer_(tZero)
291 {
292  task_ = NULL;
293  isTaskOwner_ = false;
294 // estimator_ = NULL;
295  estimator_ = NULL;
296  observations_ = NULL;
297  isObsListOwner_ = true;
298  globalParameters_ = NULL;
299  arcParameters_ = NULL;
300  localParameters_ = NULL;
301  pwlParameters_ = NULL;
302  stochasticParameters_ = NULL;
303  currentSessionInfo_ = NULL;
304  currentSession_ = NULL;
305  refraction_ = NULL;
306  numOfParameters_ = 0;
307  numOfConstraints_ = 0;
308  have2InteractWithGui_ = false;
309  longOperationStart_ = NULL;
310  longOperationProgress_ = NULL;
311  longOperationStop_ = NULL;
312  longOperationMessage_ = NULL;
314 };
315 
316 
317 
318 // another constructor:
320  startRunEpoch_(tZero),
321  finisRunEpoch_(tZero),
322  tStart_(tZero),
323  tFinis_(tZero),
324  tRefer_(tZero)
325 {
326  task_ = task;
327  isTaskOwner_ = false;
328 // estimator_ = NULL;
329  estimator_ = NULL;
330  observations_ = NULL;
331  isObsListOwner_ = true;
332  globalParameters_ = NULL;
333  arcParameters_ = NULL;
334  localParameters_ = NULL;
335  pwlParameters_ = NULL;
336  stochasticParameters_ = NULL;
337  currentSessionInfo_ = NULL;
338  currentSession_ = NULL;
339  refraction_ = NULL;
340  numOfParameters_ = 0;
341  numOfConstraints_ = 0;
342 };
343 
344 
345 
346 //
347 // INTERFACES:
348 //
349 //
351 {
352  return task_;
353 };
354 
355 
356 
357 //
359 {
360  return isTaskOwner_;
361 };
362 
363 
364 
365 //
366 //inline SgEstimator* SgTaskManager::estimator()
367 //{
368 // return estimator_;
369 //};
370 
371 
372 
373 //
375 {
376  return estimator_;
377 };
378 
379 
380 
381 //
383 {
384  return refraction_;
385 };
386 
387 
388 
389 //
391 {
392  return startRunEpoch_;
393 };
394 
395 
396 
397 //
399 {
400  return finisRunEpoch_;
401 };
402 
403 
404 
405 //
406 inline const SgMJD& SgTaskManager::getTStart() const
407 {
408  return tStart_;
409 };
410 
411 
412 
413 //
414 inline const SgMJD& SgTaskManager::getTFinis() const
415 {
416  return tFinis_;
417 };
418 
419 
420 
421 //
423 {
424  return numOfParameters_;
425 };
426 
427 
428 
429 //
431 {
432  return numOfConstraints_;
433 };
434 
435 
436 
437 //
438 inline void SgTaskManager::setTask(SgTask* task)
439 {
440  if (isTaskOwner_ && task_)
441  delete task_;
442  task_ = task;
443 };
444 
445 
446 
447 //
448 inline void SgTaskManager::setIsTaskOwner(bool is)
449 {
450  isTaskOwner_ = is;
451 };
452 
453 
454 
455 //
457 {
458  observations_ = observations;
459  isObsListOwner_ = false;
460 };
461 
462 
463 
464 
465 //
466 // FRUNCTIONS:
467 //
468 //
469 //
470 
471 
472 
473 //
474 // FRIENDS:
475 //
476 //
477 //
478 /*=====================================================================================================*/
479 
480 
481 
482 
483 
484 /*=====================================================================================================*/
485 //
486 // aux functions:
487 //
488 
489 
490 /*=====================================================================================================*/
491 #endif //SG_TASK_MANAGER_H
const SgMJD tZero(1957, 10, 4)
QList< SgVlbiSessionInfo * > SessionInfos
Definition: SgMJD.h:59
void updateParamaterLists()
SgTask * task_
SgMJD startRunEpoch_
SgEstimator * estimator()
QList< SgObservation * > * observations_
const SgMJD & getTFinis() const
void setLongOperationStart(void(*operation)(int, int, const QString &))
QList< SgParameter * > * localParameters_
QList< SgParameter * > * arcParameters_
void(* longOperationMessage_)(const QString &message)
const SgMJD & getTRefer() const
SgRefraction * refraction()
SessionInfos sessions_
void(* longOperationStart_)(int minStep, int maxStep, const QString &message)
void(* longOperationStop_)()
int constrainTroposphericParameters()
SgVlbiSessionInfo *& currentSessionInfo()
Definition: SgTaskManager.h:85
QList< SgParameter * > * stochasticParameters()
void(* longOperationProgress_)(int step)
SgEstimator * estimator_
void(* longOperationShowStats_)(const QString &label, int numTot, int numPrc, double wrms, double chi2)
void setLongOperationMessage(void(*operation)(const QString &))
virtual ~SgTaskManager()
void setLongOperationStop(void(*operation)())
void setObservations(QList< SgObservation * > *)
int getNumOfParameters() const
const SgMJD & getStartRunEpoch() const
virtual void run(bool=true)
SgVlbiSession * currentSession_
QList< SgParameter * > * globalParameters()
int constrainStcPositionsNNR()
int getNumOfConstraints() const
SgVlbiSessionInfo * currentSessionInfo_
int constrainStcPositionsNNT()
bool getIsTaskOwner()
void loadVlbiSession(const QString &)
QList< SgParameter * > * pwlParameters_
QList< SgParameter * > * globalParameters_
void setHave2InteractWithGui(bool have2)
const SgMJD & getFinisRunEpoch() const
QList< SgParameter * > * arcParameters()
const SgMJD & getTStart() const
int constrainSourcesPositions()
void setLongOperationShowStats(void(*operation)(const QString &label, int numTot, int numPrc, double wrms, double chi2))
virtual const QString className()
SgRefraction * refraction_
virtual bool prepare4Run()
SgMJD finisRunEpoch_
QList< SgParameter * > * localParameters()
void saveVlbiSession()
QList< SgParameter * > * stochasticParameters_
SgTask * getTask() const
bool have2InteractWithGui_
void setTask(SgTask *)
SgVlbiSession *& currentSession()
Definition: SgTaskManager.h:89
void setLongOperationProgress(void(*operation)(int))
QList< SgParameter * > * pwlParameters()
void setIsTaskOwner(bool)
int constrainSourcesTmp()
virtual void finisRun()
void fillParameterList(QList< SgParameter * > *&, SgParameterCfg::PMode)
Definition: SgTask.h:59