32#include <BESInternalError.h>
35#include "FONcStructure.h"
37#include "FONcAttributes.h"
50 _s =
dynamic_cast<Structure *
>(b);
52 string s = (string)
"File out netcdf, write_structure was passed a " +
"variable that is not a structure";
66 vector<FONcBaseType *>::iterator i = _vars.begin();
67 vector<FONcBaseType *>::iterator e = _vars.end();
100 FONcBaseType::convert(embed,_dap4,is_dap4_group);
101 embed.push_back(
name());
102 Constructor::Vars_iter vi = _s->var_begin();
103 Constructor::Vars_iter ve = _s->var_end();
104 for (; vi != ve; vi++) {
107 BESDEBUG(
"fonc",
"FONcStructure::convert - converting " << bt->name() << endl);
108 bool is_classic_model =
true;
109 if(
true == isNetCDF4_ENHANCED())
110 is_classic_model =
false;
111 FONcBaseType *fbt = FONcUtils::convert(bt,this->_ncVersion,is_classic_model);
115 _vars.push_back(fbt);
116 fbt->convert(embed,_dap4,is_dap4_group);
139 BESDEBUG(
"fonc",
"FONcStructure::define - defining " << _varname << endl);
140 vector<FONcBaseType *>::const_iterator i = _vars.begin();
141 vector<FONcBaseType *>::const_iterator e = _vars.end();
142 for (; i != e; i++) {
144 BESDEBUG(
"fonc",
"defining " << fbt->name() << endl);
150 BESDEBUG(
"fonc",
"FONcStructure::define - done defining " << _varname << endl);
163 BESDEBUG(
"fonc",
"FONcStructure::write - writing " << _varname << endl);
164 vector<FONcBaseType *>::const_iterator i = _vars.begin();
165 vector<FONcBaseType *>::const_iterator e = _vars.end();
166 for (; i != e; i++) {
169 fbt->set_dds(get_dds());
170 fbt->set_eval(get_eval());
175 BESDEBUG(
"fonc",
"FONcStructure::define - done writing " << _varname << endl);
197 strm << BESIndent::LMarg <<
"FONcStructure::dump - (" << (
void *)
this <<
")" << endl;
199 strm << BESIndent::LMarg <<
"name = " << _s->name() <<
" {" << endl;
201 vector<FONcBaseType *>::const_iterator i = _vars.begin();
202 vector<FONcBaseType *>::const_iterator e = _vars.end();
203 for (; i != e; i++) {
207 BESIndent::UnIndent();
208 strm << BESIndent::LMarg <<
"}" << endl;
209 BESIndent::UnIndent();
exception thrown if internal error encountered
A DAP BaseType with file out netcdf information included.
virtual void define(int ncid)
Define the variable in the netcdf file.
virtual void dump(std::ostream &strm) const =0
dump the contents of this object to the specified ostream
virtual void dump(ostream &strm) const
dumps information about this object for debugging purposes
virtual void define(int ncid)
Define the members of the structure in the netcdf file.
FONcStructure(libdap::BaseType *b)
Constructor for FONcStructure that takes a DAP Structure.
virtual void write(int ncid)
write the member variables of the structure to the netcdf file
virtual string name()
Returns the name of the structure.
virtual void convert(vector< string > embed, bool _dap4=false, bool is_dap4_group=false)
Creates the FONc objects for each variable of the DAP structure.
virtual ~FONcStructure()
Destructor that cleans up the structure.