39#include <libdap/InternalErr.h>
47#include <libdap/debug.h>
48#include "get_xml_data.h"
50using namespace xml_data;
53XDGrid::ptr_duplicate()
55 return new XDGrid(*
this);
58XDGrid::XDGrid(
const string &n) :
63XDGrid::XDGrid(Grid *grid) :
66 BaseType *bt = basetype_to_xd(grid->array_var());
67 add_var(bt, libdap::array);
72 Grid::Map_iter i = grid->map_begin();
73 Grid::Map_iter e = grid->map_end();
75 bt = basetype_to_xd(*i);
82 BaseType::set_send_p(grid->send_p());
89void XDGrid::print_xml_data(XMLWriter *writer,
bool show_type)
94 if (projection_yields_grid())
95 start_xml_declaration(writer,
"Grid");
97 start_xml_declaration(writer,
"Structure");
100 if (array_var()->send_p()) {
101 dynamic_cast<XDArray&
> (*array_var()).print_xml_data(writer, show_type);
104 Map_iter m = map_begin();
105 while (m != map_end()) {
106 if ((*m)->send_p()) {
107 if (projection_yields_grid())
108 dynamic_cast<XDArray&
> (**m).print_xml_map_data(writer, show_type);
110 dynamic_cast<XDArray&
> (**m).print_xml_data(writer, show_type);
116 end_xml_declaration(writer);