bes  Updated for version 3.20.6
HDF4_DDS.h
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 <DDS.h>
22 #include <InternalErr.h>
23 
24 
39 class HDF4DDS : public libdap::DDS {
40 private:
41  int sdfd;
42  int fileid;
43  int gridfd;
44  int swathfd;
45 
46  void m_duplicate(const HDF4DDS &src)
47  {
48  sdfd = src.sdfd;
49  fileid = src.fileid;
50  gridfd = src.gridfd;
51  swathfd = src.swathfd;
52  }
53 
54 public:
55  explicit HDF4DDS(libdap::DDS *ddsIn) : libdap::DDS(*ddsIn), sdfd(-1),fileid(-1),gridfd(-1),swathfd(-1) {}
56 
57  HDF4DDS(const HDF4DDS &rhs) : libdap::DDS(rhs) {
58  m_duplicate(rhs);
59  }
60 
61  HDF4DDS & operator= (const HDF4DDS &rhs) {
62  if (this == &rhs)
63  return *this;
64 
65  m_duplicate(rhs);
66 
67  return *this;
68  }
69 
70  ~HDF4DDS() {
71 
72  if (sdfd != -1)
73  SDend(sdfd);
74  if (fileid != -1)
75  Hclose(fileid);
76 
77 #ifdef USE_HDFEOS2_LIB
78  if (gridfd != -1)
79  GDclose(gridfd);
80  if (swathfd != -1)
81  SWclose(swathfd);
82 #endif
83  }
84 
85  void setHDF4Dataset(const int sdfd_in, const int fileid_in, const int gridfd_in, const int swathfd_in ) {
86  sdfd = sdfd_in;
87  fileid = fileid_in;
88  gridfd = gridfd_in;
89  swathfd = swathfd_in;
90  }
91 
92  void setHDF4Dataset(const int sdfd_in,const int fileid_in) {
93  sdfd = sdfd_in;
94  fileid = fileid_in;
95  }
96 };
97 
98 #endif
99 
100 
101 
HDF4DDS
Definition: HDF4_DDS.h:39