LCOV - code coverage report
Current view: top level - frmts/envisat - adsrange.hpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 0 12 0.0 %
Date: 2025-01-18 12:42:00 Functions: 0 5 0.0 %

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

Generated by: LCOV version 1.14