36 #include <Structure.h> 42 #include <ServerFunctionsList.h> 47 #include "RoiFunction.h" 48 #include "functions_util.h" 77 function_dap2_roi(
int argc, BaseType *argv[], DDS &, BaseType **btpp)
79 const string wrong_args =
"Wrong number of arguments to roi(). Expected one or more Arrays and bounding box";
88 throw Error(malformed_expr, wrong_args);
90 rank = roi_valid_bbox(argv[argc-1]);
92 for (
int i = 0; i < argc-1; ++i)
93 check_number_type_array(argv[i], rank);
97 auto_ptr<Structure> response(
new Structure(
"roi_subset_unwrap"));
99 Array *bbox =
static_cast<Array*
>(argv[argc-1]);
101 for (
int i = 0; i < argc-1; ++i) {
103 Array *the_array =
static_cast<Array*
>(argv[i]);
104 BESDEBUG(
"roi",
"the_array: " << the_array->name() <<
": " << (
void*)the_array << endl);
113 unsigned int num_dims = the_array->dimensions();
115 for (
int i = rank-1; i >= 0; --i) {
119 roi_bbox_get_slice_data(bbox, i, start, stop, name);
122 Array::Dim_iter iter = the_array->dim_begin() + d;
126 if (the_array->dimension_name(iter) != name)
127 throw Error(
"In function roi(): Dimension name (" + the_array->dimension_name(iter) +
") and slice name (" + name +
") don't match");
130 BESDEBUG(
"roi",
"Dimension: " << i <<
", Start: " << start <<
", Stop: " << stop << endl);
131 the_array->add_constraint(iter, start, 1 , stop);
136 the_array->set_send_p(
true);
142 the_array->set_read_p(
false);
144 the_array->set_read_p(
true);
146 response->add_var(the_array);
149 response->set_send_p(
true);
150 response->set_read_p(
true);
152 *btpp = response.release();
165 BaseType *function_dap4_roi(D4RValueList *, DMR &)
167 throw Error(malformed_expr,
"Not yet implemented for DAP4 functions.");