28 #include <Structure.h> 34 #include "grid_utils.h" 35 #include "gse_parser.h" 36 #include "GSEClause.h" 39 #include "GridGeoConstraint.h" 45 void gse_restart(FILE * in);
48 void gse_delete_buffer(
void *buffer);
49 void *gse_string(
const char *yy_str);
59 void get_grids(
BaseType *bt, vector<Grid *> *grids)
65 grids->push_back(static_cast<Grid*>(bt));
68 case dods_structure_c: {
90 void get_grids(
DDS &dds, vector<Grid *> *grids)
112 bool is_geo_grid(
Grid *grid)
115 GridGeoConstraint gc(grid);
125 void parse_gse_expression(gse_arg *arg,
BaseType *expr)
130 bool status = gse_parse(arg) == 0;
131 gse_delete_buffer(cls);
133 throw Error(malformed_expr,
"Error parsing grid selection.");
136 static void apply_grid_selection_expr(
Grid *grid, GSEClause *clause)
140 Grid::Map_iter map_i = grid->
map_begin();
141 while (map_i != grid->
map_end() && (*map_i)->name() != clause->get_map_name())
145 throw Error(malformed_expr,
"The map vector '" + clause->get_map_name()
146 +
"' is not in the grid '" + grid->
name() +
"'.");
151 Array *map = dynamic_cast <
Array * >((*map_i));
153 throw InternalErr(__FILE__, __LINE__,
"Expected an Array");
160 <<
"The expressions passed to grid() do not result in an inclusive \n" 161 <<
"subset of '" << clause->get_map_name()
162 <<
"'. The map's values range " <<
"from " 163 << clause->get_map_min_value() <<
" to " 164 << clause->get_map_max_value() <<
".";
165 throw Error(malformed_expr,msg.str());
168 DBG(cerr <<
"Setting constraint on " << map->
name() <<
"[" << start <<
":" << stop <<
"]" << endl);
175 void apply_grid_selection_expressions(
Grid * grid, vector < GSEClause * >clauses)
177 vector < GSEClause * >::iterator clause_i = clauses.begin();
178 while (clause_i != clauses.end())
179 apply_grid_selection_expr(grid, *clause_i++);
virtual void add_constraint(Dim_iter i, int start, int stride, int stop)
Adds a constraint to an Array dimension.
virtual string name() const
Returns the name of the class instance.
Vars_iter var_begin()
Return an iterator to the first variable.
string extract_string_argument(BaseType *arg)
Holds a structure (aggregate) type.
top level DAP object to house generic methods
A class for software fault reporting.
Map_iter map_begin()
Returns an iterator referencing the first Map vector.
virtual Type type() const
Returns the type of the class instance.
std::vector< dimension >::iterator Dim_iter
Holds the Grid data type.
Array * get_array()
Returns the Grid Array. This method returns the array using an Array*, so no cast is required...
virtual int dimension_stop(Dim_iter i, bool constrained=false)
Return the stop index of the constraint.
Vars_iter var_end()
Return an iterator.
virtual int dimension_start(Dim_iter i, bool constrained=false)
Return the start index of a dimension.
The basic data type for the DODS DAP types.
A class for error processing.
A multidimensional array of identical data types.
virtual void set_read_p(bool state)
Sets the value of the read_p property.