bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
HDF4_DMR.h
1
2// 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) 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_DMR_H_
10#define HDF4_DMR_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 <libdap/DMR.h>
22#include <libdap/InternalErr.h>
23
24
39class HDF4DMR : public libdap::DMR {
40private:
41 int sdfd = -1;
42 int fileid = -1;
43 int gridfd = -1;
44 int swathfd = -1;
45
46 void m_duplicate(const HDF4DMR &src)
47 {
48 sdfd = src.sdfd;
49 fileid = src.fileid;
50 gridfd = src.gridfd;
51 swathfd = src.swathfd;
52 }
53
54public:
55 explicit HDF4DMR(const libdap::DMR *dmr) : libdap::DMR(*dmr) {}
56 HDF4DMR(libdap::D4BaseTypeFactory *factory,const string &name):libdap::DMR(factory,name) {}
57
58 HDF4DMR(const HDF4DMR &rhs) : libdap::DMR(rhs) {
59 m_duplicate(rhs);
60 }
61
62 HDF4DMR & operator= (const HDF4DMR &rhs) {
63 if (this == &rhs)
64 return *this;
65
66 libdap::DMR::operator=(rhs);
67 m_duplicate(rhs);
68
69 return *this;
70 }
71
72 ~HDF4DMR() override {
73
74 if (sdfd != -1)
75 SDend(sdfd);
76 if (fileid != -1)
77 Hclose(fileid);
78
79#ifdef USE_HDFEOS2_LIB
80 if (gridfd != -1)
81 GDclose(gridfd);
82 if (swathfd != -1)
83 SWclose(swathfd);
84#endif
85 }
86
87 void setHDF4Dataset(const int sdfd_in, const int fileid_in, const int gridfd_in, const int swathfd_in ) {
88 sdfd = sdfd_in;
89 fileid = fileid_in;
90 gridfd = gridfd_in;
91 swathfd = swathfd_in;
92 }
93
94 void setHDF4Dataset(const int sdfd_in,const int fileid_in) {
95 sdfd = sdfd_in;
96 fileid = fileid_in;
97 }
98};
99
100#endif
101
102
103