LCOV - code coverage report
Current view: top level - frmts/hdf4 - hdf4dataset.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 2 2 100.0 %
Date: 2024-04-29 01:40:10 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  * $Id$
       3             :  *
       4             :  * Project:  Hierarchical Data Format Release 4 (HDF4)
       5             :  * Purpose:  Header file for HDF4 datasets reader.
       6             :  * Author:   Andrey Kiselev, dron@ak4719.spb.edu
       7             :  *
       8             :  ******************************************************************************
       9             :  * Copyright (c) 2002, Andrey Kiselev <dron@ak4719.spb.edu>
      10             :  *
      11             :  * Permission is hereby granted, free of charge, to any person obtaining a
      12             :  * copy of this software and associated documentation files (the "Software"),
      13             :  * to deal in the Software without restriction, including without limitation
      14             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15             :  * and/or sell copies of the Software, and to permit persons to whom the
      16             :  * Software is furnished to do so, subject to the following conditions:
      17             :  *
      18             :  * The above copyright notice and this permission notice shall be included
      19             :  * in all copies or substantial portions of the Software.
      20             :  *
      21             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      22             :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      24             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      27             :  * DEALINGS IN THE SOFTWARE.
      28             :  ****************************************************************************/
      29             : 
      30             : #ifndef HDF4DATASET_H_INCLUDED_
      31             : #define HDF4DATASET_H_INCLUDED_
      32             : 
      33             : #include "hdf.h"
      34             : #include "mfhdf.h"
      35             : 
      36             : #include "cpl_list.h"
      37             : #include "gdal_pam.h"
      38             : 
      39             : typedef enum  // Types of dataset:
      40             : {
      41             :     HDF4_SDS,  // Scientific Dataset
      42             :     HDF4_GR,   // General Raster Image
      43             :     HDF4_EOS,  // HDF EOS
      44             :     HDF4_UNKNOWN
      45             : } HDF4DatasetType;
      46             : 
      47             : typedef enum  // Types of data products:
      48             : {
      49             :     H4ST_GDAL,            // HDF written by GDAL
      50             :     H4ST_EOS_GRID,        // HDF-EOS Grid
      51             :     H4ST_EOS_SWATH,       // HDF-EOS Swath
      52             :     H4ST_EOS_SWATH_GEOL,  // HDF-EOS Swath Geolocation Array
      53             :     H4ST_SEAWIFS_L1A,     // SeaWiFS Level-1A Data
      54             :     H4ST_SEAWIFS_L2,      // SeaWiFS Level-2 Data
      55             :     H4ST_SEAWIFS_L3,      // SeaWiFS Level-3 Standard Mapped Image
      56             :     H4ST_HYPERION_L1,     // Hyperion L1 Data Product
      57             :     H4ST_UNKNOWN
      58             : } HDF4SubdatasetType;
      59             : 
      60             : /************************************************************************/
      61             : /* ==================================================================== */
      62             : /*                              HDF4Dataset                             */
      63             : /* ==================================================================== */
      64             : /************************************************************************/
      65             : 
      66             : class HDF4Dataset CPL_NON_FINAL : public GDALPamDataset
      67             : {
      68             : 
      69             :   private:
      70             :     bool bIsHDFEOS;
      71             :     std::shared_ptr<GDALGroup> m_poRootGroup{};
      72             : 
      73             :     static char **HDF4EOSTokenizeAttrs(const char *pszString);
      74             :     static char **HDF4EOSGetObject(char **papszAttrList, char **ppszAttrName,
      75             :                                    char **ppszAttrClass, char **ppszAttrValue);
      76             : 
      77             :     void OpenMultiDim(const char *pszFilename, CSLConstList papszOpenOptionsIn);
      78             : 
      79             :   protected:
      80             :     int32 hGR;
      81             :     int32 hSD;
      82             :     int32 nImages;
      83             :     HDF4SubdatasetType iSubdatasetType;
      84             :     const char *pszSubdatasetType;
      85             : 
      86             :     char **papszGlobalMetadata;
      87             :     char **papszSubDatasets;
      88             : 
      89             :     CPLErr ReadGlobalAttributes(int32);
      90             : 
      91             :   public:
      92             :     static GDALDataType GetDataType(int32);
      93             :     static const char *GetDataTypeName(int32);
      94             :     static int GetDataTypeSize(int32);
      95             :     static double AnyTypeToDouble(int32, void *);
      96             :     static char **TranslateHDF4Attributes(int32, int32, char *, int32, int32,
      97             :                                           char **);
      98             :     static char **TranslateHDF4EOSAttributes(int32, int32, int32, char **);
      99             : 
     100             :   public:
     101             :     HDF4Dataset();
     102             :     virtual ~HDF4Dataset();
     103             : 
     104           6 :     std::shared_ptr<GDALGroup> GetRootGroup() const override
     105             :     {
     106           6 :         return m_poRootGroup;
     107             :     }
     108             : 
     109             :     virtual char **GetMetadataDomainList() override;
     110             :     virtual char **GetMetadata(const char *pszDomain = "") override;
     111             :     static GDALDataset *Open(GDALOpenInfo *);
     112             : };
     113             : 
     114             : char *SPrintArray(GDALDataType eDataType, const void *paDataArray, int nValues,
     115             :                   const char *pszDelimiter);
     116             : 
     117             : #endif /* HDF4DATASET_H_INCLUDED_ */

Generated by: LCOV version 1.14