bes  Updated for version 3.20.13
HDF5_DMR.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-2012 The HDF Group
6 // The idea is borrowed from HDF4 OPeNDAP handler that is implemented by
7 // James Gallagher<jgallagher@opendap.org>
8 
9 #ifndef HDF5_DMR_H_
10 #define HDF5_DMR_H_
11 
12 #include "config_hdf5.h"
13 
14 
15 #include "hdf5.h"
16 
17 
18 #include <libdap/DMR.h>
19 
20 
37 class HDF5DMR : public libdap::DMR {
38 private:
39  hid_t fileid = -1;
40 
41  void m_duplicate(const HDF5DMR &src)
42  {
43  fileid = src.fileid;
44  }
45 
46 public:
47  explicit HDF5DMR(libdap::DMR *dmr) : libdap::DMR(*dmr) {}
48  HDF5DMR(libdap::D4BaseTypeFactory *factory,const string &name):libdap::DMR(factory,name) {}
49 
50  HDF5DMR(const HDF5DMR &rhs) : libdap::DMR(rhs) {
51  m_duplicate(rhs);
52  }
53 
54  HDF5DMR & operator= (const HDF5DMR &rhs) {
55 
56  if (this == &rhs)
57  return *this;
58 
59 #if 0
60  dynamic_cast<libdap::DMR &>(*this) = rhs;
61 #endif
62  libdap::DMR::operator=(rhs);
63 
64  m_duplicate(rhs);
65 
66  return *this;
67  }
68 
69  ~HDF5DMR() override{
70 
71  if (fileid != -1)
72  H5Fclose(fileid);
73 
74  }
75 
76  void setHDF5Dataset(const hid_t fileid_in) {
77  fileid = fileid_in;
78  }
79 
80 };
81 
82 #endif
83 
84 
85