bes  Updated for version 3.20.6
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 <Array.h>
40 #include "HDF5BaseArray.h"
41 #include "HDF5DiskCache.h"
42 #include <D4Group.h>
43 #include <D4Attributes.h>
44 
45 
46 
47 class HDF5CFArray:public HDF5BaseArray {
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 std::string & n="",
60  libdap::BaseType * v = 0):
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  {
73  }
74 
75  virtual ~ HDF5CFArray() {
76  }
77  virtual libdap::BaseType *ptr_duplicate();
78  virtual bool read();
79  virtual void read_data_NOT_from_mem_cache(bool add_cache,void*buf);
80 
81  // Currently this routine is only used for 64-bit integer mapping to DAP4.
82  libdap::BaseType *h5cfdims_transform_to_dap4(libdap::D4Group *root);
83 #if 0
84  //void read_data_from_mem_cache(void*buf);
85  //void read_data_from_file(bool add_cache,void*buf);
86  //int format_constraint (int *cor, int *step, int *edg);
87 #endif
88 
89  private:
90  int rank;
91  hid_t fileid;
92  std::string filename;
93  H5DataType dtype;
94  std::vector<size_t>dimsizes;
95  std::string varname;
96  size_t total_elems;
97  CVType cvtype;
98  bool islatlon;
99  float comp_ratio;
100  bool valid_disk_cache();
101  bool valid_disk_cache_for_compressed_data(short dtype_size);
102  bool obtain_cached_data(HDF5DiskCache*,const std::string&,int, std::vector<int>&,std::vector<int>&,size_t,short);
103  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);
104 };
105 
106 #endif // _HDF5CFARRAY_H
107 
HDF5BaseArray.h
A helper class that aims to reduce code redundence for different special CF derived array class For e...
HDF5CFArray::read_data_NOT_from_mem_cache
virtual void read_data_NOT_from_mem_cache(bool add_cache, void *buf)
Definition: HDF5CFArray.cc:175
HDF5DiskCache
Definition: HDF5DiskCache.h:16
HDF5BaseArray
Definition: HDF5BaseArray.h:55
HDF5CF.h
This class specifies the core engineering of mapping HDF5 to DAP by following CF.
HDF5CFArray
Definition: HDF5CFArray.h:47