38 {
"$Id: GSEClause.cc 24370 2011-03-28 16:21:32Z jimg $"
67 GSEClause::GSEClause()
69 throw InternalErr(__FILE__, __LINE__,
"default ctor called for GSEClause");
72 GSEClause::GSEClause(
const GSEClause &)
74 throw InternalErr(__FILE__, __LINE__,
"copy ctor called for GSEClause");
77 GSEClause &GSEClause::operator=(GSEClause &)
79 throw InternalErr(__FILE__, __LINE__,
"assigment called for GSEClause");
86 compare(T elem,
relop op,
double value)
100 return elem != value;
102 throw Error(
malformed_expr,
"Attempt to use NOP in Grid selection.");
104 throw Error(
malformed_expr,
"Unknown relational operator in Grid selection.");
111 GSEClause::set_map_min_max_value(T min, T max)
113 DBG(cerr <<
"Inside set map min max value " << min <<
", " << max << endl);
114 std::ostringstream oss1;
116 d_map_min_value = oss1.str();
118 std::ostringstream oss2;
120 d_map_max_value = oss2.str();
126 GSEClause::set_start_stop()
128 T *vals =
new T[d_map->length()];
133 set_map_min_max_value<T>(vals[d_start], vals[d_stop]);
142 while (i <= end && !compare<T>(vals[i], d_op1, d_value1))
150 while (i >= 0 && !compare<T>(vals[i], d_op1, d_value1))
161 while (i <= end && !compare<T>(vals[i], d_op2, d_value2))
167 while (i >= 0 && !compare<T>(vals[i], d_op2, d_value2))
177 GSEClause::compute_indices()
179 switch (d_map->var()->type()) {
181 set_start_stop<dods_byte>();
184 set_start_stop<dods_int16>();
187 set_start_stop<dods_uint16>();
190 set_start_stop<dods_int32>();
193 set_start_stop<dods_uint32>();
196 set_start_stop<dods_float32>();
199 set_start_stop<dods_float64>();
203 "Grid selection using non-numeric map vectors is not supported");
211 GSEClause::GSEClause(
Grid *grid,
const string &map,
const double value,
214 d_value1(value), d_value2(0), d_op1(op), d_op2(
dods_nop_op),
215 d_map_min_value(
""), d_map_max_value(
"")
217 d_map =
dynamic_cast<Array *
>(grid->
var(map));
219 throw Error(
string(
"The map variable '") + map
220 +
string(
"' does not exist in the grid '")
221 + grid->
name() + string(
"'."));
234 GSEClause::GSEClause(
Grid *grid,
const string &map,
const double value1,
235 const relop op1,
const double value2,
const relop op2)
237 d_value1(value1), d_value2(value2), d_op1(op1), d_op2(op2),
238 d_map_min_value(
""), d_map_max_value(
"")
240 d_map =
dynamic_cast<Array *
>(grid->
var(map));
242 throw Error(
string(
"The map variable '") + map
243 +
string(
"' does not exist in the grid '")
244 + grid->
name() + string(
"'."));
292 return d_map->
name();
318 DBG(cerr <<
"Returning stop index value of: " << d_stop << endl);
337 return d_map_min_value;
347 return d_map_max_value;