46 #include <ConstraintEvaluator.h> 47 #include <Marshaller.h> 51 #include "BESIndent.h" 52 #include "CachedSequence.h" 59 void CachedSequence::load_prototypes_with_values(BaseTypeRow &btr,
bool safe)
65 Vars_iter i = d_vars.begin(), e = d_vars.end();
66 for (BaseTypeRow::iterator vi = btr.begin(), ve = btr.end(); vi != ve; ++vi) {
68 if (safe && (i == e || ((*i)->type() != (*vi)->type())))
69 throw InternalErr(__FILE__, __LINE__,
"Expected number and types to match when loading values.");
72 switch ((*i)->type()) {
74 static_cast<Byte*>(*i++)->set_value(static_cast<Byte*>(*vi)->value());
77 static_cast<Int16*>(*i++)->set_value(static_cast<Int16*>((*vi))->value());
80 static_cast<Int32*>(*i++)->set_value(static_cast<Int32*>((*vi))->value());
83 static_cast<UInt16*>(*i++)->set_value(static_cast<UInt16*>((*vi))->value());
86 static_cast<UInt32*>(*i++)->set_value(static_cast<UInt32*>((*vi))->value());
89 static_cast<Float32*>(*i++)->set_value(static_cast<Float32*>((*vi))->value());
92 static_cast<Float64*>(*i++)->set_value(static_cast<Float64*>((*vi))->value());
95 static_cast<Str*>(*i++)->set_value(static_cast<Str*>((*vi))->value());
98 static_cast<Url*>(*i++)->set_value(static_cast<Url*>((*vi))->value());
101 case dods_sequence_c:
103 throw InternalErr(__FILE__, __LINE__,
"Expected nested sequence to be the last variable.");
107 throw InternalErr(__FILE__, __LINE__,
"Expected a scalar (or nested sequence) when loading values.");
144 DBGN(cerr << __PRETTY_FUNCTION__ <<
" name: " << name() <<
", row number " << row <<
", current row " << get_row_number() << endl);
153 assert(row > get_row_number());
155 while (row > get_row_number()) {
160 BaseTypeRow *btr_ptr = row_value(d_value_index++);
166 if (!btr_ptr)
return false;
170 load_prototypes_with_values(*btr_ptr,
false);
172 load_prototypes_with_values(*btr_ptr,
true);
175 increment_row_number(1);
178 else if (ce_eval && eval.eval_selection(dds, dataset())) {
179 increment_row_number(1);
204 return Sequence::serialize(eval, dds, m, ce_eval);
220 Sequence::intern_data(eval, dds);
234 strm << BESIndent::LMarg <<
"CachedSequence::dump - (" << (
void *)
this <<
")" << endl ;
235 BESIndent::Indent() ;
236 Sequence::dump(strm) ;
237 BESIndent::UnIndent() ;
virtual bool read_row(int row, libdap::DDS &dds, libdap::ConstraintEvaluator &eval, bool ce_eval)
Read row number row of the Sequence.
virtual void intern_data(libdap::ConstraintEvaluator &eval, libdap::DDS &dds)
Specialization that resets CachedSequence's 'value index' state variable.
virtual void dump(ostream &strm) const
dumps information about this object
virtual bool serialize(libdap::ConstraintEvaluator &eval, libdap::DDS &dds, libdap::Marshaller &m, bool ce_eval=true)
Specialization that resets CachedSequence's 'value index' state variable.