bes Updated for version 3.20.13
FONcBaseType.h
1// FONcBaseType.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 FONcBaseType_h_
33#define FONcBaseType_h_ 1
34
35#include <netcdf.h>
36#include <vector>
37#include <string>
38
39#include <libdap/AttrTable.h>
40#include <libdap/D4Attributes.h>
41#include <libdap/D4AttributeType.h>
42#include <BESObj.h>
43#include "FONcNames.h"
44
45
46namespace libdap {
47class BaseType;
48class DDS;
49class ConstraintEvaluator;
50}
51
52//using namespace libdap;
53
60class FONcBaseType: public BESObj {
61protected:
62 int _varid;
63 std::string _varname;
64 std::string _orig_varname;
65 std::vector<std::string> _embed;
66 bool _defined;
67 std::string _ncVersion;
68 std::string _nc4_datamodel;
69 bool is_dap4;
70
71 //This is to handle the name clashing of dimension names of string type
72 bool is_dap4_group;
73
74 libdap::DDS *d_dds;
75 libdap::ConstraintEvaluator *d_eval;
76
77 FONcBaseType() : _varid(0), _defined(false), is_dap4(false), is_dap4_group(false), d_dds(nullptr), d_eval(nullptr) { }
78
79public:
80 virtual ~FONcBaseType() = default; // { }
81
82 libdap::DDS *get_dds() const {return d_dds;}
83 void set_dds(libdap::DDS *dds) {d_dds = dds;}
84
85 libdap::ConstraintEvaluator *get_eval() const {return d_eval;}
86 void set_eval(libdap::ConstraintEvaluator *eval) {d_eval = eval;}
87
88 virtual void convert(std::vector<std::string> embed, bool is_dap4= false, bool is_dap4_group=false);
89 virtual void define(int ncid);
90 virtual void write(int ncid) = 0;
91
92 virtual std::string name() = 0;
93 virtual nc_type type();
94 virtual void clear_embedded();
95 virtual int varid() const { return _varid; }
96
97 virtual void dump(std::ostream &strm) const = 0;
98
99 virtual void setVersion(const std::string &version);
100 virtual void setNC4DataModel(const string &nc4_datamodel);
101 virtual bool isNetCDF4();
102 virtual bool isNetCDF4_ENHANCED();
103 virtual void set_is_dap4(bool set_dap4) {is_dap4 = set_dap4;}
104 virtual libdap::AttrType getAttrType(nc_type t);
105 virtual D4AttributeType getD4AttrType(nc_type t);
106 virtual void updateD4AttrType(libdap::D4Attributes *d4_attrs, nc_type t);
107 virtual void updateAttrType(libdap::AttrTable& attrs, nc_type t);
108};
109
110#endif // FONcBaseType_h_
111
top level BES object to house generic methods
Definition BESObj.h:54
A DAP BaseType with file out netcdf information included.
virtual void define(int ncid)
Define the variable in the netcdf file.
virtual bool isNetCDF4()
Returns true if NetCDF4 features will be required.
virtual nc_type type()
Returns the type of data of this variable.
virtual void clear_embedded()
Clears the list of embedded variable names.
virtual void setNC4DataModel(const string &nc4_datamodel)
Identifies the netCDF4 data model (CLASSIC or ENHANCED)
virtual void setVersion(const std::string &version)
Identifies variable with use of NetCDF4 features.
virtual void dump(std::ostream &strm) const =0
dump the contents of this object to the specified ostream