40#include "GridFunction.h"
41#include "grid_utils.h"
42#include "gse_parser.h"
77void function_grid(
int argc, BaseType *argv[], DDS &, BaseType **btpp) {
78 DBG(cerr <<
"Entering function_grid..." << endl);
80 string info = string(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") +
81 "<function name=\"grid\" version=\"1.0\" "
82 "href=\"http://docs.opendap.org/index.php/Server_Side_Processing_Functions#grid\">\n" +
86 Str *response =
new Str(
"info");
92 Grid *original_grid =
dynamic_cast<Grid *
>(argv[0]);
94 throw Error(malformed_expr,
"The first argument to grid() must be a Grid variable!");
99 Grid *l_grid =
dynamic_cast<Grid *
>(btp);
102 throw InternalErr(__FILE__, __LINE__,
"Expected a Grid.");
105 DBG(cerr <<
"grid: past initialization code" << endl);
111 BESDEBUG(
"functions",
"original_grid: read_p: " << original_grid->
read_p() << endl);
112 BESDEBUG(
"functions",
"l_grid: read_p: " << l_grid->
read_p() << endl);
114 BESDEBUG(
"functions",
"original_grid->array_(): read_p: " << original_grid->
array_var()->
read_p() << endl);
115 BESDEBUG(
"functions",
"l_grid->array+var(): read_p: " << l_grid->
array_var()->
read_p() << endl);
121 (*i++)->set_send_p(
true);
125 DBG(cerr <<
"grid: past map read" << endl);
131 vector<GSEClause *> clauses;
133 for (
int i = 1; i < argc; ++i) {
134 parse_gse_expression(arg, argv[i]);
135 clauses.push_back(arg->get_gsec());
140 apply_grid_selection_expressions(l_grid, clauses);
142 DBG(cerr <<
"grid: past gse application" << endl);
164 vector<Grid *> grids;
165 get_grids(dds, &grids);
167 return !grids.empty();
bool canOperateOn(libdap::DDS &dds)
virtual bool read_p()
Has this variable been read?
bool read() override
Read the elements of Constructor marked for transmission.
virtual BaseType * ptr_duplicate()
BaseType * array_var()
Returns the Grid Array.
Map_iter map_begin()
Returns an iterator referencing the first Map vector.
Array * get_array()
Returns the Grid Array. This method returns the array using an Array*, so no cast is required.
virtual bool set_value(const string &value)
void set_send_p(bool state) override
Indicates that the data is ready to send.
top level DAP object to house generic methods