bes  Updated for version 3.20.6
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 <Array.h>
35 #include <HDF5CFUtil.h>
36 
53 
54 
55 class HDF5BaseArray: public libdap::Array {
56 public:
57  HDF5BaseArray(const std::string & n = "", libdap::BaseType * v = 0) :
58  libdap::Array(n, v)
59  {
60  }
61 
62  virtual ~ HDF5BaseArray()
63  {
64  }
65 
66 protected:
67 #if 0
68  //virtual BaseType *ptr_duplicate();
69  //virtual bool read();
70 #endif
71  int format_constraint(int *cor, int *step, int *edg);
72  void write_nature_number_buffer(int rank, int tnumelm);
73  void read_data_from_mem_cache(H5DataType h5type, const std::vector<size_t> &h5_dimsizes, void*buf);
74  virtual void read_data_NOT_from_mem_cache(bool add_cache, void*buf) = 0;
75 
76  size_t INDEX_nD_TO_1D(const std::vector<size_t> &dims, const std::vector<size_t> &pos);
77 
78  template<typename T> int subset( void* input,
79  int rank,
80  const std::vector<size_t> & dim,
81  int start[],
82  int stride[],
83  int edge[],
84  std::vector<T> *poutput,
85  std::vector<size_t>& pos,
86  int index);
87 
88  std::string check_str_sect_in_list(const std::vector<string> &, const std::string &, char);
89  bool check_var_cache_files(const std::vector<string>&, const std::string &, const std::string &);
90  void handle_data_with_mem_cache(H5DataType, size_t t_elems, const short cache_case, const std::string & key);
91 };
92 
93 #endif // _HDF5BASEARRAY_H
94 
HDF5CFUtil.h
This file includes several helper functions for translating HDF5 to CF-compliant.
HDF5BaseArray
Definition: HDF5BaseArray.h:55
HDF5BaseArray::subset
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.
Definition: HDF5BaseArray.cc:396