bes  Updated for version 3.20.10
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: Muqun Yang <myang6@hdfgroup.org>
5 
6 // Copyright (c) 2011-2016 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 1800 South Oak Street,
24 // Suite 203, 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 
56 class HDF5BaseArray: public libdap::Array {
57 public:
58  HDF5BaseArray(const std::string & n = "", libdap::BaseType * v = 0) :
59  libdap::Array(n, v)
60  {
61  }
62 
63  virtual ~ HDF5BaseArray()
64  {
65  }
66 
67 protected:
68 #if 0
69  //virtual BaseType *ptr_duplicate();
70  //virtual bool read();
71 #endif
72  int format_constraint(int *cor, int *step, int *edg);
73  void write_nature_number_buffer(int rank, int tnumelm);
74  void read_data_from_mem_cache(H5DataType h5type, const std::vector<size_t> &h5_dimsizes, void*buf,const bool is_dap4);
75  virtual void read_data_NOT_from_mem_cache(bool add_cache, void*buf) = 0;
76 
77  size_t INDEX_nD_TO_1D(const std::vector<size_t> &dims, const std::vector<size_t> &pos) const;
78 
79  template<typename T> int subset( void* input,
80  int rank,
81  const std::vector<size_t> & dim,
82  int start[],
83  int stride[],
84  int edge[],
85  std::vector<T> *poutput,
86  std::vector<size_t>& pos,
87  int index);
88 
89  std::string check_str_sect_in_list(const std::vector<string> &, const std::string &, char) const;
90  bool check_var_cache_files(const std::vector<string>&, const std::string &, const std::string &) const;
91  void handle_data_with_mem_cache(H5DataType, size_t t_elems, const short cache_case, const std::string & key,const bool is_dap4);
92 
93 public:
94  libdap::BaseType *h5cfdims_transform_to_dap4(libdap::D4Group *grp);
95 
96 };
97 
98 
99 #endif // _HDF5BASEARRAY_H
100 
This file includes several helper functions for translating HDF5 to CF-compliant.
int subset(void *input, int rank, const std::vector< size_t > &dim, int start[], int stride[], int edge[], std::vector< T > *poutput, std::vector< size_t > &pos, int index)
Getting a subset of a variable.