bes  Updated for version 3.20.13
FONcTransform.h
1 // FONcTransform.h
2 
3 // This file is part of BES Netcdf File Out Module
4 
5 // Copyright (c) 2004,2005 University Corporation for Atmospheric Research
6 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public 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 University Corporation for Atmospheric Research at
23 // 3080 Center Green Drive, Boulder, CO 80301
24 
25 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
26 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
27 //
28 // Authors:
29 // pwest Patrick West <pwest@ucar.edu>
30 // jgarcia Jose Garcia <jgarcia@ucar.edu>
31 
32 #ifndef FONcTransfrom_h_
33 #define FONcTransfrom_h_ 1
34 
35 #include <string>
36 #include <vector>
37 #include <map>
38 #include <set>
39 
40 #include <BESObj.h>
41 
42 namespace libdap {
43 class DDS;
44 class DMR;
45 class D4Group;
46 }
47 
48 class FONcBaseType;
49 class BESResponseObject;
51 
59 class FONcTransform: public BESObj {
60 private:
61  int _ncid = {0};
62  libdap::DDS *_dds = {nullptr};
63  libdap::DMR *_dmr = {nullptr};
64  BESResponseObject *d_obj = {nullptr};
65  BESDataHandlerInterface *d_dhi = {nullptr};
66  std::string _localfile;
67  std::string _returnAs;
68  std::vector<FONcBaseType *> _fonc_vars;
69  std::vector<FONcBaseType *> _total_fonc_vars_in_grp;
70  std::set<std::string> _included_grp_names;
71  std::map<std::string,unsigned long> GFQN_dimname_to_dimsize;
72  std::map<std::string,unsigned long> VFQN_dimname_to_dimsize;
73 
74 
75 public:
86  FONcTransform(libdap::DDS *dds, BESDataHandlerInterface &dhi, const std::string &localfile, const std::string &netcdfVersion = "netcdf");
87  FONcTransform(libdap::DMR *dmr, BESDataHandlerInterface &dhi, const std::string &localfile, const std::string &netcdfVersion = "netcdf");
88  FONcTransform(BESResponseObject *obj, BESDataHandlerInterface *dhi, const std::string &localfile, const std::string &ncVersion = "netcdf");
89  virtual ~FONcTransform();
90  virtual void transform_dap2(ostream &strm);
91  virtual void transform_dap4();
92 
93  virtual void dump(ostream &strm) const;
94 
95 private:
96  virtual void transform_dap4_no_group();
97  virtual void transform_dap4_group(libdap::D4Group*,bool is_root, int par_grp_id, std::map<std::string, int>&, std::vector<int>&);
98  virtual void transform_dap4_group_internal(libdap::D4Group*, bool is_root, int par_grp_id, std::map<std::string, int>&, std::vector<int>&);
99  virtual void check_and_obtain_dimensions(libdap::D4Group *grp, bool);
100  virtual void check_and_obtain_dimensions_internal(libdap::D4Group *grp);
101  virtual bool check_group_support();
102  virtual void gen_included_grp_list(libdap::D4Group *grp);
103 
104  virtual bool is_streamable();
105  virtual bool is_dds_streamable();
106  virtual bool is_dmr_streamable(libdap::D4Group *group);
107  void throw_if_dap2_response_too_big(DDS *dds, const string &dap2_ce="");
108  void throw_if_dap4_response_too_big(DMR *dmr, const string &dap4_ce="");
109  string too_big_error_msg(
110  const unsigned dap_version,
111  const string &return_encoding,
112  const unsigned long long config_max_response_size_kb,
113  const unsigned long long contextual_max_response_size_kb,
114  const string &ce);
115  void set_max_size_and_encoding(unsigned long long &max_request_size_kb, string &return_encoding);
116 
117 };
118 
119 #endif // FONcTransfrom_h_
120 
Structure storing information used by the BES to handle the request.
top level BES object to house generic methods
Definition: BESObj.h:54
Abstract base class representing a specific set of information in response to a request to the BES.
A DAP BaseType with file out netcdf information included.
Definition: FONcBaseType.h:60
Transformation object that converts an OPeNDAP DataDDS to a netcdf file.
Definition: FONcTransform.h:59
virtual void dump(ostream &strm) const
dumps information about this transformation object for debugging purposes
virtual void transform_dap2(ostream &strm)
Transforms each of the variables of the DataDDS to the NetCDF file.
FONcTransform(libdap::DDS *dds, BESDataHandlerInterface &dhi, const std::string &localfile, const std::string &netcdfVersion="netcdf")
Constructor that creates transformation object from the specified DataDDS object to the specified fil...
virtual void transform_dap4()
Transforms each of the variables of the DMR to the NetCDF file.
virtual ~FONcTransform()
Destructor.