bes  Updated for version 3.20.8
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 
40 #include <BESObj.h>
41 //#include <BaseType.h>
42 
43 #define RETURNAS_NETCDF "netcdf"
44 #define RETURNAS_NETCDF4 "netcdf-4"
45 #define NC4_CLASSIC_MODEL "NC4_CLASSIC_MODEL"
46 #define NC4_ENHANCED "NC4_ENHANCED"
47 // May add netCDF-3 CDF-5 in the future.
48 
49 namespace libdap {
50 class BaseType;
51 }
52 
53 //using namespace libdap;
54 
61 class FONcBaseType: public BESObj {
62 protected:
63  int _varid;
64  std::string _varname;
65  std::string _orig_varname;
66  std::vector<std::string> _embed;
67  bool _defined;
68  std::string _ncVersion;
69  std::string _nc4_datamodel;
70  bool is_dap4;
71 
72  //This is to handle the name clashing of dimension names of string type
73  bool is_dap4_group;
74 
75  FONcBaseType() : _varid(0), _defined(false),is_dap4(false),is_dap4_group(false){ }
76 
77 public:
78  virtual ~FONcBaseType() { }
79 
80  virtual void convert(std::vector<std::string> embed,bool is_dap4_group=false);
81  virtual void define(int ncid);
82  virtual void write(int /*ncid*/) { }
83 
84  virtual std::string name() = 0;
85  virtual nc_type type();
86  virtual void clear_embedded();
87  virtual int varid() const { return _varid; }
88 
89  virtual void dump(std::ostream &strm) const = 0;
90 
91  virtual void setVersion(std::string version);
92  virtual void setNC4DataModel(std::string nc4_datamodel);
93  virtual bool isNetCDF4();
94  virtual bool isNetCDF4_ENHANCED();
95  virtual void set_is_dap4(bool set_dap4) {is_dap4 = set_dap4;}
96 
97 };
98 
99 #endif // FONcBaseType_h_
100 
top level BES object to house generic methods
Definition: BESObj.h:50
A DAP BaseType with file out netcdf information included.
Definition: FONcBaseType.h:61
virtual void setVersion(std::string version)
Identifies variable with use of NetCDF4 features.
Definition: FONcBaseType.cc:89
virtual void setNC4DataModel(std::string nc4_datamodel)
Identifies the netCDF4 data model (CLASSIC or ENHANCED)
Definition: FONcBaseType.cc:98
virtual void define(int ncid)
Define the variable in the netcdf file.
Definition: FONcBaseType.cc:54
virtual bool isNetCDF4()
Returns true if NetCDF4 features will be required.
virtual nc_type type()
Returns the type of data of this variable.
Definition: FONcBaseType.cc:75
virtual void clear_embedded()
Clears the list of embedded variable names.
Definition: FONcBaseType.cc:82
virtual void dump(std::ostream &strm) const =0
dump the contents of this object to the specified ostream