OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
HDF5CFUtil.h
Go to the documentation of this file.
1 // This file is part of the hdf5_handler implementing for the CF-compliant
2 // Copyright (c) 2011-2013 The HDF Group, Inc. and OPeNDAP, Inc.
3 //
4 // This is free software; you can redistribute it and/or modify it under the
5 // terms of the GNU Lesser General Public License as published by the Free
6 // Software Foundation; either version 2.1 of the License, or (at your
7 // option) any later version.
8 //
9 // This software is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12 // License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 //
18 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
19 // You can contact The HDF Group, Inc. at 1800 South Oak Street,
20 // Suite 203, Champaign, IL 61820
21 
31 
32 #ifndef _HDF5CFUtil_H
33 #define _HDF5CFUtil_H
34 #include <string.h>
35 #include <set>
36 #include <vector>
37 #include <string>
38 #include <iostream>
39 #include "hdf5.h"
40 
41 // We create this intermediate enum H5DataType in order to totally separate the
42 // creating of DAS and DDS from any HDF5 API calls. When mapping to DAP, only this
43 // intermediate H5DataType will be used to map to the corresponding DAP datatype.
44 // Here H5UNSUPTYPE includes H5T_TIME, H5T_BITFIELD, H5T_OPAQUE,H5T_ENUM, H5T_VLEN.
45 // For CF option, H5REFERENCE, H5COMPOUND, H5ARRAY will not be supported. We leave them
46 // here for future merging of default option and CF option. Currently DAP2 doesn't
47 // support 64-bit integer. We still list int64 bit types since we find ACOSL2S has this
48 // datatype and we need to provide a special mapping for this datatype.
49 // H5UCHAR also needs a special mapping. Similiarly other unsupported types may need to
50 // have special mappings in the future. So the following enum type may be extended
51 // according to the future need. The idea is that all the necessary special mappings should
52 // be handled in the HDF5CF name space.
53 // The DDS and DAS generation modules should not use any HDF5 APIs.
58 
59 using namespace std;
60 
61 struct HDF5CFUtil {
62 
63 
65  static H5DataType H5type_to_H5DAPtype(hid_t h5_type_id);
66 
69  static std::string trim_string(hid_t dtypeid,const std::string s, int num_sect, size_t section_size, std::vector<size_t>& sect_newsize);
70 
71  static std::string obtain_string_after_lastslash(const std::string s);
72  static bool cf_strict_support_type(H5DataType dtype);
73 
74  // Obtain the unique name for the clashed names and save it to set namelist.
75  static void gen_unique_name(std::string &str, std::set<std::string>&namelist,int&clash_index);
76 
79  static void Split (const char *s, int len, char sep,
80  std::vector < std::string > &names);
81 
83  static void Split (const char *sz, char sep,
84  std::vector < std::string > &names);
85 
86  // Parse GPM Level 3 GridHeaders
87  //static void parser_trmm_v7_gridheader(int& latsize, int&lonsize, float& lat_start, float& lon_start, bool &sw_origin, bool & cr_reg);
88  static void parser_gpm_l3_gridheader(const std:: vector<char>&value, int& latsize, int&lonsize,
89  float& lat_start, float& lon_start, float& lat_res, float& lon_res, bool check_reg_orig);
90 
91  static void close_fileid(hid_t,bool);
92 };
93 
94 #endif
STL namespace.
H5DataType
Definition: HDF5CFUtil.h:54
void close_fileid(hid_t fid)
closes HDF5 file reffered by fid.
Definition: h5get.cc:356