OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
GDAL_DMR.h
Go to the documentation of this file.
1 // This file is part of the GDAL OPeNDAP Adapter
2 
3 // Copyright (c) 2012 OPeNDAP, Inc.
4 // Author: James Gallagher <jgallagher@opendap.org>
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
21 
22 #ifndef GDAL_DMR_H_
23 #define GDAL_DMR_H_
24 
25 #include "config.h"
26 
27 #include <gdal.h>
28 
29 #include <DMR.h>
30 
41 class GDALDMR : public libdap::DMR {
42 private:
43  GDALDatasetH d_hDS;
44 
45  void m_duplicate(const GDALDMR &src) { d_hDS = src.d_hDS; }
46 
47 public:
48  GDALDMR(libdap::DMR *dmr) : libdap::DMR(*dmr), d_hDS(0) {}
49  GDALDMR(libdap::D4BaseTypeFactory *factory, const string &name) : libdap::DMR(factory, name), d_hDS(0) {}
50 
51  GDALDMR(const GDALDMR &rhs) : libdap::DMR(rhs) {
52  m_duplicate(rhs);
53  }
54 
55  GDALDMR & operator= (const GDALDMR &rhs) {
56  if (this == &rhs)
57  return *this;
58 
59  dynamic_cast<libdap::DMR &>(*this) = rhs;
60  m_duplicate(rhs);
61 
62  return *this;
63  }
64 
66  if (d_hDS)
67  GDALClose(d_hDS);
68  }
69 
70  void setGDALDataset(const GDALDatasetH &hDSIn) { d_hDS = hDSIn; }
71  GDALDatasetH &GDALDataset() { return d_hDS; }
72 };
73 
74 
75 #endif /* GDAL_DMR_H_ */
GDALDMR & operator=(const GDALDMR &rhs)
Definition: GDAL_DMR.h:55
This specialization of DMR is used to manage the 'resource' of the open GDAL dataset handle so that t...
Definition: GDAL_DMR.h:41
GDALDatasetH & GDALDataset()
Definition: GDAL_DMR.h:71
GDALDMR(const GDALDMR &rhs)
Definition: GDAL_DMR.h:51
~GDALDMR()
Definition: GDAL_DMR.h:65
static class NCMLUtil overview
GDALDMR(libdap::D4BaseTypeFactory *factory, const string &name)
Definition: GDAL_DMR.h:49
GDALDMR(libdap::DMR *dmr)
Definition: GDAL_DMR.h:48
void setGDALDataset(const GDALDatasetH &hDSIn)
Definition: GDAL_DMR.h:70