Line data Source code
1 : /****************************************************************************** 2 : * $Id$ 3 : * 4 : * Project: APP ENVISAT Support 5 : * Purpose: Detect range of ADS records matching the MDS records 6 : * Author: Martin Paces, martin.paces@eox.at 7 : * 8 : ****************************************************************************** 9 : * Copyright (c) 2013, EOX IT Services, GmbH 10 : * 11 : * SPDX-License-Identifier: MIT 12 : *****************************************************************************/ 13 : 14 : #ifndef adsrange_hpp 15 : #define adsrange_hpp 16 : 17 : #include "cpl_string.h" 18 : 19 : CPL_C_START 20 : #include "EnvisatFile.h" 21 : CPL_C_END 22 : #include "records.h" 23 : 24 : #include "timedelta.hpp" 25 : 26 : /* -------------------------------------------------------------------- */ 27 : /* 28 : * class ADSRange 29 : * 30 : * Range of ADS record matching the range of the MDS records. 31 : * 32 : */ 33 : 34 : class ADSRange 35 : { 36 : protected: 37 : int idx_first; /* index of the first matched ADSR */ 38 : int idx_last; /* index of the last matched ADSR */ 39 : int off_first; /* num. of lines from 1st matched ADSR to 1st MDSR */ 40 : int off_last; /* num. of lines from last MDSR to last matched ADSR*/ 41 : 42 : TimeDelta mjd_first; /* MDJ time of the first matched ADS record */ 43 : TimeDelta mjd_last; /* MDJ time of the last matched ADS record */ 44 : TimeDelta mjd_m_first; /* MDJ time of the first MDS record */ 45 : TimeDelta mjd_m_last; /* MDJ time of the last MDS record */ 46 : 47 : public: 48 : /* CONSTRUCTOR */ 49 0 : ADSRange() 50 0 : : idx_first(0), idx_last(0), off_first(0), off_last(0), mjd_first(0), 51 0 : mjd_last(0), mjd_m_first(0), mjd_m_last(0) 52 : { 53 0 : } 54 : 55 : ADSRange(const int idx_firstIn, const int idx_lastIn, const int off_firstIn, 56 : const int off_lastIn, const TimeDelta &mjd_firstIn, 57 : const TimeDelta &mjd_lastIn, const TimeDelta &mjd_m_firstIn, 58 : const TimeDelta &mjd_m_lastIn) 59 : : idx_first(idx_firstIn), idx_last(idx_lastIn), off_first(off_firstIn), 60 : off_last(off_lastIn), mjd_first(mjd_firstIn), mjd_last(mjd_lastIn), 61 : mjd_m_first(mjd_m_firstIn), mjd_m_last(mjd_m_lastIn) 62 : { 63 : } 64 : 65 : /* get count of matched records */ 66 0 : inline int getDSRCount(void) const 67 : { 68 0 : return (idx_last - idx_first + 1); 69 : } 70 : 71 : /* GETTERS */ 72 : 73 : /* get index of the first matched ADS record */ 74 0 : inline int getFirstIndex(void) const 75 : { 76 0 : return this->idx_first; 77 : } 78 : 79 : /* get index of the last matched ADS record */ 80 : inline int getLastIndex(void) const 81 : { 82 : return this->idx_last; 83 : } 84 : 85 : /* get offset of the first matched ADS record */ 86 0 : inline int getFirstOffset(void) const 87 : { 88 0 : return this->off_first; 89 : } 90 : 91 : /* get offset of the last matched ADS record */ 92 0 : inline int getLastOffset(void) const 93 : { 94 0 : return this->off_last; 95 : } 96 : 97 : /* get MJD time of the first matched ADS record */ 98 : inline TimeDelta getFirstTime(void) const 99 : { 100 : return this->mjd_first; 101 : } 102 : 103 : /* get MJD time of the last matched ADS record */ 104 : inline TimeDelta getLastTime(void) const 105 : { 106 : return this->mjd_last; 107 : } 108 : 109 : /* get MJD time of the first MDS record */ 110 : inline TimeDelta getMDSRFirstTime(void) const 111 : { 112 : return this->mjd_m_first; 113 : } 114 : 115 : /* get MJD time of the last MDS record */ 116 : inline TimeDelta getMDSRLastTime(void) const 117 : { 118 : return this->mjd_m_last; 119 : } 120 : }; 121 : 122 : /* -------------------------------------------------------------------- */ 123 : /* 124 : * NOTE: There are two kinds of ADS records: 125 : * 126 : * 1) One ADS record applicable to all consequent MDS records until replaced 127 : * by another ADS record, i.e., last MDS records does no need to be 128 : * followed by an ADS record. 129 : * 130 : * 2) Two ADS records applicable to all MDS records between them 131 : * (e.g., tiepoints ADS), i.e., last MDS record should be followed 132 : * by an ADS record having the same or later time-stamp. 133 : * 134 : * The type of the ADS affects the way how the ADS records corresponding 135 : * to a set of MDS records should be selected. 136 : */ 137 : 138 : class ADSRangeLastAfter : public ADSRange 139 : { 140 : 141 : public: 142 : /* CONSTRUCTOR */ 143 : ADSRangeLastAfter(EnvisatFile &envfile, int ads_idx, int mds_idx, 144 : const TimeDelta &line_interval); 145 : }; 146 : 147 : #endif /*tiepointrange_hpp*/