bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
FONcArrayStructureField.h
1// FONcArrayStructureField.h
2
3// This file is part of BES Netcdf File Out Module
4
5// // Copyright (c) The HDF Group, Inc. and OPeNDAP, Inc.
6//
7// This is free software; you can redistribute it and/or modify it under the
8// terms of the GNU Lesser General Public License as published by the Free
9// Software Foundation; either version 2.1 of the License, or (at your
10// option) any later version.
11//
12// This software is distributed in the hope that it will be useful, but
13// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15// License for more details.
16//
17// You should have received a copy of the GNU Lesser General Public
18// License along with this library; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20//
21// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
22// You can contact The HDF Group, Inc. at 410 E University Ave,
23// Suite 200, Champaign, IL 61820
24
25
26#ifndef FONcArrayStructureField_h_
27#define FONcArrayStructureField_h_ 1
28
29#include <vector>
30#include <string>
31
32#include <netcdf.h>
33
34#include <libdap/Array.h>
35#include "FONcBaseType.h"
36
37class FONcDim;
38class FONcMap;
39
40namespace libdap {
41class BaseType;
42}
43
50class FONcArrayStructureField: public FONcBaseType {
51private:
52
53 // The structure array being converted, not the structure array field
54 libdap::Array *d_a = nullptr;
55 // The type of data stored in the array
56 nc_type d_array_type = NC_NAT;
57 string var_name;
58 std::vector<FONcDim *> struct_dims;
59 vector<size_t> struct_dim_sizes;
60
61 // The following variables are not used for structure string handling.
62 size_t total_nelements = 1;
63 size_t field_nelements = 1;
64 size_t d_array_type_size;
65
66 // The netcdf dimension ids for this array
67 std::vector<int> d_dim_ids{};
68
69 FONcDim * find_sdim(const std::string &name, int64_t size);
70 void obtain_scalar_data(char *data_buf_ptr, libdap::BaseType* b) const;
71 size_t obtain_maximum_string_length();
72 void handle_structure_string_field(libdap::BaseType *b);
73 void write_str(int ncid);
74public:
75
76 explicit FONcArrayStructureField(libdap::BaseType *b, libdap::Array* a, bool is_netCDF4_enhanced);
78
79 void convert(vector<string> embed, bool _dap4=true, bool is_dap4_group=false) override;
80 void define(int ncid) override;
81 void write(int ncid) override;
82
83 std::string name() override;
84 nc_type type() override;
85
86 void dump(std::ostream &strm) const override;
87
88 static std::vector<FONcDim *> SDimensions;
89
90};
91
92#endif // FONcArrayStructureField_h_
93
FONcArrayStructureField(libdap::BaseType *b, libdap::Array *a, bool is_netCDF4_enhanced)
Constructor for FONcArrayStructureField.
void dump(std::ostream &strm) const override
dumps information about this object for debugging purposes
std::string name() override
returns the name of the array structure field
nc_type type() override
returns the netcdf type of the DAP object
void write(int ncid) override
Write the netcdf variable data out to the netcdf file.
void define(int ncid) override
define the DAP array of structure field in the netcdf file
A class that represents the dimension of an array.
Definition FONcDim.h:45
A map of a DAP Grid with file out netcdf information included.
Definition FONcMap.h:52
STL class.