bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
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-2023 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 410 E University Ave,
20// Suite 200, 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 "HDF5BaseArray.h"
40#include "HDF5DiskCache.h"
41#include <libdap/D4Group.h>
42#include <libdap/D4Attributes.h>
43
44
45
46class HDF5CFArray:public HDF5BaseArray {
47 public:
48 HDF5CFArray(int h5_rank,
49 const hid_t h5_file_id,
50 const std::string & h5_filename,
51 H5DataType h5_dtype,
52 const std::vector<size_t>& h5_dimsizes,
53 const std::string &varfullpath,
54 const size_t h5_total_elems,
55 const CVType h5_cvtype,
56 const bool h5_islatlon,
57 const float h5_comp_ratio,
58 const bool h5_is_dap4,
59 const std::string & n="",
60 libdap::BaseType * v = nullptr):
61 HDF5BaseArray(n,v),
62 rank(h5_rank),
63 fileid(h5_file_id),
64 filename(h5_filename),
65 dtype(h5_dtype),
66 dimsizes(h5_dimsizes),
67 varname(varfullpath),
68 total_elems(h5_total_elems),
69 cvtype(h5_cvtype),
70 islatlon(h5_islatlon),
71 comp_ratio(h5_comp_ratio),
72 is_dap4(h5_is_dap4)
73 {
74 }
75
76 ~ HDF5CFArray() override = default;
77
78 libdap::BaseType *ptr_duplicate() override;
79 bool read() override;
80 void read_data_NOT_from_mem_cache(bool add_cache,void*buf) override;
81
82 // Currently this routine is only used for 64-bit integer mapping to DAP4.
83 libdap::BaseType *h5cfdims_transform_to_dap4_int64(libdap::D4Group *root);
84#if 0
85 //libdap::BaseType *h5cfdims_transform_to_dap4(libdap::D4Group *root);
86 //void read_data_from_mem_cache(void*buf);
87 //void read_data_from_file(bool add_cache,void*buf);
88 //int format_constraint (int *cor, int *step, int *edg);
89#endif
90
91 private:
92 int rank;
93 hid_t fileid;
94 std::string filename;
95 H5DataType dtype;
96 std::vector<size_t>dimsizes;
97 std::string varname;
98 size_t total_elems;
99 CVType cvtype;
100 bool islatlon;
101 float comp_ratio;
102 bool is_dap4;
103 bool valid_disk_cache() const;
104 bool valid_disk_cache_for_compressed_data(short dtype_size) const;
105 bool obtain_cached_data(HDF5DiskCache*,const std::string&,int, std::vector<int64_t>&,std::vector<int64_t>&,size_t,short);
106 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, int64_t nelms);
107};
108
109#endif // _HDF5CFARRAY_H
110
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