bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
HDF5BaseArray.h
Go to the documentation of this file.
1// This file is part of hdf5_handler an HDF5 file handler for the OPeNDAP
2// data server.
3
4// Author: Kent Yang <myang6@hdfgroup.org>
5
6// Copyright (c) 2011-2023 The HDF Group, Inc. and OPeNDAP, Inc.
7//
8// This is free software; you can redistribute it and/or modify it under the
9// terms of the GNU Lesser General Public License as published by the Free
10// Software Foundation; either version 2.1 of the License, or (at your
11// option) any later version.
12//
13// This software is distributed in the hope that it will be useful, but
14// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16// License for more details.
17//
18// You should have received a copy of the GNU Lesser General Public
19// License along with this library; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21//
22// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
23// You can contact The HDF Group, Inc. at 410 E University Ave,
24// Suite 200, Champaign, IL 61820
25
26#ifndef _HDF5BASEARRAY_H
27#define _HDF5BASEARRAY_H
28
29// STL includes
30#include <string>
31#include <vector>
32
33// DODS includes
34#include <libdap/Array.h>
35#include <HDF5CFUtil.h>
36#include <libdap/D4Group.h>
37
54
55
56class HDF5BaseArray: public libdap::Array {
57public:
58 HDF5BaseArray(const std::string & n = "", libdap::BaseType * v = nullptr) :
59 libdap::Array(n, v)
60 {
61 }
62
63 ~HDF5BaseArray() override = default;
64
65protected:
66#if 0
67 //virtual BaseType *ptr_duplicate();
68 //virtual bool read();
69#endif
70 int64_t format_constraint(int64_t *cor, int64_t *step, int64_t *edg);
71 void write_nature_number_buffer(int rank, int64_t tnumelm);
72 void read_data_from_mem_cache(H5DataType h5type, const std::vector<size_t> &h5_dimsizes, void*buf,const bool is_dap4);
73 virtual void read_data_NOT_from_mem_cache(bool add_cache, void*buf) = 0;
74
75 size_t INDEX_nD_TO_1D(const std::vector<size_t> &dims, const std::vector<size_t> &pos) const;
76
77 template<typename T> int subset( void* input,
78 int rank,
79 const std::vector<size_t> & dim,
80 int64_t start[],
81 int64_t stride[],
82 int64_t edge[],
83 std::vector<T> *poutput,
84 std::vector<size_t>& pos,
85 int index);
86
87 std::string check_str_sect_in_list(const std::vector<string> &, const std::string &, char) const;
88 bool check_var_cache_files(const std::vector<string>&, const std::string &, const std::string &) const;
89 void handle_data_with_mem_cache(H5DataType, size_t t_elems, const short cache_case, const std::string & key,const bool is_dap4);
90
91public:
92 libdap::BaseType *h5cfdims_transform_to_dap4(libdap::D4Group *grp);
93
94};
95
96
97#endif // _HDF5BASEARRAY_H
98
This file includes several helper functions for translating HDF5 to CF-compliant.
int subset(void *input, int rank, const std::vector< size_t > &dim, int64_t start[], int64_t stride[], int64_t edge[], std::vector< T > *poutput, std::vector< size_t > &pos, int index)
Getting a subset of a variable.