bes Updated for version 3.20.13
HDF5CFArray.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-2016 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
29
30#ifndef _HDF5CFARRAY_H
31#define _HDF5CFARRAY_H
32
33// STL includes
34#include <string>
35#include <vector>
36
37// DODS includes
38#include "HDF5CF.h"
39//#include <libdap/Array.h>
40#include "HDF5BaseArray.h"
41#include "HDF5DiskCache.h"
42#include <libdap/D4Group.h>
43#include <libdap/D4Attributes.h>
44
45
46
48 public:
49 HDF5CFArray(int h5_rank,
50 const hid_t h5_file_id,
51 const std::string & h5_filename,
52 H5DataType h5_dtype,
53 const std::vector<size_t>& h5_dimsizes,
54 const std::string &varfullpath,
55 const size_t h5_total_elems,
56 const CVType h5_cvtype,
57 const bool h5_islatlon,
58 const float h5_comp_ratio,
59 const bool h5_is_dap4,
60 const std::string & n="",
61 libdap::BaseType * v = nullptr):
62 HDF5BaseArray(n,v),
63 rank(h5_rank),
64 fileid(h5_file_id),
65 filename(h5_filename),
66 dtype(h5_dtype),
67 dimsizes(h5_dimsizes),
68 varname(varfullpath),
69 total_elems(h5_total_elems),
70 cvtype(h5_cvtype),
71 islatlon(h5_islatlon),
72 comp_ratio(h5_comp_ratio),
73 is_dap4(h5_is_dap4)
74 {
75 }
76
77 ~ HDF5CFArray() override = default;
78
79 libdap::BaseType *ptr_duplicate() override;
80 bool read() override;
81 void read_data_NOT_from_mem_cache(bool add_cache,void*buf) override;
82
83 // Currently this routine is only used for 64-bit integer mapping to DAP4.
84 libdap::BaseType *h5cfdims_transform_to_dap4_int64(libdap::D4Group *root);
85#if 0
86 //libdap::BaseType *h5cfdims_transform_to_dap4(libdap::D4Group *root);
87 //void read_data_from_mem_cache(void*buf);
88 //void read_data_from_file(bool add_cache,void*buf);
89 //int format_constraint (int *cor, int *step, int *edg);
90#endif
91
92 private:
93 int rank;
94 hid_t fileid;
95 std::string filename;
96 H5DataType dtype;
97 std::vector<size_t>dimsizes;
98 std::string varname;
99 size_t total_elems;
100 CVType cvtype;
101 bool islatlon;
102 float comp_ratio;
103 bool is_dap4;
104 bool valid_disk_cache();
105 bool valid_disk_cache_for_compressed_data(short dtype_size) const;
106 bool obtain_cached_data(HDF5DiskCache*,const std::string&,int, std::vector<int>&,std::vector<int>&,size_t,short);
107 void write_data_to_cache(hid_t dset_id, hid_t dspace_id,hid_t mspace_id,hid_t memtype, const std::string& cache_fpath,short dtype_size,const std::vector<char> &buf, int nelms);
108};
109
110#endif // _HDF5CFARRAY_H
111
A helper class that aims to reduce code redundence for different special CF derived array class For e...
This class specifies the core engineering of mapping HDF5 to DAP by following CF.
void read_data_NOT_from_mem_cache(bool add_cache, void *buf) override
Definition: HDF5CFArray.cc:175