OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
HDF4_DDS.h
Go to the documentation of this file.
1 // This file is part of the hdf4 data handler for the OPeNDAP data server.
3 //
4 // Author: Kent Yang <myang6@hdfgroup.org>
5 // Copyright (c) 2010-2014 The HDF Group
6 // The idea is borrowed from GDAL OPeNDAP handler that is implemented by
7 // James Gallagher<jgallagher@opendap.org>
8 
9 #ifndef HDF4_DDS_H_
10 #define HDF4_DDS_H_
11 
12 #include "config.h"
13 
14 #include "hdf.h"
15 #include "mfhdf.h"
16 
17 #ifdef USE_HDFEOS2_LIB
18 #include "HdfEosDef.h"
19 #endif
20 
21 #include <DataDDS.h>
22 #include <InternalErr.h>
23 
24 using namespace libdap;
25 
40 class HDF4DDS : public DataDDS {
41 private:
42  int sdfd;
43  int fileid;
44  int gridfd;
45  int swathfd;
46 
47  void m_duplicate(const HDF4DDS &src)
48  {
49  sdfd = src.sdfd;
50  fileid = src.fileid;
51  gridfd = src.gridfd;
52  swathfd = src.swathfd;
53  }
54 
55 public:
56  HDF4DDS(DataDDS *ddsIn) : DataDDS(*ddsIn), sdfd(-1),fileid(-1),gridfd(-1),swathfd(-1) {}
57 
58  HDF4DDS(const HDF4DDS &rhs) : DataDDS(rhs) {
59  m_duplicate(rhs);
60  }
61 
62  HDF4DDS & operator= (const HDF4DDS &rhs) {
63  if (this == &rhs)
64  return *this;
65 
66  m_duplicate(rhs);
67 
68  return *this;
69  }
70 
72 
73  if (sdfd != -1)
74  SDend(sdfd);
75  if (fileid != -1)
76  Hclose(fileid);
77 
78 #ifdef USE_HDFEOS2_LIB
79  if (gridfd != -1)
80  GDclose(gridfd);
81  if (swathfd != -1)
82  SWclose(swathfd);
83 #endif
84  }
85 
86  void setHDF4Dataset(const int sdfd_in, const int fileid_in, const int gridfd_in, const int swathfd_in ) {
87  sdfd = sdfd_in;
88  fileid = fileid_in;
89  gridfd = gridfd_in;
90  swathfd = swathfd_in;
91  }
92 
93  void setHDF4Dataset(const int sdfd_in,const int fileid_in) {
94  sdfd = sdfd_in;
95  fileid = fileid_in;
96  }
97 };
98 
99 #endif
100 
101 
102 
void setHDF4Dataset(const int sdfd_in, const int fileid_in, const int gridfd_in, const int swathfd_in)
Definition: HDF4_DDS.h:86
static class NCMLUtil overview
HDF4DDS(DataDDS *ddsIn)
Definition: HDF4_DDS.h:56
void setHDF4Dataset(const int sdfd_in, const int fileid_in)
Definition: HDF4_DDS.h:93
This specialization of DDS is used to manage the 'resource' of the open HDF4 dataset handle so that t...
Definition: HDF4_DDS.h:40
HDF4DDS(const HDF4DDS &rhs)
Definition: HDF4_DDS.h:58
~HDF4DDS()
Definition: HDF4_DDS.h:71