25#include <libdap/util.h> 
   26#include <BESInternalError.h> 
   29#include "FONcArrayStructure.h" 
   31#include "FONcAttributes.h" 
   42    FONcBaseType(),_as(dynamic_cast<Array*>(b))
 
   45        string s = 
"File out netcdf, array of structure was passed a variable that is not an array ";
 
   48    if (_as->var()->type() != dods_structure_c) {
 
   49        string s =  
"File out netcdf, array of structure was passed a variable that is not a structure ";
 
   50        throw BESInternalError(s, __FILE__, __LINE__);
 
 
   61    for (
auto &var: _vars) {
 
 
   88    FONcBaseType::convert(embed,_dap4,is_dap4_group);
 
   89    embed.push_back(
name());
 
   91    auto as_v = 
dynamic_cast<Structure *
>(_as->var());
 
   93        string s = 
"File out netcdf, write an array of structure was passed a variable that is not a structure";
 
   97    if (
false == isNetCDF4_ENHANCED()) {
 
   98        throw BESInternalError(
"Fileout netcdf: We don't support array of structure for the classical model now. ",
 
  102    for (
auto &bt: as_v->variables()) {
 
  104        Type t_bt = bt->type();
 
  107        if (libdap::is_simple_type(t_bt) == 
false) {
 
  109            if (t_bt != dods_array_c) {
 
  110                can_handle_str_memb = 
false;
 
  114                auto t_a = 
dynamic_cast<Array *
>(bt);
 
  115                Type t_array_var = t_a->var()->type();
 
  116                if (!libdap::is_simple_type(t_array_var) || t_array_var == dods_url_c || t_array_var == dods_enum_c || t_array_var==dods_opaque_c) {
 
  117                    can_handle_str_memb = 
false;
 
  122        else if (t_bt == dods_url_c || t_bt == dods_enum_c || t_bt==dods_opaque_c) {
 
  123            can_handle_str_memb= 
false;
 
  129    if(can_handle_str_memb) {
 
  133            _as->intern_data(*get_eval(),*get_dds());
 
  136    for (
auto &bt: as_v->variables()) {
 
  138            BESDEBUG(
"fonc", 
"FONcArrayStructure::convert - converting " << bt->name() << endl);
 
  140            _vars.push_back(fsf);
 
  141            fsf->convert(embed,_dap4,is_dap4_group);
 
 
  166        BESDEBUG(
"fonc", 
"FONcArrayStructure::define - defining " << d_varname << endl);
 
  168        for (
auto &fbt:_vars) {
 
  169            BESDEBUG(
"fonc", 
"defining " << fbt->name() << endl);
 
  175        BESDEBUG(
"fonc", 
"FONcArrayStructure::define - done defining " << d_varname << endl);
 
 
  190    BESDEBUG(
"fonc", 
"FONcArrayStructure::write - writing " << d_varname << endl);
 
  192    if(!can_handle_str_memb) {
 
  196            _as->intern_data(*get_eval(),*get_dds());
 
  199    for (
const auto &var:_vars) {
 
  202    BESDEBUG(
"fonc", 
"FONcArrayStructure::define - done writing " << d_varname << endl);
 
 
  224    strm << BESIndent::LMarg << 
"FONcArrayStructure::dump - (" << (
void *) 
this << 
")" << endl;
 
  226    strm << BESIndent::LMarg << 
"name = " << _as->name() << 
" {" << endl;
 
  228    for (
const auto & _var:_vars)
 
  230    BESIndent::UnIndent();
 
  231    strm << BESIndent::LMarg << 
"}" << endl;
 
  232    BESIndent::UnIndent();
 
 
exception thrown if internal error encountered
A DAP Array with file out netcdf information included.
void convert(vector< string > embed, bool _dap4=true, bool is_dap4_group=false) override
Creates the FONc objects for each variable of the DAP array of structure.
~FONcArrayStructure() override
Destructor that cleans up the array of structure.
void define(int ncid) override
Define the members of the array of structure in the netcdf file.
void dump(ostream &strm) const override
dumps information about this object for debugging purposes
string name() override
Returns the name of the structure.
FONcArrayStructure(libdap::BaseType *b)
Constructor for FONcArrayStructure that takes a DAP Array Structure.
void write(int ncid) override
write the member variables of the structure to the netcdf file