bes  Updated for version 3.20.6
h5cfdap.cc
Go to the documentation of this file.
1 // This file is part of hdf5_handler a HDF5 file handler for the OPeNDAP
2 // data server.
3 
4 // Copyright (c) 2007-2016 The HDF Group, Inc. and OPeNDAP, Inc.
5 //
6 // This is free software; you can redistribute it and/or modify it under the
7 // terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 2.1 of the License, or (at your
9 // option) any later version.
10 //
11 // This software is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 // 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 // You can contact The HDF Group, Inc. at 1800 South Oak Street,
22 // Suite 203, Champaign, IL 61820
23 
33 
34 #include <InternalErr.h>
35 #include <BESDebug.h>
36 #include <mime_util.h>
37 #include "config_hdf5.h"
38 #include "h5cfdap.h"
39 
40 using namespace std;
41 using namespace libdap;
42 
43 void read_cfdds(DDS&,const string&,hid_t);
44 void read_cfdas(DAS&, const string&,hid_t);
45 
46 void read_cfdds(DDS & dds, const string &filename,hid_t myfile_id) {
47 
48  BESDEBUG("h5","Coming to CF DDS read function read_cfdds "<<endl);
49 
50  // Set the DDS name be the file name
51  dds.set_dataset_name(name_path(filename));
52 
53  hid_t fileid = myfile_id;
54  H5CFModule moduletype;
55 
56 #if 0
57  fileid = H5Fopen(filename.c_str(),H5F_ACC_RDONLY,H5P_DEFAULT);
58  if (fileid < 0) {
59  string msg =
60  "h5_cf_dds handler: Cannot open the HDF5 file ";
61  msg += filename;
62  throw InternalErr(__FILE__, __LINE__, msg);
63  }
64 #endif
65 
66  moduletype = check_module(fileid);
67  if (moduletype == HDF_EOS5) {
68  map_eos5_cfdds(dds,fileid, filename);
69  }
70  else { // handle HDF5 general product
71  map_gmh5_cfdds(dds,fileid, filename);
72 
73  }
74 
75 }
76 
77 void read_cfdas(DAS & das, const string &filename,hid_t myfile_id) {
78 
79  BESDEBUG("h5","Coming to CF DAS read function read_cfdas "<<endl);
80  hid_t fileid = myfile_id;
81  H5CFModule moduletype;
82 
83 #if 0
84  fileid = H5Fopen(filename.c_str(),H5F_ACC_RDONLY,H5P_DEFAULT);
85  if (fileid < 0) {
86  string msg =
87  "h5_cf_das handler: Cannot open the HDF5 file ";
88  msg += filename;
89  throw InternalErr(__FILE__, __LINE__, msg);
90  }
91 #endif
92 
93  moduletype = check_module(fileid);
94  if (moduletype == HDF_EOS5) {
95  map_eos5_cfdas(das,fileid, filename);
96  }
97  else { // handle HDF5 general product
98  map_gmh5_cfdas(das,fileid, filename);
99  }
100 
101 }
libdap
Definition: BESDapFunctionResponseCache.h:35
h5cfdap.h
The main wrapper of headers of the HDF5 OPeNDAP handler for the CF option.