General Purpose Geodetic Library
SgDbhFormat.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_DBHFORMAT_H
24 #define SG_DBHFORMAT_H
25 
26 
27 #include <math.h>
28 #include <string.h>
29 
30 
31 #ifdef HAVE_CONFIG_H
32 # include <config.h>
33 #endif
34 
35 
36 #include <QtCore/QString>
37 #include <QtCore/QDataStream>
38 #include <QtCore/QTextStream>
39 #include <QtCore/QList>
40 #include <QtCore/QHash>
41 
42 
43 #include <SgMathSupport.h>
44 #include <SgMJD.h>
45 #include <SgDbhImage.h>
46 
47 
48 
49 
50 
51 /***===================================================================================================*/
58 {
59 public:
60  //
61  // constructors/destructors:
62  //
63  inline SgDbhPhysicalRecord() {length_=-1; logicalRecord_=NULL; isOK_=true;};
65  virtual ~SgDbhPhysicalRecord();
66  //
67  // Interfaces:
68  //
69  inline bool isOk() const {return isOK_;};
70  inline int length() const {return length_;};
71  //
72  // Functions:
73  //
74  virtual int readLR(SgDbhStream& s);
75  virtual int writeLR(SgDbhStream& s) const;
77  virtual void reSize(int length);
78  virtual char* base() {return logicalRecord_;};
79  static const QString className();
80  //
81  // Friends:
82  //
85 protected:
86  int length_;
88  bool isOK_;
89 };
90 /*=====================================================================================================*/
91 
92 
93 
94 
95 
96 
97 /***===================================================================================================*/
107 {
108 protected:
109  QString text_;
110 public:
111  inline SgDbhDataRecordString() : SgDbhPhysicalRecord(), text_("Is there anybody out there?") {};
113  : SgDbhPhysicalRecord(rec), text_(rec.text_) {};
114  virtual ~SgDbhDataRecordString();
115  inline const QString& getText() const {return text_;};
116  void setText(const QString& text);
117  virtual QString getValue(SgDbhDatumDescriptor*, int dim2, int dim3);
118  void setValue(SgDbhDatumDescriptor*, int dim2, int dim3, const QString&);
119  virtual int readLR(SgDbhStream& s);
121  static const QString className();
122 };
123 /*=====================================================================================================*/
124 
125 
126 
127 
128 
129 
130 /***===================================================================================================*/
136 template<class C> class SgDbhDataRecord : public SgDbhPhysicalRecord
137 {
138 protected:
139  C* base_;
140  int num_;
141 public:
142  inline SgDbhDataRecord<C>() : SgDbhPhysicalRecord() {base_=NULL; num_=0;};
143  inline SgDbhDataRecord<C>(SgDbhDataRecord<C> const & rec) : SgDbhPhysicalRecord(rec)
144  {base_=NULL; *this=rec;};
145  virtual ~SgDbhDataRecord<C>();
146  virtual C& operator[](int i);
147  virtual C at(int i) const;
148  virtual C value(SgDbhDatumDescriptor* descriptor, int d1, int d2, int d3); // zero based indexes
149  virtual C& access(SgDbhDatumDescriptor* descriptor, int d1, int d2, int d3); // zero based indexes
150  inline int num() const {return num_;};
151  virtual char* base();
152  virtual int readLR(SgDbhStream& s);
153  virtual int writeLR(SgDbhStream& s) const;
154  virtual SgDbhDataRecord<C>& operator=(const SgDbhDataRecord<C>& rec);
155  virtual void reSize(int length);
156  virtual QString className() const;
157 };
158 /*=====================================================================================================*/
159 
160 
161 
162 
163 
164 
165 /***===================================================================================================*/
172 {
173 public:
174  inline SgDbhServiceRecord(const char expectedPrefix[2]) : SgDbhPhysicalRecord()
175  {prefix_[0]=prefix_[1]='Q'; expectedPrefix_[0]=expectedPrefix[0];
176  expectedPrefix_[1]=expectedPrefix[1]; expectedPrefix_[2]=0;};
177  inline SgDbhServiceRecord(const SgDbhServiceRecord& sr) : SgDbhPhysicalRecord() {*this=sr;};
178  inline virtual ~SgDbhServiceRecord() {};
179  inline bool isCorrectPrefix() const
180  {return prefix_[0]==expectedPrefix_[0] && prefix_[1]==expectedPrefix_[1];};
181  inline virtual bool isAltered() const {return false;};
183  inline void setPrefix(const char prefix[2]) {prefix_[0]=prefix[0]; prefix_[1]=prefix[1];};
184  inline void setAltered() {prefix_[0]='Z'; prefix_[1]='Z';};
188  expectedPrefix_[2]=sr.expectedPrefix_[2]; return *this;};
189  inline virtual int readLR(SgDbhStream& s)
190  {if (!isPrefixParsed(s)) return 2; else return 2;};
191  inline virtual int writeLR(SgDbhStream& s) const
192  {s << (qint8)prefix_[0] << (qint8)prefix_[1]; return 2;};
193  inline virtual QString className() const {return "SgDbhServiceRecord";};
194 protected:
195  char prefix_[2];
197 };
198 /*=====================================================================================================*/
199 
200 
201 
202 
203 
204 
205 /***===================================================================================================*/
212 {
213 public:
216  length_=24;};
217  inline virtual ~SgDbhServiceRecordHS1() {};
218 //interface:
220  int getVersionNumber() const {return versionNumber_;};
221  SgMJD getHistoryEpoch() const {return SgMJD(epoch_[0],1,epoch_[1],epoch_[2],epoch_[3],epoch_[4]);};
222 //
224  void setVersionNumber(int number) {versionNumber_=(short)number;};
225  void setHistoryEpoch(const SgMJD &);
226 //
227  bool isZ1() const {return prefix_[0]=='Z' && prefix_[1]=='Z';};
228 // void setAltered() {prefix_[0]='Z'; prefix_[1]='Z';};
229  virtual bool isAltered() const {return isZ1();};
230  virtual int readLR(SgDbhStream& s);
231  virtual int writeLR(SgDbhStream& s) const;
232  inline virtual QString className() const {return "SgDbhServiceRecordHS1";};
233 protected:
235  short epoch_[5];
237 };
238 /*=====================================================================================================*/
239 
240 
241 
242 
243 
244 
245 /***===================================================================================================*/
251 class SgDbhHistoryEntry;
253 {
254  friend class SgDbhHistoryEntry;
255 public:
257  inline virtual ~SgDbhServiceRecordHS2() {};
258  virtual int readLR(SgDbhStream& s);
259  virtual int writeLR(SgDbhStream& s) const;
260  void setSemiName(const QString&);
261  inline virtual QString className() const {return "SgDbhServiceRecordHS2";};
262 protected:
267  char semiName_[7];
268 };
269 /*=====================================================================================================*/
270 
271 
272 
273 
274 
275 
276 /***===================================================================================================*/
283 {
284 protected:
286  bool isZ2_;
287  short pRest[9];
288 public:
290  inline virtual ~SgDbhServiceRecordTc() {};
291  bool isZ2() const {return isZ2_;};
292  short numTeBlocks() const {return numTeBlocks_;};
293  short tocType() const {return tocType_;};
294  virtual bool isAltered() const {return prefix_[0]=='Z' && prefix_[1]=='Z';};
295  void dump(QTextStream& s) const;
296  virtual int readLR(SgDbhStream&);
297  virtual int writeLR(SgDbhStream& s) const;
300  isZ2_=tc.isZ2_; pRest[0]=tc.pRest[0]; pRest[1]=tc.pRest[1]; pRest[2]=tc.pRest[2];
301  pRest[3]=tc.pRest[3]; pRest[4]=tc.pRest[4]; pRest[5]=tc.pRest[5]; pRest[6]=tc.pRest[6];
302  pRest[7]=tc.pRest[7]; pRest[8]=tc.pRest[8]; return *this;};
303  inline virtual QString className() const {return "SgDbhServiceRecordTc";};
304 };
305 /*=====================================================================================================*/
306 
307 
308 
309 
310 
311 
312 /***===================================================================================================*/
319 {
320  friend class SgDbhTeBlock;
321 protected:
325 public:
327  inline virtual ~SgDbhServiceRecordTe() {};
328  int r8Num() const {return r8Num_;};
329  int i2Num() const {return i2Num_;};
330  int a2Num() const {return a2Num_;};
331  int d8Num() const {return d8Num_;};
332  int j4Num() const {return j4Num_;};
333  void dump(QTextStream& s) const;
334  virtual int readLR(SgDbhStream&);
335  virtual int writeLR(SgDbhStream& s) const;
340  a2Num_=te.a2Num_; d8Num_=te.d8Num_; j4Num_=te.j4Num_; return *this;};
341  inline virtual QString className() const {return "SgDbhServiceRecordTe";};
342 };
343 /*=====================================================================================================*/
344 
345 
346 
347 
348 
349 
350 /***===================================================================================================*/
357 {
358 protected:
359  short tcNo_;
361  short pRest_[9];
362 public:
365  pRest_[0]=pRest_[1]=pRest_[2]=pRest_[3]=pRest_[4]=pRest_[5]=pRest_[6]=pRest_[7]=pRest_[8]=0;};
366  inline virtual ~SgDbhServiceRecordDr() {};
367  int getTcNo() const {return tcNo_-1;};
368  int getNumOfTeBlocks() const {return numOfTeBlocks_;};
369  void setTcNo(int no) {tcNo_ = (short)(no+1);};
370  void setNumOfTeBlocks(int num) {numOfTeBlocks_ = (short)num;};
371  virtual int readLR(SgDbhStream& s);
372  virtual int writeLR(SgDbhStream& s) const;
373  void dump(QTextStream& s) const;
374  inline virtual QString className() const {return "SgDbhServiceRecordDr";};
375 };
376 /*=====================================================================================================*/
377 
378 
379 
380 
381 
382 
383 /***===================================================================================================*/
390 {
391 protected:
392  short teNo_;
393  short numOfR8_;
394  short numOfI2_;
395  short numOfA2_;
396  short numOfD8_;
397  short numOfJ4_;
399  bool isZ3_;
400  short pRest_[2];
401 public:
404  pRest_[0]=pRest_[1]=0; isZ3_=false;};
405  inline virtual ~SgDbhServiceRecordDe() {};
406  int getTeNo() const {return teNo_-1;};
407  int getNumOfR8() const {return numOfR8_;};
408  int getNumOfI2() const {return numOfI2_;};
409  int getNumOfA2() const {return numOfA2_;};
410  int getNumOfD8() const {return numOfD8_;};
411  int getNumOfJ4() const {return numOfJ4_;};
412  int getNumOfPhRecs () const {return numOfPhRecs_;};
413  void setTeNo(int no) {teNo_=(short)(no+1);};
414  void setNumOfR8(int num) {numOfR8_=(short)num;};
415  void setNumOfI2(int num) {numOfI2_=(short)num;};
416  void setNumOfA2(int num) {numOfA2_=(short)num;};
417  void setNumOfD8(int num) {numOfD8_=(short)num;};
418  void setNumOfJ4(int num) {numOfJ4_=(short)num;};
419  void setNumOfPhRecs(int num) {numOfPhRecs_=(short)num;};
420  virtual bool isAltered() const {return prefix_[0]=='Z' && prefix_[1]=='Z';};
421  bool isZ3() const {return isZ3_;};
422  virtual int readLR(SgDbhStream&);
423  virtual int writeLR(SgDbhStream& s) const;
424  void dump(QTextStream& s) const;
428  numOfPhRecs_=de.numOfPhRecs_; pRest_[0]=de.pRest_[0]; pRest_[1]=de.pRest_[1]; return *this;};
429  inline virtual QString className() const {return "SgDbhServiceRecordDe";};
430 };
431 /*=====================================================================================================*/
432 
433 
434 
435 
436 
437 
438 /***===================================================================================================*/
445 {
446 protected:
454  bool isOK_;
455  short epoch_[5];
456 public:
457  SgDbhStartBlock();
458  inline ~SgDbhStartBlock() {};
459  bool isOk() const {return isOK_;};
460  SgMJD epoch() const {return SgMJD(epoch_[0], 1, epoch_[1], epoch_[2], epoch_[3], epoch_[4]);};
461  int version() const {return versionRec_.at(0);};
462  const QString& dbName() const {return dbNameRec_.getText();};
463  const QString& expDescript() const {return expDescriptRec_.getText();};
464  const QString& sessionID() const {return sessIDRec_.getText();};
465  const QString& prevDb() const {return prevDbRec_.getText();};
466  const QString& prevDescript() const {return prevRec_.getText();};
467  void rotateVersion(int newVersion, const QString& newFileName);
468  void dump(QTextStream&) const;
469  inline QString className() const {return "SgDbhStartBlock";};
470  void alternateCode(const QString&);
473 };
474 /*=====================================================================================================*/
475 
476 
477 
478 
479 
480 
481 /***===================================================================================================*/
488 {
489 protected:
493  bool isOK_;
494 public:
495  inline SgDbhHistoryEntry() : record1_(), record2_(), record3_() {isOK_=true;};
496  inline ~SgDbhHistoryEntry() {};
497  bool isOk() const {return isOK_;};
498  bool isHistoryLine() const {return record1_.isCorrectPrefix();};
499  bool isLast() const {return record1_.isZ1();};
500  void dump(QTextStream& s) const;
501 
502  const QString& getText() {return record3_.getText();};
504  SgMJD getEpoch() const {return record1_.getHistoryEpoch();};
505 
506  void setText(const QString& text);
507  void setVersion(int version) {record1_.setVersionNumber(version);};
508  void setEpoch(const SgMJD &t) {record1_.setHistoryEpoch(t);};
509  void unsetOkFlag() {isOK_=false;};
510  void setEvent(const QString&, const QString&, int, const SgMJD&);
511  inline QString className() const {return "SgDbhHistoryEntry";};
512 
515 };
516 /*=====================================================================================================*/
517 
518 
519 
520 
521 
522 
523 /*=======================================================================================================
524 *
525 * List of descriptors, one per a TE block:
526 *
527 *======================================================================================================*/
529 {
530 public:
531  //
532  // constructors/destructors:
533  //
536  {while (!listOfDescriptors_.isEmpty()) delete listOfDescriptors_.takeFirst();};
537  //
538  // Interfaces:
539  //
541  //
542  // Functions:
543  //
544  void dump(QTextStream&) const;
546  inline QString className() const {return "SgDbhListOfDescriptors";};
547  //
548 protected:
550 };
551 /*=====================================================================================================*/
552 
553 
554 
555 
556 
557 
558 /*=======================================================================================================
559 *
560 * A collection of data records, one per TE block:
561 *
562 *======================================================================================================*/
564 {
565 public:
566  //
567  // constructors/destructors:
568  //
570  ~SgDbhDataBlock();
571  //
572  // Interfaces:
573  //
575  inline QHash<int, SgDbhPhysicalRecord*> *recordByType() {return &recordByType_;};
576  //
577  // Functions:
578  //
580  inline QString className() const {return "SgDbhDataBlock";};
581  //
582 protected:
584  QHash<int, SgDbhPhysicalRecord*> recordByType_;
585 };
586 /*=====================================================================================================*/
587 
588 
589 
590 
591 
592 
593 /*=======================================================================================================
594 *
595 * TE block of MK-III database format:
596 *
597 *======================================================================================================*/
599 {
600  friend class SgDbhFormat;
601 public:
602  //
603  // constructors/destructors:
604  //
605  inline SgDbhTeBlock() :
607  recTe_(), recP3_(this), recP4_(this)
608  {isOK_=true; isFormatModified_=false;};
609  inline ~SgDbhTeBlock() {};
610  //
611  // Interfaces:
612  //
613  bool isOk() const {return isOK_;};
614  bool isFormatModified() const {return isFormatModified_;};
616  const SgDbhServiceRecordTe& recTe() {return recTe_;};
617  //
618  // Functions:
619  //
622  int writeRecordP3(SgDbhStream&) const;
623  int writeRecordP4(SgDbhStream&) const;
624  void dump(QTextStream&) const;
627  void adjustServiceRecords();
628  inline QString className() const {return "SgDbhTeBlock";};
629  int calcDataSize() const;
630  //
631  // Friends:
632  //
634  friend SgDbhStream &operator<<(SgDbhStream& s, const SgDbhTeBlock& B);
635  //
636 protected:
638  {
639  public:
641  inline SgDbhServiceRecordP3(SgDbhTeBlock* owner){owner_=owner;};
642  inline virtual ~SgDbhServiceRecordP3() {owner_=NULL;};
643  inline virtual int readLR(SgDbhStream& s){return owner_->readRecordP3(s);};
644  inline virtual int writeLR(SgDbhStream& s) const {return owner_->writeRecordP3(s);};
645  };
647  {
648  public:
650  inline SgDbhServiceRecordP4(SgDbhTeBlock* owner){owner_=owner;};
651  inline virtual ~SgDbhServiceRecordP4() {owner_=NULL;};
652  inline virtual int readLR(SgDbhStream& s){return owner_->readRecordP4(s);};
653  inline virtual int writeLR(SgDbhStream& s) const {return owner_->writeRecordP4(s);};
654  };
658  bool isOK_;
660 };
661 /*=====================================================================================================*/
662 
663 
664 
665 
666 
667 
668 /*=======================================================================================================
669 *
670 * TC block of MK-III database format:
671 *
672 *======================================================================================================*/
674 {
675  friend class SgDbhFormat;
676 public:
677  //
678  // constructors/destructors:
679  //
681  ~SgDbhTcBlock();
682  //
683  // Interfaces:
684  //
686  inline QHash<QString, SgDbhDatumDescriptor*> *descriptorByLCode() {return &descriptorByLCode_;};
687  inline const SgDbhServiceRecordTc& recTc() const {return recTc_;};
688  inline bool isOk() const {return isOK_;};
689  //
690  // Functions:
691  //
692  inline bool isLast() const {return recTc_.isZ2();};
693  inline short numTeBlocks() const {return recTc_.numTeBlocks();};
694  inline short tocType() const {return recTc_.tocType();};
695  void dump(QTextStream& s) const;
697  inline QString className() const {return "SgDbhTcBlock";};
698  //
699  // Friends:
700  //
703  //
704 protected:
705  bool isOK_;
708  QHash<QString, SgDbhDatumDescriptor*> descriptorByLCode_;
709 };
710 /*=====================================================================================================*/
711 
712 
713 
714 
715 
716 
717 /*=======================================================================================================
718 *
719 * A list of data blocks that represent one observation (several TOCs):
720 *
721 *======================================================================================================*/
723 {
724 public:
725  //
726  // constructors/destructors:
727  //
730  //
731  // Interfaces:
732  //
735  {return listOfTcsData_.at(tocNumber-1);};
736  //
737  // Functions:
738  //
739  void saveDataBlocksFromTcBlock(int TocNumber, SgDbhTcBlock& tcBlock);
740  inline QString className() const {return "SgDbhObservationEntry";};
741  //
742 protected:
744 };
745 /*=====================================================================================================*/
746 
747 
748 
749 
750 
751 
752 /***===================================================================================================*/
759 {
760 public:
761  //
762  // constructors/destructors:
763  //
766  inline SgDbhFormat();
767 
771  inline ~SgDbhFormat();
772 
773 
774  //
775  // Interfaces:
776  //
778 
779  inline bool isOk() const {return isOK_;};
780 
781  inline short currentTcNumber() {return currentTcNumber_;};
782 
783  inline void setDumpStream(QTextStream* s) {dumpStream_ = s;};
784 
785  inline QTextStream* getDumpStream() {return dumpStream_;};
786 
787 
788  //
789  // Functions:
790  //
791  void postRead();
792 
793  void dump(QTextStream& s);
794 
795  void getBlock(SgDbhStream&);
796 
798  {return currentTcNumber_>-1?listOfTcBlocks_.at(currentTcNumber_):NULL;};
799 
801 
803 
804  inline short i2(SgDbhDatumDescriptor *d, int i, int j, int k)
805  {return d ? ((SgDbhDataRecord<short>*)properRecord(d))->value(d, i,j,k) : (short)0;};
806 
807  inline double r8(SgDbhDatumDescriptor *d, int i, int j, int k)
808  {return d ? ((SgDbhDataRecord<double>*)properRecord(d))->value(d, i,j,k) : 0.0;};
809 
810  inline double d8(SgDbhDatumDescriptor *d, int i, int j, int k)
811  {return d ? ((SgDbhDataRecord<double>*)properRecord(d))->value(d, i,j,k) : 0.0;};
812 
813  inline int j4(SgDbhDatumDescriptor *d, int i, int j, int k)
814  {return d ? ((SgDbhDataRecord<int>*)properRecord(d))->value(d, i,j,k) : 0;};
815 
816  inline QString str(SgDbhDatumDescriptor *d, int i, int j)
817  {return d ? ((SgDbhDataRecordString*)properRecord(d))->getValue(d, i,j) : QString("UNPARSED");};
818 
819  inline QString className() const {return "SgDbhFormat";};
820 
821 
822  //
823  // Friends:
824  //
826  friend SgDbhStream &operator<<(SgDbhStream&, const SgDbhFormat&);
827 
828 
829  //
830  // I/O:
831  //
832  // ...
833 
834 private:
835 
836 protected:
838  QTextStream *dumpStream_;
839  bool isOK_;
841 };
842 /*=====================================================================================================*/
843 
844 
845 
846 
847 
848 
849 /*=====================================================================================================*/
850 /* */
851 /* SgDbhFormat inline members: */
852 /* */
853 /*=====================================================================================================*/
854 //
855 //
856 // CONSTRUCTORS:
857 //
859  listOfTcBlocks_()
860 {
861  currentTcNumber_ = -1;
862  dumpStream_ = NULL;
863  isOK_ = true;
864 };
865 
866 
867 
868 //
870 {
871  while (!listOfTcBlocks_.isEmpty())
872  delete listOfTcBlocks_.takeFirst();
873  dumpStream_ = NULL;
874  isOK_ = true;
875  currentTcNumber_ = -1;
876 };
877 
878 
879 
880 //
881 // FUNCTIONS:
882 //
883 //
884 inline void SgDbhFormat::dump(QTextStream& s)
885 {
886  s << "== Format Block dump: ==\n";
887  for(int i=0; i<listOfTcBlocks_.size(); i++)
888  listOfTcBlocks_.at(i)->dump(s);
889  s << "== End of dump ==\n";
890 };
891 
892 
893 
894 
895 //
896 // FRIENDS:
897 //
898 //
899 //
900 
901 /*=====================================================================================================*/
902 
903 
904 
905 
906 
907 /*=====================================================================================================*/
908 //
909 // aux functions:
910 //
911 
912 
913 /*=====================================================================================================*/
914 #endif //SG_DBHFORMAT_H
QHash< int, SgDbhPhysicalRecord * > * recordByType()
Definition: SgDbhFormat.h:575
QList< SgDbhPhysicalRecord * > * listOfRecords()
Definition: SgDbhFormat.h:574
QList< SgDbhPhysicalRecord * > listOfRecords_
Definition: SgDbhFormat.h:580
QHash< int, SgDbhPhysicalRecord * > recordByType_
Definition: SgDbhFormat.h:584
QString className() const
Definition: SgDbhFormat.h:580
SgDbhDataBlock & operator=(const SgDbhDataBlock &)
virtual SgDbhDataRecordString & operator=(const SgDbhDataRecordString &rec)
void setText(const QString &text)
const QString & getText() const
Definition: SgDbhFormat.h:115
SgDbhDataRecordString(const SgDbhDataRecordString &rec)
Definition: SgDbhFormat.h:112
virtual int readLR(SgDbhStream &s)
static const QString className()
virtual QString getValue(SgDbhDatumDescriptor *, int dim2, int dim3)
virtual ~SgDbhDataRecordString()
void setValue(SgDbhDatumDescriptor *, int dim2, int dim3, const QString &)
virtual C & access(SgDbhDatumDescriptor *descriptor, int d1, int d2, int d3)
virtual char * base()
virtual C at(int i) const
virtual int readLR(SgDbhStream &s)
int num() const
Definition: SgDbhFormat.h:150
virtual C & operator[](int i)
virtual void reSize(int length)
virtual QString className() const
virtual SgDbhDataRecord< C > & operator=(const SgDbhDataRecord< C > &rec)
virtual C value(SgDbhDatumDescriptor *descriptor, int d1, int d2, int d3)
virtual int writeLR(SgDbhStream &s) const
QTextStream * getDumpStream()
Definition: SgDbhFormat.h:785
short currentTcNumber()
Definition: SgDbhFormat.h:781
void setDumpStream(QTextStream *s)
Definition: SgDbhFormat.h:783
QTextStream * dumpStream_
Definition: SgDbhFormat.h:838
SgDbhTcBlock * currentTcBlock()
Definition: SgDbhFormat.h:797
friend SgDbhStream & operator<<(SgDbhStream &, const SgDbhFormat &)
SgDbhPhysicalRecord * properRecord(SgDbhDatumDescriptor *)
bool isOk() const
Definition: SgDbhFormat.h:779
double r8(SgDbhDatumDescriptor *d, int i, int j, int k)
Definition: SgDbhFormat.h:807
short i2(SgDbhDatumDescriptor *d, int i, int j, int k)
Definition: SgDbhFormat.h:804
friend SgDbhStream & operator>>(SgDbhStream &, SgDbhFormat &)
QString className() const
Definition: SgDbhFormat.h:819
QList< SgDbhTcBlock * > * listOfTcBlocks()
Definition: SgDbhFormat.h:777
void dump(QTextStream &s)
Definition: SgDbhFormat.h:884
SgDbhDatumDescriptor * lookupDescriptor(const char *)
short currentTcNumber_
Definition: SgDbhFormat.h:840
QString str(SgDbhDatumDescriptor *d, int i, int j)
Definition: SgDbhFormat.h:816
void getBlock(SgDbhStream &)
int j4(SgDbhDatumDescriptor *d, int i, int j, int k)
Definition: SgDbhFormat.h:813
QList< SgDbhTcBlock * > listOfTcBlocks_
Definition: SgDbhFormat.h:837
double d8(SgDbhDatumDescriptor *d, int i, int j, int k)
Definition: SgDbhFormat.h:810
void setEvent(const QString &, const QString &, int, const SgMJD &)
QString className() const
Definition: SgDbhFormat.h:511
friend SgDbhStream & operator>>(SgDbhStream &, SgDbhHistoryEntry &)
SgDbhDataRecordString record3_
Definition: SgDbhFormat.h:492
friend SgDbhStream & operator<<(SgDbhStream &, const SgDbhHistoryEntry &)
bool isOk() const
Definition: SgDbhFormat.h:497
void setEpoch(const SgMJD &t)
Definition: SgDbhFormat.h:508
SgDbhServiceRecordHS2 record2_
Definition: SgDbhFormat.h:491
void dump(QTextStream &s) const
bool isHistoryLine() const
Definition: SgDbhFormat.h:498
void setText(const QString &text)
bool isLast() const
Definition: SgDbhFormat.h:499
SgMJD getEpoch() const
Definition: SgDbhFormat.h:504
void setVersion(int version)
Definition: SgDbhFormat.h:507
SgDbhServiceRecordHS1 record1_
Definition: SgDbhFormat.h:490
const QString & getText()
Definition: SgDbhFormat.h:502
SgDbhListOfDescriptors & operator=(const SgDbhListOfDescriptors &)
QList< SgDbhDatumDescriptor * > listOfDescriptors_
Definition: SgDbhFormat.h:546
QList< SgDbhDatumDescriptor * > * listOfDescriptors()
Definition: SgDbhFormat.h:540
void dump(QTextStream &) const
QString className() const
Definition: SgDbhFormat.h:546
void saveDataBlocksFromTcBlock(int TocNumber, SgDbhTcBlock &tcBlock)
QString className() const
Definition: SgDbhFormat.h:740
QList< QList< SgDbhDataBlock * > * > & listOfTcsData()
Definition: SgDbhFormat.h:733
QList< SgDbhDataBlock * > * dataBlocksFromTocI(int tocNumber) const
Definition: SgDbhFormat.h:734
QList< QList< SgDbhDataBlock * > * > listOfTcsData_
Definition: SgDbhFormat.h:740
int length() const
Definition: SgDbhFormat.h:70
virtual char * base()
Definition: SgDbhFormat.h:78
friend SgDbhStream & operator<<(SgDbhStream &, const SgDbhPhysicalRecord &)
virtual int readLR(SgDbhStream &s)
static const QString className()
Definition: SgDbhFormat.cpp:43
virtual int writeLR(SgDbhStream &s) const
friend SgDbhStream & operator>>(SgDbhStream &, SgDbhPhysicalRecord &)
virtual SgDbhPhysicalRecord & operator=(const SgDbhPhysicalRecord &)
Definition: SgDbhFormat.cpp:71
virtual void reSize(int length)
Definition: SgDbhFormat.cpp:90
bool isOk() const
Definition: SgDbhFormat.h:69
virtual ~SgDbhPhysicalRecord()
Definition: SgDbhFormat.cpp:61
void setNumOfD8(int num)
Definition: SgDbhFormat.h:417
int getNumOfI2() const
Definition: SgDbhFormat.h:408
bool isZ3() const
Definition: SgDbhFormat.h:421
void dump(QTextStream &s) const
void setNumOfR8(int num)
Definition: SgDbhFormat.h:414
int getNumOfA2() const
Definition: SgDbhFormat.h:409
void setNumOfJ4(int num)
Definition: SgDbhFormat.h:418
virtual ~SgDbhServiceRecordDe()
Definition: SgDbhFormat.h:405
virtual int writeLR(SgDbhStream &s) const
void setNumOfI2(int num)
Definition: SgDbhFormat.h:415
virtual int readLR(SgDbhStream &)
virtual QString className() const
Definition: SgDbhFormat.h:429
int getNumOfD8() const
Definition: SgDbhFormat.h:410
void setTeNo(int no)
Definition: SgDbhFormat.h:413
virtual bool isAltered() const
Definition: SgDbhFormat.h:420
int getNumOfPhRecs() const
Definition: SgDbhFormat.h:412
int getNumOfJ4() const
Definition: SgDbhFormat.h:411
void setNumOfPhRecs(int num)
Definition: SgDbhFormat.h:419
int getNumOfR8() const
Definition: SgDbhFormat.h:407
SgDbhServiceRecordDe & operator=(const SgDbhServiceRecordDe &de)
Definition: SgDbhFormat.h:425
int getTeNo() const
Definition: SgDbhFormat.h:406
void setNumOfA2(int num)
Definition: SgDbhFormat.h:416
virtual int readLR(SgDbhStream &s)
virtual QString className() const
Definition: SgDbhFormat.h:374
virtual int writeLR(SgDbhStream &s) const
int getNumOfTeBlocks() const
Definition: SgDbhFormat.h:368
virtual ~SgDbhServiceRecordDr()
Definition: SgDbhFormat.h:366
void setTcNo(int no)
Definition: SgDbhFormat.h:369
int getTcNo() const
Definition: SgDbhFormat.h:367
void dump(QTextStream &s) const
void setNumOfTeBlocks(int num)
Definition: SgDbhFormat.h:370
void setLengthOfHistoryString(int length)
Definition: SgDbhFormat.h:223
int getLengthOfHistoryString() const
Definition: SgDbhFormat.h:219
SgMJD getHistoryEpoch() const
Definition: SgDbhFormat.h:221
virtual QString className() const
Definition: SgDbhFormat.h:232
int getVersionNumber() const
Definition: SgDbhFormat.h:220
virtual bool isAltered() const
Definition: SgDbhFormat.h:229
void setVersionNumber(int number)
Definition: SgDbhFormat.h:224
virtual int writeLR(SgDbhStream &s) const
virtual ~SgDbhServiceRecordHS1()
Definition: SgDbhFormat.h:217
void setHistoryEpoch(const SgMJD &)
virtual int readLR(SgDbhStream &s)
virtual int readLR(SgDbhStream &s)
virtual QString className() const
Definition: SgDbhFormat.h:261
virtual ~SgDbhServiceRecordHS2()
Definition: SgDbhFormat.h:257
virtual int writeLR(SgDbhStream &s) const
void setSemiName(const QString &)
virtual bool isAltered() const
Definition: SgDbhFormat.h:294
virtual QString className() const
Definition: SgDbhFormat.h:303
virtual int writeLR(SgDbhStream &s) const
virtual int readLR(SgDbhStream &)
void dump(QTextStream &s) const
short numTeBlocks() const
Definition: SgDbhFormat.h:292
virtual ~SgDbhServiceRecordTc()
Definition: SgDbhFormat.h:290
short tocType() const
Definition: SgDbhFormat.h:293
SgDbhServiceRecordTc & operator=(const SgDbhServiceRecordTc &tc)
Definition: SgDbhFormat.h:298
bool isZ2() const
Definition: SgDbhFormat.h:291
virtual ~SgDbhServiceRecordTe()
Definition: SgDbhFormat.h:327
virtual QString className() const
Definition: SgDbhFormat.h:341
void dump(QTextStream &s) const
SgDbhServiceRecordTe & operator=(const SgDbhServiceRecordTe &te)
Definition: SgDbhFormat.h:336
virtual int writeLR(SgDbhStream &s) const
virtual int readLR(SgDbhStream &)
virtual int writeLR(SgDbhStream &s) const
Definition: SgDbhFormat.h:191
SgDbhServiceRecord & operator=(const SgDbhServiceRecord &sr)
Definition: SgDbhFormat.h:185
char expectedPrefix_[3]
Definition: SgDbhFormat.h:196
bool isCorrectPrefix() const
Definition: SgDbhFormat.h:179
SgDbhServiceRecord(const char expectedPrefix[2])
Definition: SgDbhFormat.h:174
void setPrefix(const char prefix[2])
Definition: SgDbhFormat.h:183
SgDbhServiceRecord(const SgDbhServiceRecord &sr)
Definition: SgDbhFormat.h:177
virtual ~SgDbhServiceRecord()
Definition: SgDbhFormat.h:178
virtual bool isAltered() const
Definition: SgDbhFormat.h:181
bool isPrefixParsed(SgDbhStream &)
virtual QString className() const
Definition: SgDbhFormat.h:193
virtual int readLR(SgDbhStream &s)
Definition: SgDbhFormat.h:189
void rotateVersion(int newVersion, const QString &newFileName)
SgDbhDataRecord< short > epochRec_
Definition: SgDbhFormat.h:452
friend SgDbhStream & operator<<(SgDbhStream &, const SgDbhStartBlock &)
const QString & prevDescript() const
Definition: SgDbhFormat.h:466
const QString & prevDb() const
Definition: SgDbhFormat.h:465
void dump(QTextStream &) const
void alternateCode(const QString &)
SgDbhDataRecord< short > versionRec_
Definition: SgDbhFormat.h:453
SgDbhDataRecordString prevDbRec_
Definition: SgDbhFormat.h:450
SgDbhDataRecordString expDescriptRec_
Definition: SgDbhFormat.h:448
SgDbhDataRecordString prevRec_
Definition: SgDbhFormat.h:451
bool isOk() const
Definition: SgDbhFormat.h:459
const QString & expDescript() const
Definition: SgDbhFormat.h:463
short epoch_[5]
Definition: SgDbhFormat.h:455
int version() const
Definition: SgDbhFormat.h:461
const QString & dbName() const
Definition: SgDbhFormat.h:462
friend SgDbhStream & operator>>(SgDbhStream &, SgDbhStartBlock &)
const QString & sessionID() const
Definition: SgDbhFormat.h:464
QString className() const
Definition: SgDbhFormat.h:469
SgDbhDataRecordString dbNameRec_
Definition: SgDbhFormat.h:447
SgMJD epoch() const
Definition: SgDbhFormat.h:460
SgDbhDataRecordString sessIDRec_
Definition: SgDbhFormat.h:449
short numTeBlocks() const
Definition: SgDbhFormat.h:693
bool isLast() const
Definition: SgDbhFormat.h:692
QList< SgDbhTeBlock * > * listOfTeBlocks()
Definition: SgDbhFormat.h:685
QHash< QString, SgDbhDatumDescriptor * > * descriptorByLCode()
Definition: SgDbhFormat.h:686
QList< SgDbhTeBlock * > listOfTeBlocks_
Definition: SgDbhFormat.h:707
friend SgDbhStream & operator>>(SgDbhStream &, SgDbhTcBlock &)
bool isOk() const
Definition: SgDbhFormat.h:688
SgDbhServiceRecordTc recTc_
Definition: SgDbhFormat.h:706
friend SgDbhStream & operator<<(SgDbhStream &, const SgDbhTcBlock &)
QHash< QString, SgDbhDatumDescriptor * > descriptorByLCode_
Definition: SgDbhFormat.h:708
void dump(QTextStream &s) const
QString className() const
Definition: SgDbhFormat.h:697
const SgDbhServiceRecordTc & recTc() const
Definition: SgDbhFormat.h:687
short tocType() const
Definition: SgDbhFormat.h:694
SgDbhTcBlock & operator=(const SgDbhTcBlock &)
SgDbhServiceRecordP3(SgDbhTeBlock *owner)
Definition: SgDbhFormat.h:641
virtual int readLR(SgDbhStream &s)
Definition: SgDbhFormat.h:643
virtual int writeLR(SgDbhStream &s) const
Definition: SgDbhFormat.h:644
virtual int readLR(SgDbhStream &s)
Definition: SgDbhFormat.h:652
SgDbhServiceRecordP4(SgDbhTeBlock *owner)
Definition: SgDbhFormat.h:650
virtual int writeLR(SgDbhStream &s) const
Definition: SgDbhFormat.h:653
int readRecordP3(SgDbhStream &)
const SgDbhServiceRecordTe & recTe()
Definition: SgDbhFormat.h:616
SgDbhServiceRecordP3 recP3_
Definition: SgDbhFormat.h:656
int writeRecordP3(SgDbhStream &) const
friend SgDbhStream & operator>>(SgDbhStream &s, SgDbhTeBlock &B)
SgDbhServiceRecordP4 recP4_
Definition: SgDbhFormat.h:657
void setIsFormatModified(bool Is)
Definition: SgDbhFormat.h:615
QString className() const
Definition: SgDbhFormat.h:628
bool isFormatModified_
Definition: SgDbhFormat.h:659
int readRecordP4(SgDbhStream &)
void adjustServiceRecords()
bool isFormatModified() const
Definition: SgDbhFormat.h:614
void dump(QTextStream &) const
SgDbhTeBlock & operator=(const SgDbhTeBlock &)
bool isOk() const
Definition: SgDbhFormat.h:613
int writeRecordP4(SgDbhStream &) const
int calcDataSize() const
int calculateNumOfData(SgDbhDatumDescriptor::Type type) const
friend SgDbhStream & operator<<(SgDbhStream &s, const SgDbhTeBlock &B)
SgDbhServiceRecordTe recTe_
Definition: SgDbhFormat.h:655
Definition: SgMJD.h:59